@sig-net/midnight 0.0.5 → 0.0.7
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 +8 -0
- package/dist/constants.d.ts +4 -16
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -16
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +79 -0
- package/dist/ecdsa-attestation.d.ts.map +1 -0
- package/dist/ecdsa-attestation.js +140 -0
- package/dist/ecdsa-attestation.js.map +1 -0
- package/dist/epsilon-derivation.d.ts +60 -0
- package/dist/epsilon-derivation.d.ts.map +1 -1
- package/dist/epsilon-derivation.js +106 -5
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +70 -95
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +38 -42
- package/dist/managed/contract/index.js +225 -478
- package/dist/managed/contract/index.js.map +2 -2
- package/dist/signature-requests-state-reader.d.ts +14 -13
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +31 -20
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +5 -5
- package/dist/signature-response-verification.d.ts.map +1 -1
- package/dist/signature-response-verification.js +4 -4
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-state-reader.d.ts +102 -109
- package/dist/signet-contract-state-reader.d.ts.map +1 -1
- package/dist/signet-contract-state-reader.js +125 -119
- package/dist/signet-contract-state-reader.js.map +1 -1
- package/dist/signet-request-feed.d.ts +4 -3
- package/dist/signet-request-feed.d.ts.map +1 -1
- package/dist/signet-request-feed.js +9 -8
- package/dist/signet-request-feed.js.map +1 -1
- package/dist/signet-request-resolver.d.ts +6 -4
- package/dist/signet-request-resolver.d.ts.map +1 -1
- package/dist/signet-request-resolver.js +8 -6
- package/dist/signet-request-resolver.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +21 -20
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +35 -23
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +93 -59
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +84 -67
- package/dist/signet-requests.js.map +1 -1
- package/package.json +2 -2
- package/src/Signet.compact +275 -413
- package/src/circuits.compact +24 -25
- package/dist/schnorr.d.ts +0 -100
- package/dist/schnorr.d.ts.map +0 -1
- package/dist/schnorr.js +0 -144
- package/dist/schnorr.js.map +0 -1
- package/src/Schnorr.compact +0 -63
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-contract-state-reader.d.ts","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signet-contract-state-reader.d.ts","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,eAAO,MAAM,uDAAuD,IAAI,CAAC;AAEzE,sEAAsE;AACtE,eAAO,MAAM,+CAA+C,IAAI,CAAC;AAEjE,oFAAoF;AACpF,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,uFAAuF;AACvF,eAAO,MAAM,uCAAuC,IAAI,CAAC;AAEzD,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAgBjD;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACt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CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,mCAAmC,GAC1C,6BAA6B,CAoB/B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kCAAkC,GAAG,GAAG,CAClD,YAAY,EACZ,mCAAmC,CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzE;AA2CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,+CAA+C,CAC7D,GAAG,EAAE,gBAAgB,GACpB,kCAAkC,CAyBpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,4CAA4C,EAAE,kBAAkB,CAAC;IACjE;;;OAGG;IACH,qCAAqC,EAAE,kCAAkC,CAAC;IAC1E,sEAAsE;IACtE,2BAA2B,EAAE,kBAAkB,CAAC;IAChD,uFAAuF;IACvF,oBAAoB,EAAE,sBAAsB,CAAC;IAC7C,yEAAyE;IACzE,8BAA8B,EAAE,kBAAkB,CAAC;IACnD,0FAA0F;IAC1F,uBAAuB,EAAE,yBAAyB,CAAC;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,gBAAgB,GACpB,oBAAoB,CA2BtB"}
|
|
@@ -2,41 +2,48 @@
|
|
|
2
2
|
// its ledger fields out of a contract's raw state WITHOUT the compiled
|
|
3
3
|
// contract, the mirror image of signature-requests-state-reader.ts. A poller
|
|
4
4
|
// has only the contract address, queries raw state from the indexer
|
|
5
|
-
// (queryContractState(address).data), and decodes by the signet contract
|
|
6
|
-
// layout
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// (
|
|
11
|
-
//
|
|
12
|
-
|
|
5
|
+
// (queryContractState(address).data), and decodes by the signet contract's
|
|
6
|
+
// declaration-order layout:
|
|
7
|
+
// field 0: signBidirectionalEventNotificationCounterMap (Map<RequestId, Counter>)
|
|
8
|
+
// field 1: signBidirectionalEventNotificationMap (Map<SignetMapKey, Notification>)
|
|
9
|
+
// field 2: signatureResponseCounterMap (Map<RequestId, Counter>)
|
|
10
|
+
// field 3: signatureResponseMap (Map<SignetMapKey, SignatureRespondedEvent>)
|
|
11
|
+
// field 4: respondBidirectionalCounterMap (Map<RequestId, Counter>)
|
|
12
|
+
// field 5: respondBidirectionalMap (Map<SignetMapKey, RespondBidirectionalEvent>)
|
|
13
|
+
// Every store is an unauthenticated append-only log keyed by
|
|
14
|
+
// (requestId, count); verification is the reader's job. The generic
|
|
15
|
+
// state-tree walk (RawContractState, signetFieldNode) and the shared base
|
|
16
|
+
// descriptors live in signature-state-reading.ts.
|
|
17
|
+
import { CompactTypeBytes, CompactTypeUnsignedInteger, } from "@midnight-ntwrk/compact-runtime";
|
|
13
18
|
import { bytesToHex, requestIdHex, } from "./signet-requests.js";
|
|
14
19
|
import { requestIdType, signetFieldNode, u64, } from "./signature-state-reading.js";
|
|
15
|
-
/** Signet contract layout: the
|
|
16
|
-
export const
|
|
17
|
-
/** Signet contract layout: the
|
|
18
|
-
export const
|
|
19
|
-
/** Signet contract layout: the
|
|
20
|
-
export const
|
|
21
|
-
/** Signet contract layout: the
|
|
22
|
-
export const
|
|
23
|
-
/** Signet contract layout: the
|
|
24
|
-
export const
|
|
20
|
+
/** Signet contract layout: the notification counter map is ledger field 0. */
|
|
21
|
+
export const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_COUNTER_MAP_FIELD = 0;
|
|
22
|
+
/** Signet contract layout: the notification map is ledger field 1. */
|
|
23
|
+
export const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD = 1;
|
|
24
|
+
/** Signet contract layout: the signature response counter map is ledger field 2. */
|
|
25
|
+
export const SIGNATURE_RESPONSE_COUNTER_MAP_FIELD = 2;
|
|
26
|
+
/** Signet contract layout: the signature response map is ledger field 3. */
|
|
27
|
+
export const SIGNATURE_RESPONSE_MAP_FIELD = 3;
|
|
28
|
+
/** Signet contract layout: the respond-bidirectional counter map is ledger field 4. */
|
|
29
|
+
export const RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD = 4;
|
|
30
|
+
/** Signet contract layout: the respond-bidirectional map is ledger field 5. */
|
|
31
|
+
export const RESPOND_BIDIRECTIONAL_MAP_FIELD = 5;
|
|
25
32
|
// ---- Type descriptors (must mirror Signet.compact field-for-field) ----
|
|
26
33
|
// As in the requests reader, fromValue consumes the aligned value
|
|
27
34
|
// sequentially, so field order and width here must match the Compact structs
|
|
28
35
|
// exactly — a mismatch is silent data corruption, not an error.
|
|
29
|
-
/** Descriptor for a
|
|
36
|
+
/** Descriptor for a 32-byte scalar / hash (`Bytes<32>`). */
|
|
30
37
|
const bytes32 = new CompactTypeBytes(32);
|
|
31
|
-
/** Descriptor for the
|
|
38
|
+
/** Descriptor for the response's serialized output (`Bytes<128>`). */
|
|
32
39
|
const bytes128 = new CompactTypeBytes(128);
|
|
33
40
|
/** Descriptor for a Compact `Uint<8>` (1-byte unsigned integer). */
|
|
34
41
|
const u8 = new CompactTypeUnsignedInteger(255n, 1);
|
|
35
42
|
/**
|
|
36
|
-
* Hand-composed descriptor for {@link
|
|
43
|
+
* Hand-composed descriptor for {@link SignatureRespondedEvent}. Field
|
|
37
44
|
* order (bigRx, bigRy, s, recoveryId) must match the Compact struct.
|
|
38
45
|
*/
|
|
39
|
-
export const
|
|
46
|
+
export const signatureRespondedEventType = {
|
|
40
47
|
/** @returns Compound alignment of the struct's fields in declaration order. */
|
|
41
48
|
alignment() {
|
|
42
49
|
return bytes32
|
|
@@ -75,11 +82,11 @@ export const signatureResponseType = {
|
|
|
75
82
|
},
|
|
76
83
|
};
|
|
77
84
|
/**
|
|
78
|
-
* Hand-composed descriptor for {@link
|
|
79
|
-
* the
|
|
80
|
-
* the Compact struct.
|
|
85
|
+
* Hand-composed descriptor for {@link SignetMapKey} — the map key of every
|
|
86
|
+
* posted-entry map in the signet contract. Field order (count, then
|
|
87
|
+
* requestId) must match the Compact struct.
|
|
81
88
|
*/
|
|
82
|
-
export const
|
|
89
|
+
export const signetMapKeyType = {
|
|
83
90
|
/** @returns Compound alignment of the struct's fields in declaration order. */
|
|
84
91
|
alignment() {
|
|
85
92
|
return u64.alignment().concat(requestIdType.alignment());
|
|
@@ -107,22 +114,22 @@ export const signetResponseKeyType = {
|
|
|
107
114
|
},
|
|
108
115
|
};
|
|
109
116
|
/**
|
|
110
|
-
* Hand-composed descriptor for {@link
|
|
111
|
-
* order (serializedOutput, outputLen,
|
|
112
|
-
*
|
|
117
|
+
* Hand-composed descriptor for {@link RespondBidirectionalEvent}. Field
|
|
118
|
+
* order (serializedOutput, outputLen, r, s, recoveryId) must match the
|
|
119
|
+
* Compact struct.
|
|
113
120
|
*/
|
|
114
|
-
export const
|
|
121
|
+
export const respondBidirectionalEventType = {
|
|
115
122
|
/** @returns Compound alignment of the struct's fields in declaration order. */
|
|
116
123
|
alignment() {
|
|
117
124
|
return bytes128
|
|
118
125
|
.alignment()
|
|
119
126
|
.concat(u8.alignment())
|
|
120
|
-
.concat(
|
|
121
|
-
.concat(
|
|
122
|
-
.concat(
|
|
127
|
+
.concat(bytes32.alignment())
|
|
128
|
+
.concat(bytes32.alignment())
|
|
129
|
+
.concat(u8.alignment());
|
|
123
130
|
},
|
|
124
131
|
/**
|
|
125
|
-
* Decode one
|
|
132
|
+
* Decode one response record from an aligned value, consuming it field
|
|
126
133
|
* by field.
|
|
127
134
|
*
|
|
128
135
|
* @param value - Mutable aligned value cursor; pass a copy.
|
|
@@ -132,13 +139,13 @@ export const respondBidirectionalType = {
|
|
|
132
139
|
return {
|
|
133
140
|
serializedOutput: bytes128.fromValue(value),
|
|
134
141
|
outputLen: u8.fromValue(value),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
r: bytes32.fromValue(value),
|
|
143
|
+
s: bytes32.fromValue(value),
|
|
144
|
+
recoveryId: u8.fromValue(value),
|
|
138
145
|
};
|
|
139
146
|
},
|
|
140
147
|
/**
|
|
141
|
-
* Encode
|
|
148
|
+
* Encode a response record into its aligned on-ledger representation.
|
|
142
149
|
*
|
|
143
150
|
* @param record - The record to encode.
|
|
144
151
|
* @returns The aligned value, fields concatenated in declaration order.
|
|
@@ -147,13 +154,13 @@ export const respondBidirectionalType = {
|
|
|
147
154
|
return bytes128
|
|
148
155
|
.toValue(record.serializedOutput)
|
|
149
156
|
.concat(u8.toValue(record.outputLen))
|
|
150
|
-
.concat(
|
|
151
|
-
.concat(
|
|
152
|
-
.concat(
|
|
157
|
+
.concat(bytes32.toValue(record.r))
|
|
158
|
+
.concat(bytes32.toValue(record.s))
|
|
159
|
+
.concat(u8.toValue(record.recoveryId));
|
|
153
160
|
},
|
|
154
161
|
};
|
|
155
|
-
/** Descriptor for the notification's packed V1 payload (`Bytes<
|
|
156
|
-
const
|
|
162
|
+
/** Descriptor for the notification's packed V1 payload (`Bytes<128>`). */
|
|
163
|
+
const bytes128Payload = new CompactTypeBytes(128);
|
|
157
164
|
/**
|
|
158
165
|
* Hand-composed descriptor for {@link SignBidirectionalNotificationRecord}.
|
|
159
166
|
* Field order (version, payload) must match the Compact struct.
|
|
@@ -161,7 +168,7 @@ const bytes65 = new CompactTypeBytes(65);
|
|
|
161
168
|
export const signBidirectionalNotificationType = {
|
|
162
169
|
/** @returns Compound alignment of the struct's fields in declaration order. */
|
|
163
170
|
alignment() {
|
|
164
|
-
return u8.alignment().concat(
|
|
171
|
+
return u8.alignment().concat(bytes128Payload.alignment());
|
|
165
172
|
},
|
|
166
173
|
/**
|
|
167
174
|
* Decode one notification record from an aligned value, consuming it
|
|
@@ -173,7 +180,7 @@ export const signBidirectionalNotificationType = {
|
|
|
173
180
|
fromValue(value) {
|
|
174
181
|
return {
|
|
175
182
|
version: u8.fromValue(value),
|
|
176
|
-
payload:
|
|
183
|
+
payload: bytes128Payload.fromValue(value),
|
|
177
184
|
};
|
|
178
185
|
},
|
|
179
186
|
/**
|
|
@@ -183,23 +190,24 @@ export const signBidirectionalNotificationType = {
|
|
|
183
190
|
* @returns The aligned value, fields concatenated in declaration order.
|
|
184
191
|
*/
|
|
185
192
|
toValue(record) {
|
|
186
|
-
return u8
|
|
193
|
+
return u8
|
|
194
|
+
.toValue(record.version)
|
|
195
|
+
.concat(bytes128Payload.toValue(record.payload));
|
|
187
196
|
},
|
|
188
197
|
};
|
|
189
198
|
/** Offset of the V1 `callerAddress` in the packed payload (`Bytes<32>` at the front). */
|
|
190
199
|
const NOTIFICATION_CALLER_ADDRESS_OFFSET = 0;
|
|
191
|
-
/** Offset of the V1 `
|
|
192
|
-
const
|
|
193
|
-
/** Offset of the V1 `requestsIndexField` (after callerAddress + requestId). */
|
|
194
|
-
const NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET = 64;
|
|
200
|
+
/** Offset of the V1 `requestsIndexField` (after the 32 callerAddress bytes). */
|
|
201
|
+
const NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET = 32;
|
|
195
202
|
/** The only payload interpretation {@link decodeSignBidirectionalNotification} understands today. */
|
|
196
203
|
const SUPPORTED_NOTIFICATION_VERSION = 1n;
|
|
197
204
|
/**
|
|
198
205
|
* Unpack a stored {@link SignBidirectionalNotificationRecord}'s payload by
|
|
199
206
|
* the fixed V1 offsets — the decode twin of the compiled
|
|
200
|
-
* `
|
|
201
|
-
* pack↔decode lockstep is pinned by the state-reader unit test that
|
|
202
|
-
* through the real circuit).
|
|
207
|
+
* `constructSignBidirectionalEventNotificationV1` circuit (byte plumbing
|
|
208
|
+
* only; the pack↔decode lockstep is pinned by the state-reader unit test that
|
|
209
|
+
* round-trips through the real circuit). V1 layout:
|
|
210
|
+
* callerAddress (32) ++ requestsIndexField (1) ++ zero padding (95).
|
|
203
211
|
*
|
|
204
212
|
* Fails closed on an unrecognised `version`: a future payload layout adds a
|
|
205
213
|
* branch here rather than silently misinterpreting bytes under the V1 offsets.
|
|
@@ -210,64 +218,104 @@ const SUPPORTED_NOTIFICATION_VERSION = 1n;
|
|
|
210
218
|
*/
|
|
211
219
|
export function decodeSignBidirectionalNotification(record) {
|
|
212
220
|
if (record.version !== SUPPORTED_NOTIFICATION_VERSION) {
|
|
213
|
-
throw new Error(`
|
|
221
|
+
throw new Error(`SignBidirectionalEventNotification version ${record.version} is not supported ` +
|
|
214
222
|
`(this decoder understands version ${SUPPORTED_NOTIFICATION_VERSION})`);
|
|
215
223
|
}
|
|
216
|
-
const callerAddress = bytesToHex(record.payload.slice(NOTIFICATION_CALLER_ADDRESS_OFFSET,
|
|
217
|
-
const requestId = requestIdHex(record.payload.slice(NOTIFICATION_REQUEST_ID_OFFSET, NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET));
|
|
224
|
+
const callerAddress = bytesToHex(record.payload.slice(NOTIFICATION_CALLER_ADDRESS_OFFSET, NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET));
|
|
218
225
|
const requestsIndexField = record.payload[NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET];
|
|
219
226
|
return {
|
|
220
227
|
version: Number(record.version),
|
|
221
228
|
callerAddress,
|
|
222
|
-
requestId,
|
|
223
229
|
requestsIndexField,
|
|
224
230
|
};
|
|
225
231
|
}
|
|
226
232
|
/**
|
|
227
|
-
* Build the
|
|
228
|
-
*
|
|
233
|
+
* Build the flattened JS map key for a `(requestId, count)` pair — the
|
|
234
|
+
* composite Compact {@link SignetMapKey} as a string so it works as a JS
|
|
229
235
|
* `Map` key.
|
|
230
236
|
*
|
|
231
|
-
* @param id - The request id the
|
|
237
|
+
* @param id - The request id the entry belongs to, in canonical hex form.
|
|
232
238
|
* @param count - 0-based post count within that request.
|
|
233
239
|
* @returns `"<hexRequestId>:<count>"`.
|
|
234
240
|
*/
|
|
235
|
-
export function
|
|
241
|
+
export function signetMapEntryKey(id, count) {
|
|
236
242
|
return `${id}:${count}`;
|
|
237
243
|
}
|
|
244
|
+
/** Decode a `Map<RequestId, Counter>` ledger field into a {@link SignetCounterIndex}. */
|
|
245
|
+
function readCounterMap(raw, field) {
|
|
246
|
+
const counterMap = signetFieldNode(raw, field).asMap();
|
|
247
|
+
if (counterMap === undefined) {
|
|
248
|
+
throw new Error(`Ledger field ${field} is not a Map`);
|
|
249
|
+
}
|
|
250
|
+
const index = new Map();
|
|
251
|
+
for (const key of counterMap.keys()) {
|
|
252
|
+
// fromValue consumes its input, so hand each descriptor a copy.
|
|
253
|
+
const requestId = requestIdType.fromValue([...key.value]);
|
|
254
|
+
// A Counter is stored as a plain u64 cell.
|
|
255
|
+
const cell = counterMap.get(key)?.asCell();
|
|
256
|
+
if (cell === undefined)
|
|
257
|
+
continue;
|
|
258
|
+
index.set(requestIdHex(requestId), u64.fromValue([...cell.value]));
|
|
259
|
+
}
|
|
260
|
+
return index;
|
|
261
|
+
}
|
|
262
|
+
/** Decode a `Map<SignetMapKey, T>` ledger field into a string-keyed JS map. */
|
|
263
|
+
function readSignetKeyedMap(raw, field, valueType) {
|
|
264
|
+
const map = signetFieldNode(raw, field).asMap();
|
|
265
|
+
if (map === undefined) {
|
|
266
|
+
throw new Error(`Ledger field ${field} is not a Map`);
|
|
267
|
+
}
|
|
268
|
+
const index = new Map();
|
|
269
|
+
for (const key of map.keys()) {
|
|
270
|
+
const mapKey = signetMapKeyType.fromValue([...key.value]);
|
|
271
|
+
const cell = map.get(key)?.asCell();
|
|
272
|
+
if (cell === undefined)
|
|
273
|
+
continue;
|
|
274
|
+
index.set(signetMapEntryKey(requestIdHex(mapKey.requestId), mapKey.count), valueType.fromValue([...cell.value]));
|
|
275
|
+
}
|
|
276
|
+
return index;
|
|
277
|
+
}
|
|
238
278
|
/**
|
|
239
279
|
* Read ONLY the notification registry (ledger field
|
|
240
|
-
* {@link
|
|
280
|
+
* {@link SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD}) out of raw signet
|
|
241
281
|
* contract state — the poll-loop primitive of {@link SignetRequestFeed},
|
|
242
|
-
* which cycles frequently and has no use for the response fields.
|
|
282
|
+
* which cycles frequently and has no use for the response fields. One record
|
|
283
|
+
* per request id (the count-0 post; see
|
|
284
|
+
* {@link SignBidirectionalNotificationIndex}).
|
|
243
285
|
*
|
|
244
286
|
* @param raw - Raw contract state, e.g. `queryContractState(address).data`
|
|
245
287
|
* from the indexer or `ctx.currentQueryContext.state` from the simulator.
|
|
246
|
-
* @returns The registry, keyed by the hex request id each
|
|
247
|
-
* registered under.
|
|
288
|
+
* @returns The registry, keyed by the hex request id of each entry's map key.
|
|
248
289
|
* @throws Error if the field is missing or is not a Map.
|
|
249
290
|
*/
|
|
250
291
|
export function readSignBidirectionalNotificationIndexFromState(raw) {
|
|
251
|
-
const notificationMap = signetFieldNode(raw,
|
|
292
|
+
const notificationMap = signetFieldNode(raw, SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD).asMap();
|
|
252
293
|
if (notificationMap === undefined) {
|
|
253
|
-
throw new Error(`Ledger field ${
|
|
294
|
+
throw new Error(`Ledger field ${SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD} is not a Map`);
|
|
254
295
|
}
|
|
255
296
|
const index = new Map();
|
|
297
|
+
const counts = new Map();
|
|
256
298
|
for (const key of notificationMap.keys()) {
|
|
257
299
|
// fromValue consumes its input, so hand each descriptor a copy.
|
|
258
|
-
const
|
|
300
|
+
const mapKey = signetMapKeyType.fromValue([...key.value]);
|
|
259
301
|
const cell = notificationMap.get(key)?.asCell();
|
|
260
302
|
if (cell === undefined)
|
|
261
303
|
continue;
|
|
262
|
-
|
|
304
|
+
const id = requestIdHex(mapKey.requestId);
|
|
305
|
+
const seen = counts.get(id);
|
|
306
|
+
// Keep the FIRST post (lowest count) per request id.
|
|
307
|
+
if (seen !== undefined && seen <= mapKey.count)
|
|
308
|
+
continue;
|
|
309
|
+
counts.set(id, mapKey.count);
|
|
310
|
+
index.set(id, signBidirectionalNotificationType.fromValue([...cell.value]));
|
|
263
311
|
}
|
|
264
312
|
return index;
|
|
265
313
|
}
|
|
266
314
|
/**
|
|
267
315
|
* MPC-/client-style read: parse the signet contract's ledger fields out of
|
|
268
316
|
* raw contract state by field position alone — no compiled contract, no
|
|
269
|
-
* generated `ledger()`, only the
|
|
270
|
-
*
|
|
317
|
+
* generated `ledger()`, only the declaration-order layout and the canonical
|
|
318
|
+
* descriptors above.
|
|
271
319
|
*
|
|
272
320
|
* @param raw - Raw contract state, e.g. `queryContractState(address).data`
|
|
273
321
|
* from the indexer or `ctx.currentQueryContext.state` from the simulator.
|
|
@@ -275,55 +323,13 @@ export function readSignBidirectionalNotificationIndexFromState(raw) {
|
|
|
275
323
|
* @throws Error if a field is missing or has the wrong state-value shape.
|
|
276
324
|
*/
|
|
277
325
|
export function readSignetContractLedgerFromState(raw) {
|
|
278
|
-
const counterMap = signetFieldNode(raw, SIGNATURE_RESPONSE_COUNTER_INDEX_FIELD).asMap();
|
|
279
|
-
if (counterMap === undefined) {
|
|
280
|
-
throw new Error(`Ledger field ${SIGNATURE_RESPONSE_COUNTER_INDEX_FIELD} is not a Map`);
|
|
281
|
-
}
|
|
282
|
-
const signatureResponseCounterIndex = new Map();
|
|
283
|
-
for (const key of counterMap.keys()) {
|
|
284
|
-
// fromValue consumes its input, so hand each descriptor a copy.
|
|
285
|
-
const requestId = requestIdType.fromValue([...key.value]);
|
|
286
|
-
// A Counter is stored as a plain u64 cell.
|
|
287
|
-
const cell = counterMap.get(key)?.asCell();
|
|
288
|
-
if (cell === undefined)
|
|
289
|
-
continue;
|
|
290
|
-
signatureResponseCounterIndex.set(requestIdHex(requestId), u64.fromValue([...cell.value]));
|
|
291
|
-
}
|
|
292
|
-
const responseMap = signetFieldNode(raw, SIGNATURE_RESPONSE_INDEX_FIELD).asMap();
|
|
293
|
-
if (responseMap === undefined) {
|
|
294
|
-
throw new Error(`Ledger field ${SIGNATURE_RESPONSE_INDEX_FIELD} is not a Map`);
|
|
295
|
-
}
|
|
296
|
-
const signatureResponseIndex = new Map();
|
|
297
|
-
for (const key of responseMap.keys()) {
|
|
298
|
-
const responseKey = signetResponseKeyType.fromValue([...key.value]);
|
|
299
|
-
const cell = responseMap.get(key)?.asCell();
|
|
300
|
-
if (cell === undefined)
|
|
301
|
-
continue;
|
|
302
|
-
signatureResponseIndex.set(signetResponseIndexKey(requestIdHex(responseKey.requestId), responseKey.count), signatureResponseType.fromValue([...cell.value]));
|
|
303
|
-
}
|
|
304
|
-
const respondBidirectionalMap = signetFieldNode(raw, RESPOND_BIDIRECTIONAL_INDEX_FIELD).asMap();
|
|
305
|
-
if (respondBidirectionalMap === undefined) {
|
|
306
|
-
throw new Error(`Ledger field ${RESPOND_BIDIRECTIONAL_INDEX_FIELD} is not a Map`);
|
|
307
|
-
}
|
|
308
|
-
const respondBidirectionalIndex = new Map();
|
|
309
|
-
for (const key of respondBidirectionalMap.keys()) {
|
|
310
|
-
const requestId = requestIdType.fromValue([...key.value]);
|
|
311
|
-
const cell = respondBidirectionalMap.get(key)?.asCell();
|
|
312
|
-
if (cell === undefined)
|
|
313
|
-
continue;
|
|
314
|
-
respondBidirectionalIndex.set(requestIdHex(requestId), respondBidirectionalType.fromValue([...cell.value]));
|
|
315
|
-
}
|
|
316
|
-
const hashCell = signetFieldNode(raw, MPC_PUB_KEY_HASH_FIELD).asCell();
|
|
317
|
-
if (hashCell === undefined) {
|
|
318
|
-
throw new Error(`Ledger field ${MPC_PUB_KEY_HASH_FIELD} is not a Cell`);
|
|
319
|
-
}
|
|
320
|
-
const mpcPubKeyHash = bytes32.fromValue([...hashCell.value]);
|
|
321
326
|
return {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
signBidirectionalEventNotificationCounterMap: readCounterMap(raw, SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_COUNTER_MAP_FIELD),
|
|
328
|
+
signBidirectionalEventNotificationMap: readSignBidirectionalNotificationIndexFromState(raw),
|
|
329
|
+
signatureResponseCounterMap: readCounterMap(raw, SIGNATURE_RESPONSE_COUNTER_MAP_FIELD),
|
|
330
|
+
signatureResponseMap: readSignetKeyedMap(raw, SIGNATURE_RESPONSE_MAP_FIELD, signatureRespondedEventType),
|
|
331
|
+
respondBidirectionalCounterMap: readCounterMap(raw, RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD),
|
|
332
|
+
respondBidirectionalMap: readSignetKeyedMap(raw, RESPOND_BIDIRECTIONAL_MAP_FIELD, respondBidirectionalEventType),
|
|
327
333
|
};
|
|
328
334
|
}
|
|
329
335
|
//# sourceMappingURL=signet-contract-state-reader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-contract-state-reader.js","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,oEAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"signet-contract-state-reader.js","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,oEAAoE;AACpE,2EAA2E;AAC3E,4BAA4B;AAC5B,oFAAoF;AACpF,qFAAqF;AACrF,mEAAmE;AACnE,+EAA+E;AAC/E,sEAAsE;AACtE,oFAAoF;AACpF,6DAA6D;AAC7D,oEAAoE;AACpE,0EAA0E;AAC1E,kDAAkD;AAElD,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAE3B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL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AqD;QACrD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,IAAI,MAAM,CAAC,KAAK;YAAE,SAAS;QACzD,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,iCAAiC,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AA2BD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iCAAiC,CAC/C,GAAqB;IAErB,OAAO;QACL,4CAA4C,EAAE,cAAc,CAC1D,GAAG,EACH,uDAAuD,CACxD;QACD,qCAAqC,EACnC,+CAA+C,CAAC,GAAG,CAAC;QACtD,2BAA2B,EAAE,cAAc,CACzC,GAAG,EACH,oCAAoC,CACrC;QACD,oBAAoB,EAAE,kBAAkB,CACtC,GAAG,EACH,4BAA4B,EAC5B,2BAA2B,CAC5B;QACD,8BAA8B,EAAE,cAAc,CAC5C,GAAG,EACH,uCAAuC,CACxC;QACD,uBAAuB,EAAE,kBAAkB,CACzC,GAAG,EACH,+BAA+B,EAC/B,6BAA6B,CAC9B;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -64,9 +64,10 @@ export declare class SignetRequestFeed {
|
|
|
64
64
|
* indexed yet is retried next cycle; undecodable or unsupported-version
|
|
65
65
|
* records are likewise skipped (and logged) without being marked.
|
|
66
66
|
*
|
|
67
|
-
* Dedupe and resolution key off the
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* Dedupe and resolution key off the request id of the registry entry's map
|
|
68
|
+
* key (the V1 payload no longer carries one). The key is caller-supplied,
|
|
69
|
+
* so it confers no authority — the resolver's membership check against the
|
|
70
|
+
* named caller's own ledger is what authenticates it.
|
|
70
71
|
*
|
|
71
72
|
* @returns The newly-authenticated requests this cycle.
|
|
72
73
|
* @throws Error if the signet contract has no readable state at the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-feed.d.ts","sourceRoot":"","sources":["../src/signet-request-feed.ts"],"names":[],"mappings":"AAkBA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzE,6EAA6E;AAC7E,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC,kFAAkF;IAClF,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,0GAA0G;IAC1G,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAaf;AAOD;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IAIxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IAEnD;;;OAGG;gBACS,MAAM,EAAE,uBAAuB;IAW3C,qFAAqF;IACrF,OAAO,CAAC,OAAO;IAOf
|
|
1
|
+
{"version":3,"file":"signet-request-feed.d.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;IACH,MAAM,CAAC,SAAS,EAAE,YAAY,GAAG,IAAI;IAIrC;;;;;;;;OAQG;IACI,QAAQ,CAAC,IAAI,CAAC,EAAE;QACrB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,qBAAqB,CAAC,qBAAqB,CAAC;CAQjD"}
|
|
@@ -90,9 +90,10 @@ export class SignetRequestFeed {
|
|
|
90
90
|
* indexed yet is retried next cycle; undecodable or unsupported-version
|
|
91
91
|
* records are likewise skipped (and logged) without being marked.
|
|
92
92
|
*
|
|
93
|
-
* Dedupe and resolution key off the
|
|
94
|
-
*
|
|
95
|
-
*
|
|
93
|
+
* Dedupe and resolution key off the request id of the registry entry's map
|
|
94
|
+
* key (the V1 payload no longer carries one). The key is caller-supplied,
|
|
95
|
+
* so it confers no authority — the resolver's membership check against the
|
|
96
|
+
* named caller's own ledger is what authenticates it.
|
|
96
97
|
*
|
|
97
98
|
* @returns The newly-authenticated requests this cycle.
|
|
98
99
|
* @throws Error if the signet contract has no readable state at the
|
|
@@ -106,24 +107,24 @@ export class SignetRequestFeed {
|
|
|
106
107
|
}
|
|
107
108
|
const registry = readSignBidirectionalNotificationIndexFromState(state.data);
|
|
108
109
|
const out = [];
|
|
109
|
-
for (const [
|
|
110
|
+
for (const [requestId, record] of [...registry.entries()].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {
|
|
110
111
|
let notification;
|
|
111
112
|
try {
|
|
112
113
|
notification = decodeSignBidirectionalNotification(record);
|
|
113
114
|
}
|
|
114
115
|
catch (error) {
|
|
115
116
|
console.warn(`SignetRequestFeed: skipping undecodable notification ` +
|
|
116
|
-
`registered under ${
|
|
117
|
+
`registered under ${requestId}: ${String(error)}`);
|
|
117
118
|
continue;
|
|
118
119
|
}
|
|
119
|
-
if (this.yielded.has(
|
|
120
|
+
if (this.yielded.has(requestId))
|
|
120
121
|
continue;
|
|
121
122
|
if (!this.allowed(notification.callerAddress))
|
|
122
123
|
continue;
|
|
123
|
-
const resolved = await this.resolver.resolve(notification);
|
|
124
|
+
const resolved = await this.resolver.resolve(requestId, notification);
|
|
124
125
|
if (resolved === undefined)
|
|
125
126
|
continue;
|
|
126
|
-
this.yielded.add(
|
|
127
|
+
this.yielded.add(requestId);
|
|
127
128
|
out.push(resolved);
|
|
128
129
|
}
|
|
129
130
|
return out;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-feed.js","sourceRoot":"","sources":["../src/signet-request-feed.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,2EAA2E;AAC3E,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,wEAAwE;AACxE,yDAAyD;AACzD,yCAAyC;AAEzC,OAAO,EACL,mCAAmC,EACnC,+CAA+C,GAChD,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,qBAAqB,GAEtB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAqB,MAAM,sBAAsB,CAAC;AAEzE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAsBlD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,EAAU,EACV,MAAoB;IAEpB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,MAAM,EAAE,OAAO;YAAE,OAAO,OAAO,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,MAAM,E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;;;;;;OAQG;IACH,KAAK,CAAC,CAAC,QAAQ,CAAC,IAEf;QACC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAChC,KAAK,MAAM,QAAQ,IAAI,KAAK;gBAAE,MAAM,QAAQ,CAAC;YAC7C,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO;gBAAE,MAAM;YACjC,MAAM,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SignBidirectionalNotification } from "./signet-contract-state-reader.ts";
|
|
2
2
|
import type { SignetPublicStateSource } from "./signet-request-response-reader.ts";
|
|
3
|
-
import type { RequestIdHex,
|
|
3
|
+
import type { RequestIdHex, SignBidirectionalEvent } from "./signet-requests.ts";
|
|
4
4
|
/**
|
|
5
5
|
* A {@link SignBidirectionalNotification} resolved to the authenticated
|
|
6
6
|
* request it refers to: the request record read from `callerAddress`'s own
|
|
@@ -16,7 +16,7 @@ export interface ResolvedSignetRequest {
|
|
|
16
16
|
/** The request id, confirmed to be a member of `callerAddress`'s index. */
|
|
17
17
|
requestId: RequestIdHex;
|
|
18
18
|
/** The authenticated request record to sign. */
|
|
19
|
-
request:
|
|
19
|
+
request: SignBidirectionalEvent;
|
|
20
20
|
}
|
|
21
21
|
/** Everything a {@link SignetRequestResolver} needs. */
|
|
22
22
|
export interface SignetRequestResolverConfig {
|
|
@@ -46,13 +46,15 @@ export declare class SignetRequestResolver {
|
|
|
46
46
|
/**
|
|
47
47
|
* Resolve a notification to its authenticated request, or `undefined` when it
|
|
48
48
|
* cannot be trusted: the caller contract has no state, or `requestId` is not
|
|
49
|
-
* a member of the
|
|
49
|
+
* a member of the map at `requestsIndexField` (forged, stale, wrong field,
|
|
50
50
|
* or not yet indexed — poll again). Never throws on an untrusted
|
|
51
51
|
* notification; a bad one is dropped, not surfaced as an error.
|
|
52
52
|
*
|
|
53
|
+
* @param requestId - The request id the notification was registered under
|
|
54
|
+
* (the registry map key — the V1 payload does not carry one).
|
|
53
55
|
* @param notification - The decoded notification.
|
|
54
56
|
* @returns The authenticated request, or `undefined` to drop the notification.
|
|
55
57
|
*/
|
|
56
|
-
resolve(notification: SignBidirectionalNotification): Promise<ResolvedSignetRequest | undefined>;
|
|
58
|
+
resolve(requestId: RequestIdHex, notification: SignBidirectionalNotification): Promise<ResolvedSignetRequest | undefined>;
|
|
57
59
|
}
|
|
58
60
|
//# sourceMappingURL=signet-request-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-resolver.d.ts","sourceRoot":"","sources":["../src/signet-request-resolver.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EACV,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"signet-request-resolver.d.ts","sourceRoot":"","sources":["../src/signet-request-resolver.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,SAAS,EAAE,YAAY,CAAC;IACxB,gDAAgD;IAChD,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wDAAwD;AACxD,MAAM,WAAW,2BAA2B;IAC1C,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;CAC1C;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAIjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkD;IAEhF;;OAEG;gBACS,MAAM,EAAE,2BAA2B;IAI/C;;;;;;;;;;;OAWG;IACG,OAAO,CACX,SAAS,EAAE,YAAY,EACvB,YAAY,EAAE,6BAA6B,GAC1C,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;CA8B9C"}
|