@0xsequence/wallet-primitives 0.0.0-20250520201059
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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +202 -0
- package/dist/address.d.ts +5 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +7 -0
- package/dist/address.js.map +1 -0
- package/dist/attestation.d.ts +24 -0
- package/dist/attestation.d.ts.map +1 -0
- package/dist/attestation.js +77 -0
- package/dist/attestation.js.map +1 -0
- package/dist/config.d.ts +85 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +381 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +173 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +31 -0
- package/dist/constants.js.map +1 -0
- package/dist/context.d.ts +9 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +8 -0
- package/dist/context.js.map +1 -0
- package/dist/erc-6492.d.ts +19 -0
- package/dist/erc-6492.d.ts.map +1 -0
- package/dist/erc-6492.js +64 -0
- package/dist/erc-6492.js.map +1 -0
- package/dist/extensions/index.d.ts +9 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +7 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/passkeys.d.ts +31 -0
- package/dist/extensions/passkeys.d.ts.map +1 -0
- package/dist/extensions/passkeys.js +224 -0
- package/dist/extensions/passkeys.js.map +1 -0
- package/dist/extensions/recovery.d.ts +310 -0
- package/dist/extensions/recovery.d.ts.map +1 -0
- package/dist/extensions/recovery.js +444 -0
- package/dist/extensions/recovery.js.map +1 -0
- package/dist/generic-tree.d.ts +14 -0
- package/dist/generic-tree.d.ts.map +1 -0
- package/dist/generic-tree.js +34 -0
- package/dist/generic-tree.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/network.d.ts +15 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/network.js +24 -0
- package/dist/network.js.map +1 -0
- package/dist/payload.d.ts +108 -0
- package/dist/payload.d.ts.map +1 -0
- package/dist/payload.js +627 -0
- package/dist/payload.js.map +1 -0
- package/dist/permission.d.ts +73 -0
- package/dist/permission.d.ts.map +1 -0
- package/dist/permission.js +188 -0
- package/dist/permission.js.map +1 -0
- package/dist/session-config.d.ts +113 -0
- package/dist/session-config.d.ts.map +1 -0
- package/dist/session-config.js +554 -0
- package/dist/session-config.js.map +1 -0
- package/dist/session-signature.d.ts +24 -0
- package/dist/session-signature.d.ts.map +1 -0
- package/dist/session-signature.js +141 -0
- package/dist/session-signature.js.map +1 -0
- package/dist/signature.d.ts +108 -0
- package/dist/signature.d.ts.map +1 -0
- package/dist/signature.js +1079 -0
- package/dist/signature.js.map +1 -0
- package/dist/utils.d.ts +45 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +100 -0
- package/dist/utils.js.map +1 -0
- package/eslint.config.mjs +4 -0
- package/package.json +27 -0
- package/src/address.ts +19 -0
- package/src/attestation.ts +114 -0
- package/src/config.ts +521 -0
- package/src/constants.ts +39 -0
- package/src/context.ts +16 -0
- package/src/erc-6492.ts +97 -0
- package/src/extensions/index.ts +14 -0
- package/src/extensions/passkeys.ts +283 -0
- package/src/extensions/recovery.ts +542 -0
- package/src/generic-tree.ts +55 -0
- package/src/index.ts +15 -0
- package/src/network.ts +37 -0
- package/src/payload.ts +825 -0
- package/src/permission.ts +252 -0
- package/src/session-config.ts +681 -0
- package/src/session-signature.ts +197 -0
- package/src/signature.ts +1398 -0
- package/src/utils.ts +114 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import { Abi, AbiFunction, Address, Bytes, Hex } from 'ox';
|
|
2
|
+
import * as Payload from '../payload.js';
|
|
3
|
+
import * as GenericTree from '../generic-tree.js';
|
|
4
|
+
import { packRSY } from '../utils.js';
|
|
5
|
+
export const FLAG_RECOVERY_LEAF = 1;
|
|
6
|
+
export const FLAG_NODE = 3;
|
|
7
|
+
export const FLAG_BRANCH = 4;
|
|
8
|
+
const RECOVERY_LEAF_PREFIX = Bytes.fromString('Sequence recovery leaf:\n');
|
|
9
|
+
export const QUEUE_PAYLOAD = Abi.from([
|
|
10
|
+
'function queuePayload(address _wallet, address _signer, (uint8 kind,bool noChainId,(address to,uint256 value,bytes data,uint256 gasLimit,bool delegateCall,bool onlyFallback,uint256 behaviorOnError)[] calls,uint256 space,uint256 nonce,bytes message,bytes32 imageHash,bytes32 digest,address[] parentWallets) calldata _payload, bytes calldata _signature) external',
|
|
11
|
+
])[0];
|
|
12
|
+
export const TIMESTAMP_FOR_QUEUED_PAYLOAD = Abi.from([
|
|
13
|
+
'function timestampForQueuedPayload(address _wallet, address _signer, bytes32 _payloadHash) external view returns (uint256)',
|
|
14
|
+
])[0];
|
|
15
|
+
export const QUEUED_PAYLOAD_HASHES = Abi.from([
|
|
16
|
+
'function queuedPayloadHashes(address _wallet, address _signer, uint256 _index) external view returns (bytes32)',
|
|
17
|
+
])[0];
|
|
18
|
+
export const TOTAL_QUEUED_PAYLOADS = Abi.from([
|
|
19
|
+
'function totalQueuedPayloads(address _wallet, address _signer) external view returns (uint256)',
|
|
20
|
+
])[0];
|
|
21
|
+
/**
|
|
22
|
+
* Type guard to check if a value is a RecoveryLeaf
|
|
23
|
+
*/
|
|
24
|
+
export function isRecoveryLeaf(cand) {
|
|
25
|
+
return typeof cand === 'object' && cand !== null && cand.type === 'leaf';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Type guard to check if a value is a Node (pair of subtrees)
|
|
29
|
+
*/
|
|
30
|
+
export function isBranch(cand) {
|
|
31
|
+
return Array.isArray(cand) && cand.length === 2 && isTree(cand[0]) && isTree(cand[1]);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Type guard to check if a value is a Topology
|
|
35
|
+
*/
|
|
36
|
+
export function isTree(cand) {
|
|
37
|
+
return isRecoveryLeaf(cand) || GenericTree.isNode(cand) || isBranch(cand);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* EIP-712 domain parameters for "Sequence Wallet - Recovery Mode"
|
|
41
|
+
*/
|
|
42
|
+
export const DOMAIN_NAME = 'Sequence Wallet - Recovery Mode';
|
|
43
|
+
export const DOMAIN_VERSION = '1';
|
|
44
|
+
/**
|
|
45
|
+
* Recursively computes the root hash of a RecoveryTree,
|
|
46
|
+
* consistent with the contract's fkeccak256 usage for (root, node).
|
|
47
|
+
*
|
|
48
|
+
* For recovery leaves, it hashes the leaf data with a prefix.
|
|
49
|
+
* For node leaves, it returns the hash directly.
|
|
50
|
+
* For nodes, it hashes the concatenation of the hashes of both subtrees.
|
|
51
|
+
*/
|
|
52
|
+
export function hashConfiguration(topology) {
|
|
53
|
+
return GenericTree.hash(toGenericTree(topology));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Flatten a RecoveryTree into an array of just the leaves.
|
|
57
|
+
* Ignores branch boundaries or node references.
|
|
58
|
+
*
|
|
59
|
+
* @returns Object containing:
|
|
60
|
+
* - leaves: Array of RecoveryLeaf nodes
|
|
61
|
+
* - isComplete: boolean indicating if all leaves are present (no node references)
|
|
62
|
+
*/
|
|
63
|
+
export function getRecoveryLeaves(topology) {
|
|
64
|
+
const isComplete = true;
|
|
65
|
+
if (isRecoveryLeaf(topology)) {
|
|
66
|
+
return { leaves: [topology], isComplete };
|
|
67
|
+
}
|
|
68
|
+
else if (GenericTree.isNode(topology)) {
|
|
69
|
+
return { leaves: [], isComplete: false };
|
|
70
|
+
}
|
|
71
|
+
else if (isBranch(topology)) {
|
|
72
|
+
const left = getRecoveryLeaves(topology[0]);
|
|
73
|
+
const right = getRecoveryLeaves(topology[1]);
|
|
74
|
+
return { leaves: [...left.leaves, ...right.leaves], isComplete: left.isComplete && right.isComplete };
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new Error('Invalid topology');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Decode a binary encoded topology into a Topology object
|
|
82
|
+
*
|
|
83
|
+
* @param encoded - The binary encoded topology
|
|
84
|
+
* @returns The decoded Topology object
|
|
85
|
+
* @throws Error if the encoding is invalid
|
|
86
|
+
*/
|
|
87
|
+
export function decodeTopology(encoded) {
|
|
88
|
+
const { nodes, leftover } = parseBranch(encoded);
|
|
89
|
+
if (leftover.length > 0) {
|
|
90
|
+
throw new Error('Leftover bytes in branch');
|
|
91
|
+
}
|
|
92
|
+
return foldNodes(nodes);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Parse a branch of the topology from binary encoding
|
|
96
|
+
*
|
|
97
|
+
* @param encoded - The binary encoded branch
|
|
98
|
+
* @returns Object containing:
|
|
99
|
+
* - nodes: Array of parsed Topology nodes
|
|
100
|
+
* - leftover: Any remaining unparsed bytes
|
|
101
|
+
* @throws Error if the encoding is invalid
|
|
102
|
+
*/
|
|
103
|
+
export function parseBranch(encoded) {
|
|
104
|
+
if (encoded.length === 0) {
|
|
105
|
+
throw new Error('Empty branch');
|
|
106
|
+
}
|
|
107
|
+
const nodes = [];
|
|
108
|
+
let index = 0;
|
|
109
|
+
while (index < encoded.length) {
|
|
110
|
+
const flag = encoded[index];
|
|
111
|
+
if (flag === FLAG_RECOVERY_LEAF) {
|
|
112
|
+
if (encoded.length < index + 32) {
|
|
113
|
+
throw new Error('Invalid recovery leaf');
|
|
114
|
+
}
|
|
115
|
+
const signer = Address.from(Hex.fromBytes(encoded.slice(index + 1, index + 21)));
|
|
116
|
+
const requiredDeltaTime = Bytes.toBigInt(encoded.slice(index + 21, index + 24));
|
|
117
|
+
const minTimestamp = Bytes.toBigInt(encoded.slice(index + 24, index + 32));
|
|
118
|
+
nodes.push({ type: 'leaf', signer, requiredDeltaTime, minTimestamp });
|
|
119
|
+
index += 32;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
else if (flag === FLAG_NODE) {
|
|
123
|
+
// total = 1 (flag) + 32 (node hash)
|
|
124
|
+
if (encoded.length < index + 33) {
|
|
125
|
+
throw new Error('Invalid node');
|
|
126
|
+
}
|
|
127
|
+
const node = Hex.fromBytes(encoded.slice(index + 1, index + 33));
|
|
128
|
+
nodes.push(node);
|
|
129
|
+
index += 33;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
else if (flag === FLAG_BRANCH) {
|
|
133
|
+
if (encoded.length < index + 4) {
|
|
134
|
+
throw new Error('Invalid branch');
|
|
135
|
+
}
|
|
136
|
+
const size = Bytes.toNumber(encoded.slice(index + 1, index + 4));
|
|
137
|
+
if (encoded.length < index + 4 + size) {
|
|
138
|
+
throw new Error('Invalid branch');
|
|
139
|
+
}
|
|
140
|
+
const branch = encoded.slice(index + 4, index + 4 + size);
|
|
141
|
+
const { nodes: subNodes, leftover } = parseBranch(branch);
|
|
142
|
+
if (leftover.length > 0) {
|
|
143
|
+
throw new Error('Leftover bytes in sub-branch');
|
|
144
|
+
}
|
|
145
|
+
const subTree = foldNodes(subNodes);
|
|
146
|
+
nodes.push(subTree);
|
|
147
|
+
index += 4 + size;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
throw new Error('Invalid flag');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return { nodes, leftover: encoded.slice(index) };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Trim a topology tree to only include leaves for a specific signer.
|
|
158
|
+
* All other leaves are replaced with their hashes.
|
|
159
|
+
*
|
|
160
|
+
* @param topology - The topology to trim
|
|
161
|
+
* @param signer - The signer address to keep
|
|
162
|
+
* @returns The trimmed topology
|
|
163
|
+
*/
|
|
164
|
+
export function trimTopology(topology, signer) {
|
|
165
|
+
if (isRecoveryLeaf(topology)) {
|
|
166
|
+
if (topology.signer === signer) {
|
|
167
|
+
return topology;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return hashConfiguration(topology);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (GenericTree.isNode(topology)) {
|
|
174
|
+
return topology;
|
|
175
|
+
}
|
|
176
|
+
if (isBranch(topology)) {
|
|
177
|
+
const left = trimTopology(topology[0], signer);
|
|
178
|
+
const right = trimTopology(topology[1], signer);
|
|
179
|
+
// If both are hashes, we can just return the hash of the node
|
|
180
|
+
if (GenericTree.isNode(left) && GenericTree.isNode(right)) {
|
|
181
|
+
return hashConfiguration(topology);
|
|
182
|
+
}
|
|
183
|
+
return [left, right];
|
|
184
|
+
}
|
|
185
|
+
throw new Error('Invalid topology');
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Encode a topology into its binary representation
|
|
189
|
+
*
|
|
190
|
+
* @param topology - The topology to encode
|
|
191
|
+
* @returns The binary encoded topology
|
|
192
|
+
* @throws Error if the topology is invalid
|
|
193
|
+
*/
|
|
194
|
+
export function encodeTopology(topology) {
|
|
195
|
+
if (isBranch(topology)) {
|
|
196
|
+
const encoded0 = encodeTopology(topology[0]);
|
|
197
|
+
const encoded1 = encodeTopology(topology[1]);
|
|
198
|
+
const isBranching = isBranch(topology[1]);
|
|
199
|
+
if (isBranching) {
|
|
200
|
+
// max 3 bytes for the size
|
|
201
|
+
if (encoded1.length > 16777215) {
|
|
202
|
+
throw new Error('Branch too large');
|
|
203
|
+
}
|
|
204
|
+
const flag = Bytes.fromNumber(FLAG_BRANCH);
|
|
205
|
+
const size = Bytes.padLeft(Bytes.fromNumber(encoded1.length), 3);
|
|
206
|
+
return Bytes.concat(encoded0, flag, size, encoded1);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
return Bytes.concat(encoded0, encoded1);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (GenericTree.isNode(topology)) {
|
|
213
|
+
const flag = Bytes.fromNumber(FLAG_NODE);
|
|
214
|
+
const nodeHash = Bytes.fromHex(topology, { size: 32 });
|
|
215
|
+
return Bytes.concat(flag, nodeHash);
|
|
216
|
+
}
|
|
217
|
+
if (isRecoveryLeaf(topology)) {
|
|
218
|
+
const flag = Bytes.fromNumber(FLAG_RECOVERY_LEAF);
|
|
219
|
+
const signer = Bytes.fromHex(topology.signer, { size: 20 });
|
|
220
|
+
if (topology.requiredDeltaTime > 16777215n) {
|
|
221
|
+
throw new Error('Required delta time too large');
|
|
222
|
+
}
|
|
223
|
+
const requiredDeltaTime = Bytes.padLeft(Bytes.fromNumber(topology.requiredDeltaTime), 3);
|
|
224
|
+
if (topology.minTimestamp > 18446744073709551615n) {
|
|
225
|
+
throw new Error('Min timestamp too large');
|
|
226
|
+
}
|
|
227
|
+
const minTimestamp = Bytes.padLeft(Bytes.fromNumber(topology.minTimestamp), 8);
|
|
228
|
+
return Bytes.concat(flag, signer, requiredDeltaTime, minTimestamp);
|
|
229
|
+
}
|
|
230
|
+
throw new Error('Invalid topology');
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Helper function to fold a list of nodes into a binary tree structure
|
|
234
|
+
*
|
|
235
|
+
* @param nodes - Array of topology nodes
|
|
236
|
+
* @returns A binary tree structure
|
|
237
|
+
* @throws Error if the nodes array is empty
|
|
238
|
+
*/
|
|
239
|
+
function foldNodes(nodes) {
|
|
240
|
+
if (nodes.length === 0) {
|
|
241
|
+
throw new Error('Empty signature tree');
|
|
242
|
+
}
|
|
243
|
+
if (nodes.length === 1) {
|
|
244
|
+
return nodes[0];
|
|
245
|
+
}
|
|
246
|
+
let tree = nodes[0];
|
|
247
|
+
for (let i = 1; i < nodes.length; i++) {
|
|
248
|
+
tree = [tree, nodes[i]];
|
|
249
|
+
}
|
|
250
|
+
return tree;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Build a RecoveryTree from an array of leaves, making a minimal branch structure.
|
|
254
|
+
* If there's exactly one leaf, we return that leaf. If there's more than one, we
|
|
255
|
+
* build a branch of them in pairs.
|
|
256
|
+
*
|
|
257
|
+
* @param leaves - Array of recovery leaves
|
|
258
|
+
* @returns A topology tree structure
|
|
259
|
+
* @throws Error if the leaves array is empty
|
|
260
|
+
*/
|
|
261
|
+
export function fromRecoveryLeaves(leaves) {
|
|
262
|
+
if (leaves.length === 0) {
|
|
263
|
+
throw new Error('Cannot build a tree with zero leaves');
|
|
264
|
+
}
|
|
265
|
+
if (leaves.length === 1) {
|
|
266
|
+
return leaves[0];
|
|
267
|
+
}
|
|
268
|
+
const mid = Math.floor(leaves.length / 2);
|
|
269
|
+
const left = fromRecoveryLeaves(leaves.slice(0, mid));
|
|
270
|
+
const right = fromRecoveryLeaves(leaves.slice(mid));
|
|
271
|
+
return [left, right];
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Produces an EIP-712 typed data hash for a "recovery mode" payload,
|
|
275
|
+
* matching the logic in Recovery.sol:
|
|
276
|
+
*
|
|
277
|
+
* keccak256(
|
|
278
|
+
* "\x19\x01",
|
|
279
|
+
* domainSeparator(noChainId, wallet),
|
|
280
|
+
* Payload.toEIP712(payload)
|
|
281
|
+
* )
|
|
282
|
+
*
|
|
283
|
+
* @param payload - The payload to hash
|
|
284
|
+
* @param wallet - The wallet address
|
|
285
|
+
* @param chainId - The chain ID
|
|
286
|
+
* @param noChainId - Whether to omit the chain ID from the domain separator
|
|
287
|
+
* @returns The payload hash
|
|
288
|
+
*/
|
|
289
|
+
export function hashRecoveryPayload(payload, wallet, chainId, noChainId) {
|
|
290
|
+
const recoveryPayload = Payload.toRecovery(payload);
|
|
291
|
+
return Hex.fromBytes(Payload.hash(wallet, noChainId ? 0n : chainId, recoveryPayload));
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Convert a RecoveryTree topology to a generic tree format
|
|
295
|
+
*
|
|
296
|
+
* @param topology - The recovery tree topology to convert
|
|
297
|
+
* @returns A generic tree that produces the same root hash
|
|
298
|
+
*/
|
|
299
|
+
export function toGenericTree(topology) {
|
|
300
|
+
if (isRecoveryLeaf(topology)) {
|
|
301
|
+
// Convert recovery leaf to generic leaf
|
|
302
|
+
return {
|
|
303
|
+
type: 'leaf',
|
|
304
|
+
value: Bytes.concat(RECOVERY_LEAF_PREFIX, Bytes.fromHex(topology.signer, { size: 20 }), Bytes.padLeft(Bytes.fromNumber(topology.requiredDeltaTime), 32), Bytes.padLeft(Bytes.fromNumber(topology.minTimestamp), 32)),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
else if (GenericTree.isNode(topology)) {
|
|
308
|
+
// Node leaves are already in the correct format
|
|
309
|
+
return topology;
|
|
310
|
+
}
|
|
311
|
+
else if (isBranch(topology)) {
|
|
312
|
+
// Convert node to branch
|
|
313
|
+
return [toGenericTree(topology[0]), toGenericTree(topology[1])];
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
throw new Error('Invalid topology');
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Convert a generic tree back to a RecoveryTree topology
|
|
321
|
+
*
|
|
322
|
+
* @param tree - The generic tree to convert
|
|
323
|
+
* @returns A recovery tree topology that produces the same root hash
|
|
324
|
+
*/
|
|
325
|
+
export function fromGenericTree(tree) {
|
|
326
|
+
if (GenericTree.isLeaf(tree)) {
|
|
327
|
+
// Convert generic leaf back to recovery leaf
|
|
328
|
+
const bytes = tree.value;
|
|
329
|
+
if (bytes.length !== RECOVERY_LEAF_PREFIX.length + 84 ||
|
|
330
|
+
!Bytes.isEqual(bytes.slice(0, RECOVERY_LEAF_PREFIX.length), RECOVERY_LEAF_PREFIX)) {
|
|
331
|
+
throw new Error('Invalid recovery leaf format');
|
|
332
|
+
}
|
|
333
|
+
const offset = RECOVERY_LEAF_PREFIX.length;
|
|
334
|
+
const signer = Address.from(Hex.fromBytes(bytes.slice(offset, offset + 20)));
|
|
335
|
+
const requiredDeltaTime = Bytes.toBigInt(bytes.slice(offset + 20, offset + 52));
|
|
336
|
+
const minTimestamp = Bytes.toBigInt(bytes.slice(offset + 52, offset + 84));
|
|
337
|
+
return {
|
|
338
|
+
type: 'leaf',
|
|
339
|
+
signer,
|
|
340
|
+
requiredDeltaTime,
|
|
341
|
+
minTimestamp,
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
else if (GenericTree.isNode(tree)) {
|
|
345
|
+
// Nodes are already in the correct format
|
|
346
|
+
return tree;
|
|
347
|
+
}
|
|
348
|
+
else if (GenericTree.isBranch(tree)) {
|
|
349
|
+
// Convert branch back to node
|
|
350
|
+
if (tree.length !== 2) {
|
|
351
|
+
throw new Error('Recovery tree only supports binary branches');
|
|
352
|
+
}
|
|
353
|
+
return [fromGenericTree(tree[0]), fromGenericTree(tree[1])];
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
throw new Error('Invalid tree format');
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Encodes the calldata for queueing a recovery payload on the recovery extension
|
|
361
|
+
*
|
|
362
|
+
* @param wallet - The wallet address that owns the recovery configuration
|
|
363
|
+
* @param payload - The recovery payload to queue for execution
|
|
364
|
+
* @param signer - The recovery signer address that is queueing the payload
|
|
365
|
+
* @param signature - The signature from the recovery signer authorizing the payload
|
|
366
|
+
* @returns The encoded calldata for the queuePayload function on the recovery extension
|
|
367
|
+
*/
|
|
368
|
+
export function encodeCalldata(wallet, payload, signer, signature) {
|
|
369
|
+
let signatureBytes;
|
|
370
|
+
if (signature.type === 'erc1271') {
|
|
371
|
+
signatureBytes = signature.data;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
signatureBytes = Bytes.toHex(packRSY(signature));
|
|
375
|
+
}
|
|
376
|
+
const abiPayload = Payload.toAbiFormat(payload);
|
|
377
|
+
return AbiFunction.encodeData(QUEUE_PAYLOAD, [wallet, signer, abiPayload, signatureBytes]);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Gets the total number of payloads queued by a recovery signer for a wallet
|
|
381
|
+
*
|
|
382
|
+
* @param provider - The provider to use for making the eth_call
|
|
383
|
+
* @param extension - The address of the recovery extension contract
|
|
384
|
+
* @param wallet - The wallet address to check queued payloads for
|
|
385
|
+
* @param signer - The recovery signer address to check queued payloads for
|
|
386
|
+
* @returns The total number of payloads queued by this signer for this wallet
|
|
387
|
+
*/
|
|
388
|
+
export async function totalQueuedPayloads(provider, extension, wallet, signer) {
|
|
389
|
+
const total = await provider.request({
|
|
390
|
+
method: 'eth_call',
|
|
391
|
+
params: [
|
|
392
|
+
{
|
|
393
|
+
to: extension,
|
|
394
|
+
data: AbiFunction.encodeData(TOTAL_QUEUED_PAYLOADS, [wallet, signer]),
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
});
|
|
398
|
+
return Hex.toBigInt(total);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Gets the hash of a queued payload at a specific index
|
|
402
|
+
*
|
|
403
|
+
* @param provider - The provider to use for making the eth_call
|
|
404
|
+
* @param extension - The address of the recovery extension contract
|
|
405
|
+
* @param wallet - The wallet address to get the queued payload for
|
|
406
|
+
* @param signer - The recovery signer address that queued the payload
|
|
407
|
+
* @param index - The index of the queued payload to get the hash for
|
|
408
|
+
* @returns The hash of the queued payload at the specified index
|
|
409
|
+
*/
|
|
410
|
+
export async function queuedPayloadHashOf(provider, extension, wallet, signer, index) {
|
|
411
|
+
const hash = await provider.request({
|
|
412
|
+
method: 'eth_call',
|
|
413
|
+
params: [
|
|
414
|
+
{
|
|
415
|
+
to: extension,
|
|
416
|
+
data: AbiFunction.encodeData(QUEUED_PAYLOAD_HASHES, [wallet, signer, index]),
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
});
|
|
420
|
+
return hash;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Gets the timestamp when a specific payload was queued
|
|
424
|
+
*
|
|
425
|
+
* @param provider - The provider to use for making the eth_call
|
|
426
|
+
* @param extension - The address of the recovery extension contract
|
|
427
|
+
* @param wallet - The wallet address the payload was queued for
|
|
428
|
+
* @param signer - The recovery signer address that queued the payload
|
|
429
|
+
* @param payloadHash - The hash of the queued payload to get the timestamp for
|
|
430
|
+
* @returns The timestamp when the payload was queued, or 0 if not found
|
|
431
|
+
*/
|
|
432
|
+
export async function timestampForQueuedPayload(provider, extension, wallet, signer, payloadHash) {
|
|
433
|
+
const timestamp = await provider.request({
|
|
434
|
+
method: 'eth_call',
|
|
435
|
+
params: [
|
|
436
|
+
{
|
|
437
|
+
to: extension,
|
|
438
|
+
data: AbiFunction.encodeData(TIMESTAMP_FOR_QUEUED_PAYLOAD, [wallet, signer, payloadHash]),
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
});
|
|
442
|
+
return Hex.toBigInt(timestamp);
|
|
443
|
+
}
|
|
444
|
+
//# sourceMappingURL=recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../src/extensions/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAQ,GAAG,EAAY,MAAM,IAAI,CAAA;AAC1E,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AACnC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAA;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAE5B,MAAM,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAA;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC;IACpC,0WAA0W;CAC3W,CAAC,CAAC,CAAC,CAAC,CAAA;AAEL,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC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AW,CAAC,UAAU,CAAC,4BAA4B,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;aAC1F;SACF;KACF,CAAC,CAAA;IAEF,OAAO,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Bytes, Hex } from 'ox';
|
|
2
|
+
export type Leaf = {
|
|
3
|
+
type: 'leaf';
|
|
4
|
+
value: Bytes.Bytes;
|
|
5
|
+
};
|
|
6
|
+
export type Node = Hex.Hex;
|
|
7
|
+
export type Branch = [Tree, Tree, ...Tree[]];
|
|
8
|
+
export type Tree = Branch | Leaf | Node;
|
|
9
|
+
export declare function isBranch(tree: Tree): tree is Branch;
|
|
10
|
+
export declare function isLeaf(tree: any): tree is Leaf;
|
|
11
|
+
export declare function isTree(tree: any): tree is Tree;
|
|
12
|
+
export declare function isNode(node: any): node is Node;
|
|
13
|
+
export declare function hash(tree: Tree): Hex.Hex;
|
|
14
|
+
//# sourceMappingURL=generic-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-tree.d.ts","sourceRoot":"","sources":["../src/generic-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAQ,GAAG,EAAE,MAAM,IAAI,CAAA;AAMrC,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,KAAK,CAAC,KAAK,CAAA;CACnB,CAAA;AAGD,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAA;AAE1B,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;AAC5C,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAEnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,IAAI,CAE9C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,IAAI,CAE9C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,IAAI,CAE9C;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,GAAG,CAqBxC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Bytes, Hash, Hex } from 'ox';
|
|
2
|
+
export function isBranch(tree) {
|
|
3
|
+
return Array.isArray(tree) && tree.length >= 2 && tree.every((child) => isTree(child));
|
|
4
|
+
}
|
|
5
|
+
export function isLeaf(tree) {
|
|
6
|
+
return tree.type === 'leaf' && Bytes.validate(tree.value);
|
|
7
|
+
}
|
|
8
|
+
export function isTree(tree) {
|
|
9
|
+
return isBranch(tree) || isLeaf(tree) || isNode(tree);
|
|
10
|
+
}
|
|
11
|
+
export function isNode(node) {
|
|
12
|
+
return Hex.validate(node) && Hex.size(node) === 32;
|
|
13
|
+
}
|
|
14
|
+
export function hash(tree) {
|
|
15
|
+
if (isBranch(tree)) {
|
|
16
|
+
// Sequentially hash the children
|
|
17
|
+
const hashedChildren = tree.map(hash);
|
|
18
|
+
if (hashedChildren.length === 0) {
|
|
19
|
+
throw new Error('Empty branch');
|
|
20
|
+
}
|
|
21
|
+
let chashBytes = Hex.toBytes(hashedChildren[0]);
|
|
22
|
+
for (let i = 1; i < hashedChildren.length; i++) {
|
|
23
|
+
chashBytes = Hash.keccak256(Bytes.concat(chashBytes, Hex.toBytes(hashedChildren[i])));
|
|
24
|
+
}
|
|
25
|
+
return Hex.fromBytes(chashBytes);
|
|
26
|
+
}
|
|
27
|
+
// Nodes are already hashed
|
|
28
|
+
if (isNode(tree)) {
|
|
29
|
+
return tree;
|
|
30
|
+
}
|
|
31
|
+
// Hash the leaf
|
|
32
|
+
return Hash.keccak256(tree.value, { as: 'Hex' });
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=generic-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-tree.js","sourceRoot":"","sources":["../src/generic-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,IAAI,CAAA;AAiBrC,MAAM,UAAU,QAAQ,CAAC,IAAU;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;AACxF,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAS;IAC9B,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAS;IAC9B,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAA;AACvD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAS;IAC9B,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAU;IAC7B,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,iCAAiC;QACjC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACrC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;QACjC,CAAC;QACD,IAAI,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAE,CAAC,CAAA;QAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/C,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAA;QACxF,CAAC;QACD,OAAO,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;IAED,2BAA2B;IAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,gBAAgB;IAChB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;AAClD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * as Address from './address.js';
|
|
2
|
+
export * as Attestation from './attestation.js';
|
|
3
|
+
export * as Constants from './constants.js';
|
|
4
|
+
export * as Erc6492 from './erc-6492.js';
|
|
5
|
+
export * as Payload from './payload.js';
|
|
6
|
+
export * as Permission from './permission.js';
|
|
7
|
+
export * as SessionConfig from './session-config.js';
|
|
8
|
+
export * as SessionSignature from './session-signature.js';
|
|
9
|
+
export * as Signature from './signature.js';
|
|
10
|
+
export * as Utils from './utils.js';
|
|
11
|
+
export * as Config from './config.js';
|
|
12
|
+
export * as Context from './context.js';
|
|
13
|
+
export * as Extensions from './extensions/index.js';
|
|
14
|
+
export * as GenericTree from './generic-tree.js';
|
|
15
|
+
export * as Network from './network.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * as Address from './address.js';
|
|
2
|
+
export * as Attestation from './attestation.js';
|
|
3
|
+
export * as Constants from './constants.js';
|
|
4
|
+
export * as Erc6492 from './erc-6492.js';
|
|
5
|
+
export * as Payload from './payload.js';
|
|
6
|
+
export * as Permission from './permission.js';
|
|
7
|
+
export * as SessionConfig from './session-config.js';
|
|
8
|
+
export * as SessionSignature from './session-signature.js';
|
|
9
|
+
export * as Signature from './signature.js';
|
|
10
|
+
export * as Utils from './utils.js';
|
|
11
|
+
export * as Config from './config.js';
|
|
12
|
+
export * as Context from './context.js';
|
|
13
|
+
export * as Extensions from './extensions/index.js';
|
|
14
|
+
export * as GenericTree from './generic-tree.js';
|
|
15
|
+
export * as Network from './network.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Network = {
|
|
2
|
+
name: string;
|
|
3
|
+
rpc: string;
|
|
4
|
+
chainId: bigint;
|
|
5
|
+
explorer: string;
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
name: string;
|
|
8
|
+
symbol: string;
|
|
9
|
+
decimals: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const Arbitrum: Network;
|
|
13
|
+
export declare const ArbitrumSepolia: Network;
|
|
14
|
+
export declare const All: Network[];
|
|
15
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,OAUtB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAU7B,CAAA;AAED,eAAO,MAAM,GAAG,WAA8B,CAAA"}
|
package/dist/network.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const Arbitrum = {
|
|
2
|
+
name: 'Arbitrum',
|
|
3
|
+
rpc: 'https://nodes.sequence.app/arbitrum',
|
|
4
|
+
chainId: 42161n,
|
|
5
|
+
explorer: 'https://arbiscan.io/',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
name: 'Ether',
|
|
8
|
+
symbol: 'ETH',
|
|
9
|
+
decimals: 18,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export const ArbitrumSepolia = {
|
|
13
|
+
name: 'Arbitrum Sepolia',
|
|
14
|
+
rpc: 'https://nodes.sequence.app/arbitrum-sepolia',
|
|
15
|
+
chainId: 421614n,
|
|
16
|
+
explorer: 'https://sepolia.arbiscan.io/',
|
|
17
|
+
nativeCurrency: {
|
|
18
|
+
name: 'Ether',
|
|
19
|
+
symbol: 'ETH',
|
|
20
|
+
decimals: 18,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const All = [Arbitrum, ArbitrumSepolia];
|
|
24
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,QAAQ,GAAY;IAC/B,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,qCAAqC;IAC1C,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,sBAAsB;IAChC,cAAc,EAAE;QACd,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE;KACb;CACF,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAY;IACtC,IAAI,EAAE,kBAAkB;IACxB,GAAG,EAAE,6CAA6C;IAClD,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,8BAA8B;IACxC,cAAc,EAAE;QACd,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE;KACb;CACF,CAAA;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA"}
|