@sig-net/midnight 0.0.7 → 0.0.9
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/epsilon-derivation.d.ts +25 -25
- package/dist/epsilon-derivation.d.ts.map +1 -1
- package/dist/epsilon-derivation.js +27 -27
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +54 -0
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +8 -0
- package/dist/managed/contract/index.js +250 -35
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +2 -1
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +1 -1
- package/dist/signature-response-verification.d.ts.map +1 -1
- package/dist/signature-response-verification.js +1 -1
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-evtype2tx-requests.d.ts +228 -0
- package/dist/signet-evtype2tx-requests.d.ts.map +1 -0
- package/dist/signet-evtype2tx-requests.js +340 -0
- package/dist/signet-evtype2tx-requests.js.map +1 -0
- package/dist/signet-request-response-reader.d.ts +1 -1
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +1 -1
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +36 -202
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +29 -298
- package/dist/signet-requests.js.map +1 -1
- package/package.json +1 -1
- package/src/Signet.compact +57 -3
- package/src/circuits.compact +4 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { type CompactType } from "@midnight-ntwrk/compact-runtime";
|
|
2
|
+
import { Signature, Transaction } from "ethers";
|
|
3
|
+
import type { SignatureRespondedEvent } from "./signet-contract-state-reader.ts";
|
|
4
|
+
import { type Maybe, type RequestId, type SignBidirectionalEvent } from "./signet-requests.ts";
|
|
5
|
+
/**
|
|
6
|
+
* ABI calldata as a 4-byte selector + 32-byte word slots (Compact:
|
|
7
|
+
* `EVMCalldata<#maxWords>`). Every stored byte is ABI-READY: the calldata the
|
|
8
|
+
* MPC signs is `selector || words[0..noWords]` VERBATIM (see
|
|
9
|
+
* {@link assembleCalldata}), so words are big-endian broadcast-form ABI words,
|
|
10
|
+
* built in-circuit by Signet.compact's `evmAddressAbiWord` / `numericAbiWord`.
|
|
11
|
+
*/
|
|
12
|
+
export interface EVMCalldata {
|
|
13
|
+
/** The literal first 4 calldata bytes (as broadcast). */
|
|
14
|
+
selector: Uint8Array;
|
|
15
|
+
/** How many leading {@link words} are real (Compact `noWords: Uint<16>`). */
|
|
16
|
+
noWords: bigint;
|
|
17
|
+
/**
|
|
18
|
+
* ABI-ready big-endian 32-byte word slots, stored exactly as broadcast;
|
|
19
|
+
* capacity is the contract's `#maxWords` (vault: 2).
|
|
20
|
+
*/
|
|
21
|
+
words: Uint8Array[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One EIP-2930 access-list entry (Compact:
|
|
25
|
+
* `EVMAccessListEntry<#maxStorageKeys>`).
|
|
26
|
+
*/
|
|
27
|
+
export interface EVMAccessListEntry {
|
|
28
|
+
/** The pre-declared contract address, 20 display-order bytes. */
|
|
29
|
+
address: Uint8Array;
|
|
30
|
+
/** How many leading {@link storageKeys} are real. */
|
|
31
|
+
storageKeyCount: bigint;
|
|
32
|
+
/** Raw 32-byte storage keys, copied verbatim into the transaction. */
|
|
33
|
+
storageKeys: Uint8Array[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The EVM transaction to be signed, decomposed into typed fields (Compact:
|
|
37
|
+
* `EVMType2TxParams<#maxCalldataWords, #maxAccessListEntries,
|
|
38
|
+
* #maxStorageKeysPerEntry>`; EIP-1559 — https://eips.ethereum.org/EIPS/eip-1559).
|
|
39
|
+
* Compact `Bytes<N>` fields arrive as N-byte `Uint8Array`s, `Uint<N>` as
|
|
40
|
+
* `bigint`. Vector capacities are each contract's compile-time throttle;
|
|
41
|
+
* the runtime counts say how many leading slots are real.
|
|
42
|
+
*/
|
|
43
|
+
export interface EVMType2TxParams {
|
|
44
|
+
/** Call target (e.g. the ERC20 contract), 20 bytes. */
|
|
45
|
+
to: Uint8Array;
|
|
46
|
+
/** EVM chain id (also expressed in the record's `caip2Id`). */
|
|
47
|
+
chainId: bigint;
|
|
48
|
+
/** Account nonce of the MPC-derived sender address. */
|
|
49
|
+
nonce: bigint;
|
|
50
|
+
/** Gas ceiling for the call. */
|
|
51
|
+
gasLimit: bigint;
|
|
52
|
+
/** Max total fee per gas, wei. */
|
|
53
|
+
maxFeePerGas: bigint;
|
|
54
|
+
/** Max priority fee per gas, wei. */
|
|
55
|
+
maxPriorityFeePerGas: bigint;
|
|
56
|
+
/** ETH sent with the call, wei. */
|
|
57
|
+
value: bigint;
|
|
58
|
+
/** How many leading {@link accessList} entries are real. */
|
|
59
|
+
accessListEntryCount: bigint;
|
|
60
|
+
/** EIP-2930 access list slots (capacity = contract's throttle). */
|
|
61
|
+
accessList: EVMAccessListEntry[];
|
|
62
|
+
/** Call data; `is_some: false` means a plain ETH transfer (`0x` data). */
|
|
63
|
+
calldata: Maybe<EVMCalldata>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Descriptor of {@link EVMCalldata} at one word capacity — the TS analogue
|
|
67
|
+
* of instantiating Compact's `EVMCalldata<#maxWords>`.
|
|
68
|
+
*
|
|
69
|
+
* @param maxWords - The contract's calldata word capacity (the vault uses 2).
|
|
70
|
+
* @returns The calldata descriptor.
|
|
71
|
+
*/
|
|
72
|
+
export declare function evmCalldataDescriptor(maxWords: number): CompactType<EVMCalldata>;
|
|
73
|
+
/**
|
|
74
|
+
* Descriptor of {@link EVMAccessListEntry} at one storage-key capacity
|
|
75
|
+
* (Compact: `EVMAccessListEntry<#maxStorageKeys>`).
|
|
76
|
+
*
|
|
77
|
+
* @param maxStorageKeys - Storage-key capacity per entry.
|
|
78
|
+
* @returns The entry descriptor.
|
|
79
|
+
*/
|
|
80
|
+
export declare function evmAccessListEntryDescriptor(maxStorageKeys: number): CompactType<EVMAccessListEntry>;
|
|
81
|
+
/**
|
|
82
|
+
* Descriptor of {@link EVMType2TxParams} at one capacity instantiation —
|
|
83
|
+
* the TS analogue of Compact's `EVMType2TxParams<#maxCalldataWords,
|
|
84
|
+
* #maxAccessListEntries, #maxStorageKeysPerEntry>`.
|
|
85
|
+
*
|
|
86
|
+
* @param maxCalldataWords - Calldata word capacity.
|
|
87
|
+
* @param maxAccessListEntries - Access-list entry capacity.
|
|
88
|
+
* @param maxStorageKeysPerEntry - Storage-key capacity per entry.
|
|
89
|
+
* @returns The tx-params descriptor.
|
|
90
|
+
*/
|
|
91
|
+
export declare function evmType2TxParamsDescriptor(maxCalldataWords: number, maxAccessListEntries: number, maxStorageKeysPerEntry: number): CompactType<EVMType2TxParams>;
|
|
92
|
+
/**
|
|
93
|
+
* Descriptor of {@link SignBidirectionalEvent} at one EVM Type-2 capacity
|
|
94
|
+
* instantiation — the generic record descriptor
|
|
95
|
+
* (`signBidirectionalEventDescriptorWith`) over
|
|
96
|
+
* {@link evmType2TxParamsDescriptor}.
|
|
97
|
+
*
|
|
98
|
+
* @param maxCalldataWords - Calldata word capacity.
|
|
99
|
+
* @param maxAccessListEntries - Access-list entry capacity.
|
|
100
|
+
* @param maxStorageKeysPerEntry - Storage-key capacity per entry.
|
|
101
|
+
* @param lenOutputDeserialization - Declared byte width of
|
|
102
|
+
* `outputDeserializationSchema` (Compact `#LenOutputDeserialization`).
|
|
103
|
+
* @param lenRespondSerialization - Declared byte width of
|
|
104
|
+
* `respondSerializationSchema` (Compact `#LenRespondSerialization`).
|
|
105
|
+
* @returns The event record descriptor.
|
|
106
|
+
*/
|
|
107
|
+
export declare function signBidirectionalEventDescriptor(maxCalldataWords: number, maxAccessListEntries: number, maxStorageKeysPerEntry: number, lenOutputDeserialization: number, lenRespondSerialization: number): CompactType<SignBidirectionalEvent>;
|
|
108
|
+
/**
|
|
109
|
+
* Canonical id of a signet request: the persistent hash of the entire event
|
|
110
|
+
* record (which commits to every field, the sender address included — there
|
|
111
|
+
* is deliberately no extra domain tag). TS twin of Signet.compact's
|
|
112
|
+
* `calculateRequestId` circuit (see the deviation note in
|
|
113
|
+
* signet-requests.ts), generic over the capacity instantiation via the
|
|
114
|
+
* record's own array lengths — pass the record exactly as the ledger stores
|
|
115
|
+
* it, unused slots included and schemas at their declared widths.
|
|
116
|
+
*
|
|
117
|
+
* @param request - The full event record (contract-shaped, all slots).
|
|
118
|
+
* @returns The 32-byte request id — the record's ledger map key.
|
|
119
|
+
*/
|
|
120
|
+
export declare function calculateRequestId(request: SignBidirectionalEvent): RequestId;
|
|
121
|
+
/**
|
|
122
|
+
* The ABI word for a numeric value (e.g. an ERC20 amount): the value as a
|
|
123
|
+
* 32-byte BIG-ENDIAN integer, exactly as broadcast. TS mirror of
|
|
124
|
+
* Signet.compact's `numericAbiWord` circuit (lockstep-tested against the
|
|
125
|
+
* compiled circuit). Use when building words off-chain (UIs, expected-record
|
|
126
|
+
* builders, tests).
|
|
127
|
+
*
|
|
128
|
+
* @param value - The word's numeric value (e.g. an amount).
|
|
129
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EVMCalldata} word.
|
|
130
|
+
*/
|
|
131
|
+
export declare function numericAbiWord(value: bigint): Uint8Array;
|
|
132
|
+
/**
|
|
133
|
+
* The ABI word for an EVM address: 12 zero bytes, then the 20 display-order
|
|
134
|
+
* address bytes, exactly as broadcast. TS mirror of Signet.compact's
|
|
135
|
+
* `evmAddressAbiWord` circuit (lockstep-tested against the compiled circuit).
|
|
136
|
+
*
|
|
137
|
+
* @param address - The 20-byte address in display order.
|
|
138
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EVMCalldata} word.
|
|
139
|
+
* @throws Error if the address is not exactly 20 bytes.
|
|
140
|
+
*/
|
|
141
|
+
export declare function evmAddressAbiWord(address: Uint8Array): Uint8Array;
|
|
142
|
+
/**
|
|
143
|
+
* Read a numeric ABI word back into a bigint: the big-endian reading of bytes
|
|
144
|
+
* 16..31. TS mirror of Signet.compact's `abiWordToUint128` circuit, including
|
|
145
|
+
* its canonicality check: the leading 16 bytes must be zero, so a word wider
|
|
146
|
+
* than Uint<128> is rejected rather than silently truncated.
|
|
147
|
+
*
|
|
148
|
+
* @param word - The ABI-ready 32-byte word.
|
|
149
|
+
* @returns The word's numeric value.
|
|
150
|
+
* @throws Error if the word is not 32 bytes or its leading half is nonzero.
|
|
151
|
+
*/
|
|
152
|
+
export declare function abiWordToUint128(word: Uint8Array): bigint;
|
|
153
|
+
/**
|
|
154
|
+
* Assemble the raw calldata a request's words describe:
|
|
155
|
+
* `data = selector || words[0..noWords]`, VERBATIM. Words are stored
|
|
156
|
+
* ABI-ready (see {@link EVMCalldata}), so no byte of the stored record is
|
|
157
|
+
* reordered or reinterpreted on the way into the transaction; slots past
|
|
158
|
+
* `noWords` are unused capacity and are dropped. This is THE implementation
|
|
159
|
+
* of the signer-side assembly documented on `EVMCalldata` in Signet.compact.
|
|
160
|
+
*
|
|
161
|
+
* @param calldata - The request's calldata field.
|
|
162
|
+
* @returns Hex calldata for the transaction (`"0x"` when absent).
|
|
163
|
+
*/
|
|
164
|
+
export declare function assembleCalldata(calldata: Maybe<EVMCalldata>): string;
|
|
165
|
+
/**
|
|
166
|
+
* Rebuild the unsigned EIP-1559 transaction a request record describes,
|
|
167
|
+
* byte-identical to the one the MPC assembles and signs: calldata from the
|
|
168
|
+
* tagged words (see {@link assembleCalldata}), the count-trimmed access
|
|
169
|
+
* list, and the stored envelope fields. This is the canonical
|
|
170
|
+
* request→transaction transform; response-side verification
|
|
171
|
+
* (`signature-response-verification.ts`) and the signed-transaction builder
|
|
172
|
+
* below both go through it, so the transaction a client broadcasts is
|
|
173
|
+
* provably the one the MPC put its signature over.
|
|
174
|
+
*
|
|
175
|
+
* @param request - The on-ledger request record.
|
|
176
|
+
* @returns The unsigned ethers transaction (`unsignedHash` is the digest the
|
|
177
|
+
* MPC signs).
|
|
178
|
+
* @throws Error if a calldata word carries an unknown kind.
|
|
179
|
+
*/
|
|
180
|
+
export declare function signBidirectionalEventToUnsignedEVMTransaction(request: SignBidirectionalEvent): Transaction;
|
|
181
|
+
/**
|
|
182
|
+
* Decode a response signature record (as posted to the signet contract's
|
|
183
|
+
* signature response log — the canonical MPC `Signature { big_r, s,
|
|
184
|
+
* recovery_id }` shape) into an ethers {@link Signature}: `r` is `bigR`'s x
|
|
185
|
+
* coordinate, `v` the legacy parity derived from the recovery id.
|
|
186
|
+
*
|
|
187
|
+
* @param response - The posted signature record.
|
|
188
|
+
* @returns The ethers signature.
|
|
189
|
+
* @throws Error if the recovery id is not 0 or 1.
|
|
190
|
+
*/
|
|
191
|
+
export declare function signatureRespondedEventToSignature(response: SignatureRespondedEvent): Signature;
|
|
192
|
+
/**
|
|
193
|
+
* Encode an ECDSA signature as the response record posted to the signet
|
|
194
|
+
* contract — the inverse of {@link signatureRespondedEventToSignature},
|
|
195
|
+
* for MPC-side posters (the fakenet signer, tests). The canonical record
|
|
196
|
+
* carries `bigR` as a full affine point but an `r || s || v` signature only
|
|
197
|
+
* has R.x and the parity of R.y, so R.y is recovered by decompressing the
|
|
198
|
+
* point on the curve (y² = x³ + 7 over the secp256k1 base field).
|
|
199
|
+
*
|
|
200
|
+
* The parameter is structural (the r/s/yParity subset of an ethers
|
|
201
|
+
* {@link Signature}) so signatures from ANY ethers instance qualify — posters
|
|
202
|
+
* living in other repos resolve their own ethers install, and nominal class
|
|
203
|
+
* typing would reject it.
|
|
204
|
+
*
|
|
205
|
+
* @param signature - The signature to encode (`r`/`s` as 0x hex, `yParity` 0 or 1).
|
|
206
|
+
* @returns The response record, ready to post.
|
|
207
|
+
* @throws Error if `r` is not the x coordinate of a curve point.
|
|
208
|
+
*/
|
|
209
|
+
export declare function signatureToSignatureRespondedEvent(signature: Pick<Signature, "r" | "s" | "yParity">): SignatureRespondedEvent;
|
|
210
|
+
/**
|
|
211
|
+
* Assemble the broadcast-ready signed EIP-1559 transaction for a request from
|
|
212
|
+
* its MPC signature response: rebuild the exact unsigned transaction the MPC
|
|
213
|
+
* signed (see {@link signBidirectionalEventToUnsignedEVMTransaction}) and
|
|
214
|
+
* attach the signature. Does NOT check that the signature recovers to the
|
|
215
|
+
* requester's derived address — the response log is unauthenticated, so
|
|
216
|
+
* verify first with `verifySignatureRespondedEvent`.
|
|
217
|
+
*
|
|
218
|
+
* @param request - The on-ledger request record.
|
|
219
|
+
* @param response - The posted signature record answering it.
|
|
220
|
+
* @returns The signed ethers transaction; `serialized` is the raw payload for
|
|
221
|
+
* `eth_sendRawTransaction`, `hash` its on-chain hash, `from` the recovered
|
|
222
|
+
* sender.
|
|
223
|
+
* @throws Error if the request record is malformed (see
|
|
224
|
+
* {@link signBidirectionalEventToUnsignedEVMTransaction}) or the response
|
|
225
|
+
* is not a decodable signature.
|
|
226
|
+
*/
|
|
227
|
+
export declare function signBidirectionalEventToSignedEVMTransaction(request: SignBidirectionalEvent, response: SignatureRespondedEvent): Transaction;
|
|
228
|
+
//# sourceMappingURL=signet-evtype2tx-requests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signet-evtype2tx-requests.d.ts","sourceRoot":"","sources":["../src/signet-evtype2tx-requests.ts"],"names":[],"mappings":"AAYA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAwB,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAKL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,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
|
+
// TypeScript twins of the `EVMType2TxParams` decomposition structs in
|
|
3
|
+
// `Signet.compact`, their runtime descriptors, the ABI-word helpers, and the
|
|
4
|
+
// request -> transaction assembly the signer runs. Everything chain-agnostic
|
|
5
|
+
// (the request record itself, ids, the descriptor toolkit) lives in
|
|
6
|
+
// `signet-requests.ts`; a future non-EVM decomposition gets a sibling of THIS
|
|
7
|
+
// file.
|
|
8
|
+
//
|
|
9
|
+
// The no-translation invariant lives here: words are stored ABI-ready and
|
|
10
|
+
// {@link assembleCalldata} concatenates `selector || words` VERBATIM, so the
|
|
11
|
+
// transaction the MPC signs carries the contract-stored bytes untouched.
|
|
12
|
+
import { CompactTypeBytes, CompactTypeUnsignedInteger, CompactTypeVector, persistentHash, } from "@midnight-ntwrk/compact-runtime";
|
|
13
|
+
import { getAddress, getBytes, Signature, Transaction } from "ethers";
|
|
14
|
+
import { bytesToHex, compactMaybeDescriptor, compactStructDescriptor, signBidirectionalEventDescriptorWith, } from "./signet-requests.js";
|
|
15
|
+
// ---- Runtime descriptors (see the deviation note in signet-requests.ts) ----
|
|
16
|
+
// Base-type literals match what the compiler emits for the EVM structs'
|
|
17
|
+
// fields (Uint<8/16/64/128>, Bytes<4/20/32>).
|
|
18
|
+
const BYTES_4 = new CompactTypeBytes(4);
|
|
19
|
+
const BYTES_20 = new CompactTypeBytes(20);
|
|
20
|
+
const BYTES_32 = new CompactTypeBytes(32);
|
|
21
|
+
const UINT_8 = new CompactTypeUnsignedInteger(2n ** 8n - 1n, 1);
|
|
22
|
+
const UINT_16 = new CompactTypeUnsignedInteger(2n ** 16n - 1n, 2);
|
|
23
|
+
const UINT_64 = new CompactTypeUnsignedInteger(2n ** 64n - 1n, 8);
|
|
24
|
+
const UINT_128 = new CompactTypeUnsignedInteger(2n ** 128n - 1n, 16);
|
|
25
|
+
/**
|
|
26
|
+
* Descriptor of {@link EVMCalldata} at one word capacity — the TS analogue
|
|
27
|
+
* of instantiating Compact's `EVMCalldata<#maxWords>`.
|
|
28
|
+
*
|
|
29
|
+
* @param maxWords - The contract's calldata word capacity (the vault uses 2).
|
|
30
|
+
* @returns The calldata descriptor.
|
|
31
|
+
*/
|
|
32
|
+
export function evmCalldataDescriptor(maxWords) {
|
|
33
|
+
return compactStructDescriptor({
|
|
34
|
+
selector: BYTES_4,
|
|
35
|
+
noWords: UINT_16,
|
|
36
|
+
words: new CompactTypeVector(maxWords, BYTES_32),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Descriptor of {@link EVMAccessListEntry} at one storage-key capacity
|
|
41
|
+
* (Compact: `EVMAccessListEntry<#maxStorageKeys>`).
|
|
42
|
+
*
|
|
43
|
+
* @param maxStorageKeys - Storage-key capacity per entry.
|
|
44
|
+
* @returns The entry descriptor.
|
|
45
|
+
*/
|
|
46
|
+
export function evmAccessListEntryDescriptor(maxStorageKeys) {
|
|
47
|
+
return compactStructDescriptor({
|
|
48
|
+
address: BYTES_20,
|
|
49
|
+
storageKeyCount: UINT_8,
|
|
50
|
+
storageKeys: new CompactTypeVector(maxStorageKeys, BYTES_32),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Descriptor of {@link EVMType2TxParams} at one capacity instantiation —
|
|
55
|
+
* the TS analogue of Compact's `EVMType2TxParams<#maxCalldataWords,
|
|
56
|
+
* #maxAccessListEntries, #maxStorageKeysPerEntry>`.
|
|
57
|
+
*
|
|
58
|
+
* @param maxCalldataWords - Calldata word capacity.
|
|
59
|
+
* @param maxAccessListEntries - Access-list entry capacity.
|
|
60
|
+
* @param maxStorageKeysPerEntry - Storage-key capacity per entry.
|
|
61
|
+
* @returns The tx-params descriptor.
|
|
62
|
+
*/
|
|
63
|
+
export function evmType2TxParamsDescriptor(maxCalldataWords, maxAccessListEntries, maxStorageKeysPerEntry) {
|
|
64
|
+
return compactStructDescriptor({
|
|
65
|
+
to: BYTES_20,
|
|
66
|
+
chainId: UINT_64,
|
|
67
|
+
nonce: UINT_64,
|
|
68
|
+
gasLimit: UINT_64,
|
|
69
|
+
maxFeePerGas: UINT_128,
|
|
70
|
+
maxPriorityFeePerGas: UINT_128,
|
|
71
|
+
value: UINT_128,
|
|
72
|
+
accessListEntryCount: UINT_8,
|
|
73
|
+
accessList: new CompactTypeVector(maxAccessListEntries, evmAccessListEntryDescriptor(maxStorageKeysPerEntry)),
|
|
74
|
+
calldata: compactMaybeDescriptor(evmCalldataDescriptor(maxCalldataWords)),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Descriptor of {@link SignBidirectionalEvent} at one EVM Type-2 capacity
|
|
79
|
+
* instantiation — the generic record descriptor
|
|
80
|
+
* (`signBidirectionalEventDescriptorWith`) over
|
|
81
|
+
* {@link evmType2TxParamsDescriptor}.
|
|
82
|
+
*
|
|
83
|
+
* @param maxCalldataWords - Calldata word capacity.
|
|
84
|
+
* @param maxAccessListEntries - Access-list entry capacity.
|
|
85
|
+
* @param maxStorageKeysPerEntry - Storage-key capacity per entry.
|
|
86
|
+
* @param lenOutputDeserialization - Declared byte width of
|
|
87
|
+
* `outputDeserializationSchema` (Compact `#LenOutputDeserialization`).
|
|
88
|
+
* @param lenRespondSerialization - Declared byte width of
|
|
89
|
+
* `respondSerializationSchema` (Compact `#LenRespondSerialization`).
|
|
90
|
+
* @returns The event record descriptor.
|
|
91
|
+
*/
|
|
92
|
+
export function signBidirectionalEventDescriptor(maxCalldataWords, maxAccessListEntries, maxStorageKeysPerEntry, lenOutputDeserialization, lenRespondSerialization) {
|
|
93
|
+
return signBidirectionalEventDescriptorWith(evmType2TxParamsDescriptor(maxCalldataWords, maxAccessListEntries, maxStorageKeysPerEntry), lenOutputDeserialization, lenRespondSerialization);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Canonical id of a signet request: the persistent hash of the entire event
|
|
97
|
+
* record (which commits to every field, the sender address included — there
|
|
98
|
+
* is deliberately no extra domain tag). TS twin of Signet.compact's
|
|
99
|
+
* `calculateRequestId` circuit (see the deviation note in
|
|
100
|
+
* signet-requests.ts), generic over the capacity instantiation via the
|
|
101
|
+
* record's own array lengths — pass the record exactly as the ledger stores
|
|
102
|
+
* it, unused slots included and schemas at their declared widths.
|
|
103
|
+
*
|
|
104
|
+
* @param request - The full event record (contract-shaped, all slots).
|
|
105
|
+
* @returns The 32-byte request id — the record's ledger map key.
|
|
106
|
+
*/
|
|
107
|
+
export function calculateRequestId(request) {
|
|
108
|
+
const { txParams } = request;
|
|
109
|
+
const maxCalldataWords = txParams.calldata.value.words.length;
|
|
110
|
+
const maxAccessListEntries = txParams.accessList.length;
|
|
111
|
+
const maxStorageKeysPerEntry = maxAccessListEntries === 0 ? 0 : txParams.accessList[0].storageKeys.length;
|
|
112
|
+
return persistentHash(signBidirectionalEventDescriptor(maxCalldataWords, maxAccessListEntries, maxStorageKeysPerEntry, request.outputDeserializationSchema.length, request.respondSerializationSchema.length), request);
|
|
113
|
+
}
|
|
114
|
+
// ---- ABI words / calldata / transaction assembly ---------------------------
|
|
115
|
+
/**
|
|
116
|
+
* The ABI word for a numeric value (e.g. an ERC20 amount): the value as a
|
|
117
|
+
* 32-byte BIG-ENDIAN integer, exactly as broadcast. TS mirror of
|
|
118
|
+
* Signet.compact's `numericAbiWord` circuit (lockstep-tested against the
|
|
119
|
+
* compiled circuit). Use when building words off-chain (UIs, expected-record
|
|
120
|
+
* builders, tests).
|
|
121
|
+
*
|
|
122
|
+
* @param value - The word's numeric value (e.g. an amount).
|
|
123
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EVMCalldata} word.
|
|
124
|
+
*/
|
|
125
|
+
export function numericAbiWord(value) {
|
|
126
|
+
return bigintToBytes32BE(value);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The ABI word for an EVM address: 12 zero bytes, then the 20 display-order
|
|
130
|
+
* address bytes, exactly as broadcast. TS mirror of Signet.compact's
|
|
131
|
+
* `evmAddressAbiWord` circuit (lockstep-tested against the compiled circuit).
|
|
132
|
+
*
|
|
133
|
+
* @param address - The 20-byte address in display order.
|
|
134
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EVMCalldata} word.
|
|
135
|
+
* @throws Error if the address is not exactly 20 bytes.
|
|
136
|
+
*/
|
|
137
|
+
export function evmAddressAbiWord(address) {
|
|
138
|
+
if (address.length !== 20) {
|
|
139
|
+
throw new Error(`EVM address must be 20 bytes, got ${address.length}`);
|
|
140
|
+
}
|
|
141
|
+
const word = new Uint8Array(32);
|
|
142
|
+
word.set(address, 12);
|
|
143
|
+
return word;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Read a numeric ABI word back into a bigint: the big-endian reading of bytes
|
|
147
|
+
* 16..31. TS mirror of Signet.compact's `abiWordToUint128` circuit, including
|
|
148
|
+
* its canonicality check: the leading 16 bytes must be zero, so a word wider
|
|
149
|
+
* than Uint<128> is rejected rather than silently truncated.
|
|
150
|
+
*
|
|
151
|
+
* @param word - The ABI-ready 32-byte word.
|
|
152
|
+
* @returns The word's numeric value.
|
|
153
|
+
* @throws Error if the word is not 32 bytes or its leading half is nonzero.
|
|
154
|
+
*/
|
|
155
|
+
export function abiWordToUint128(word) {
|
|
156
|
+
if (word.length !== 32) {
|
|
157
|
+
throw new Error(`ABI word must be 32 bytes, got ${word.length}`);
|
|
158
|
+
}
|
|
159
|
+
if (word.slice(0, 16).some((byte) => byte !== 0)) {
|
|
160
|
+
throw new Error("ABI word exceeds Uint<128>");
|
|
161
|
+
}
|
|
162
|
+
let value = 0n;
|
|
163
|
+
for (let i = 16; i < 32; i++) {
|
|
164
|
+
value = value * 256n + BigInt(word[i]);
|
|
165
|
+
}
|
|
166
|
+
return value;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Assemble the raw calldata a request's words describe:
|
|
170
|
+
* `data = selector || words[0..noWords]`, VERBATIM. Words are stored
|
|
171
|
+
* ABI-ready (see {@link EVMCalldata}), so no byte of the stored record is
|
|
172
|
+
* reordered or reinterpreted on the way into the transaction; slots past
|
|
173
|
+
* `noWords` are unused capacity and are dropped. This is THE implementation
|
|
174
|
+
* of the signer-side assembly documented on `EVMCalldata` in Signet.compact.
|
|
175
|
+
*
|
|
176
|
+
* @param calldata - The request's calldata field.
|
|
177
|
+
* @returns Hex calldata for the transaction (`"0x"` when absent).
|
|
178
|
+
*/
|
|
179
|
+
export function assembleCalldata(calldata) {
|
|
180
|
+
if (!calldata.is_some) {
|
|
181
|
+
return "0x";
|
|
182
|
+
}
|
|
183
|
+
const { selector, noWords, words } = calldata.value;
|
|
184
|
+
let data = `0x${bytesToHex(selector)}`;
|
|
185
|
+
for (let i = 0; i < Number(noWords); i++) {
|
|
186
|
+
data += bytesToHex(words[i]);
|
|
187
|
+
}
|
|
188
|
+
return data;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Decode the real (count-trimmed) access list of a request into the shape
|
|
192
|
+
* ethers' `Transaction.from` accepts.
|
|
193
|
+
*
|
|
194
|
+
* @param txParams - The request's transaction decomposition.
|
|
195
|
+
* @returns The access list, possibly empty.
|
|
196
|
+
*/
|
|
197
|
+
function decodeAccessList(txParams) {
|
|
198
|
+
return txParams.accessList
|
|
199
|
+
.slice(0, Number(txParams.accessListEntryCount))
|
|
200
|
+
.map((entry) => ({
|
|
201
|
+
address: getAddress(`0x${bytesToHex(entry.address)}`),
|
|
202
|
+
storageKeys: entry.storageKeys
|
|
203
|
+
.slice(0, Number(entry.storageKeyCount))
|
|
204
|
+
.map((key) => `0x${bytesToHex(key)}`),
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Rebuild the unsigned EIP-1559 transaction a request record describes,
|
|
209
|
+
* byte-identical to the one the MPC assembles and signs: calldata from the
|
|
210
|
+
* tagged words (see {@link assembleCalldata}), the count-trimmed access
|
|
211
|
+
* list, and the stored envelope fields. This is the canonical
|
|
212
|
+
* request→transaction transform; response-side verification
|
|
213
|
+
* (`signature-response-verification.ts`) and the signed-transaction builder
|
|
214
|
+
* below both go through it, so the transaction a client broadcasts is
|
|
215
|
+
* provably the one the MPC put its signature over.
|
|
216
|
+
*
|
|
217
|
+
* @param request - The on-ledger request record.
|
|
218
|
+
* @returns The unsigned ethers transaction (`unsignedHash` is the digest the
|
|
219
|
+
* MPC signs).
|
|
220
|
+
* @throws Error if a calldata word carries an unknown kind.
|
|
221
|
+
*/
|
|
222
|
+
export function signBidirectionalEventToUnsignedEVMTransaction(request) {
|
|
223
|
+
const { txParams } = request;
|
|
224
|
+
return Transaction.from({
|
|
225
|
+
type: 2,
|
|
226
|
+
chainId: txParams.chainId,
|
|
227
|
+
nonce: Number(txParams.nonce),
|
|
228
|
+
gasLimit: txParams.gasLimit,
|
|
229
|
+
maxFeePerGas: txParams.maxFeePerGas,
|
|
230
|
+
maxPriorityFeePerGas: txParams.maxPriorityFeePerGas,
|
|
231
|
+
to: getAddress(`0x${bytesToHex(txParams.to)}`),
|
|
232
|
+
value: txParams.value,
|
|
233
|
+
accessList: decodeAccessList(txParams),
|
|
234
|
+
data: assembleCalldata(txParams.calldata),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Decode a response signature record (as posted to the signet contract's
|
|
239
|
+
* signature response log — the canonical MPC `Signature { big_r, s,
|
|
240
|
+
* recovery_id }` shape) into an ethers {@link Signature}: `r` is `bigR`'s x
|
|
241
|
+
* coordinate, `v` the legacy parity derived from the recovery id.
|
|
242
|
+
*
|
|
243
|
+
* @param response - The posted signature record.
|
|
244
|
+
* @returns The ethers signature.
|
|
245
|
+
* @throws Error if the recovery id is not 0 or 1.
|
|
246
|
+
*/
|
|
247
|
+
export function signatureRespondedEventToSignature(response) {
|
|
248
|
+
const recoveryId = Number(response.recoveryId);
|
|
249
|
+
if (recoveryId !== 0 && recoveryId !== 1) {
|
|
250
|
+
throw new Error(`expected a recovery id of 0 or 1, got ${recoveryId}`);
|
|
251
|
+
}
|
|
252
|
+
return Signature.from({
|
|
253
|
+
r: `0x${bytesToHex(response.bigRx)}`,
|
|
254
|
+
s: `0x${bytesToHex(response.s)}`,
|
|
255
|
+
v: recoveryId + 27,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/** secp256k1 base field prime (2^256 - 2^32 - 977). */
|
|
259
|
+
const SECP256K1_P = 2n ** 256n - 2n ** 32n - 977n;
|
|
260
|
+
/** Modular exponentiation by squaring. */
|
|
261
|
+
function modPow(base, exponent, modulus) {
|
|
262
|
+
let result = 1n;
|
|
263
|
+
let b = base % modulus;
|
|
264
|
+
let e = exponent;
|
|
265
|
+
while (e > 0n) {
|
|
266
|
+
if (e & 1n)
|
|
267
|
+
result = (result * b) % modulus;
|
|
268
|
+
b = (b * b) % modulus;
|
|
269
|
+
e >>= 1n;
|
|
270
|
+
}
|
|
271
|
+
return result;
|
|
272
|
+
}
|
|
273
|
+
/** Encode a bigint as exactly 32 BIG-endian bytes (secp256k1 scalar form). */
|
|
274
|
+
function bigintToBytes32BE(value) {
|
|
275
|
+
const out = new Uint8Array(32);
|
|
276
|
+
let v = value;
|
|
277
|
+
for (let i = 31; i >= 0; i--) {
|
|
278
|
+
out[i] = Number(v & 0xffn);
|
|
279
|
+
v >>= 8n;
|
|
280
|
+
}
|
|
281
|
+
return out;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Encode an ECDSA signature as the response record posted to the signet
|
|
285
|
+
* contract — the inverse of {@link signatureRespondedEventToSignature},
|
|
286
|
+
* for MPC-side posters (the fakenet signer, tests). The canonical record
|
|
287
|
+
* carries `bigR` as a full affine point but an `r || s || v` signature only
|
|
288
|
+
* has R.x and the parity of R.y, so R.y is recovered by decompressing the
|
|
289
|
+
* point on the curve (y² = x³ + 7 over the secp256k1 base field).
|
|
290
|
+
*
|
|
291
|
+
* The parameter is structural (the r/s/yParity subset of an ethers
|
|
292
|
+
* {@link Signature}) so signatures from ANY ethers instance qualify — posters
|
|
293
|
+
* living in other repos resolve their own ethers install, and nominal class
|
|
294
|
+
* typing would reject it.
|
|
295
|
+
*
|
|
296
|
+
* @param signature - The signature to encode (`r`/`s` as 0x hex, `yParity` 0 or 1).
|
|
297
|
+
* @returns The response record, ready to post.
|
|
298
|
+
* @throws Error if `r` is not the x coordinate of a curve point.
|
|
299
|
+
*/
|
|
300
|
+
export function signatureToSignatureRespondedEvent(signature) {
|
|
301
|
+
const x = BigInt(signature.r);
|
|
302
|
+
const ySquared = (modPow(x, 3n, SECP256K1_P) + 7n) % SECP256K1_P;
|
|
303
|
+
// P ≡ 3 (mod 4), so a square root (when one exists) is c^((P+1)/4).
|
|
304
|
+
let y = modPow(ySquared, (SECP256K1_P + 1n) / 4n, SECP256K1_P);
|
|
305
|
+
if ((y * y) % SECP256K1_P !== ySquared) {
|
|
306
|
+
throw new Error("signature r is not the x coordinate of a secp256k1 point");
|
|
307
|
+
}
|
|
308
|
+
if ((y & 1n) !== BigInt(signature.yParity)) {
|
|
309
|
+
y = SECP256K1_P - y;
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
bigRx: getBytes(signature.r),
|
|
313
|
+
bigRy: bigintToBytes32BE(y),
|
|
314
|
+
s: getBytes(signature.s),
|
|
315
|
+
recoveryId: BigInt(signature.yParity),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Assemble the broadcast-ready signed EIP-1559 transaction for a request from
|
|
320
|
+
* its MPC signature response: rebuild the exact unsigned transaction the MPC
|
|
321
|
+
* signed (see {@link signBidirectionalEventToUnsignedEVMTransaction}) and
|
|
322
|
+
* attach the signature. Does NOT check that the signature recovers to the
|
|
323
|
+
* requester's derived address — the response log is unauthenticated, so
|
|
324
|
+
* verify first with `verifySignatureRespondedEvent`.
|
|
325
|
+
*
|
|
326
|
+
* @param request - The on-ledger request record.
|
|
327
|
+
* @param response - The posted signature record answering it.
|
|
328
|
+
* @returns The signed ethers transaction; `serialized` is the raw payload for
|
|
329
|
+
* `eth_sendRawTransaction`, `hash` its on-chain hash, `from` the recovered
|
|
330
|
+
* sender.
|
|
331
|
+
* @throws Error if the request record is malformed (see
|
|
332
|
+
* {@link signBidirectionalEventToUnsignedEVMTransaction}) or the response
|
|
333
|
+
* is not a decodable signature.
|
|
334
|
+
*/
|
|
335
|
+
export function signBidirectionalEventToSignedEVMTransaction(request, response) {
|
|
336
|
+
const transaction = signBidirectionalEventToUnsignedEVMTransaction(request);
|
|
337
|
+
transaction.signature = signatureRespondedEventToSignature(response);
|
|
338
|
+
return transaction;
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=signet-evtype2tx-requests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signet-evtype2tx-requests.js","sourceRoot":"","sources":["../src/signet-evtype2tx-requests.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,8EAA8E;AAC9E,QAAQ;AACR,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AAEzE,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACjB,cAAc,GAEf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGtE,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,uBAAuB,EACvB,oCAAoC,GAIrC,MAAM,sBAAsB,CAAC;AAiE9B,+EAA+E;AAC/E,wEAAwE;AACxE,8CAA8C;AAC9C,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;AACxC,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC;AAC1C,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC;AAC1C,MAAM,MAAM,GAAG,IAAI,0BAA0B,CAAC,EAAE,IAAI,EAAE,GAA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tC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,4CAA4C,CAC1D,OAA+B,EAC/B,QAAiC;IAEjC,MAAM,WAAW,GAAG,8CAA8C,CAAC,OAAO,CAAC,CAAC;IAC5E,WAAW,CAAC,SAAS,GAAG,kCAAkC,CAAC,QAAQ,CAAC,CAAC;IACrE,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import type { PublicDataProvider } from "@midnight-ntwrk/midnight-js-types";
|
|
|
2
2
|
import type { Transaction } from "ethers";
|
|
3
3
|
import { type SignatureRespondedEvent, type RespondBidirectionalEvent } from "./signet-contract-state-reader.ts";
|
|
4
4
|
import type { RawContractState } from "./signature-state-reading.ts";
|
|
5
|
-
import {
|
|
5
|
+
import type { SignBidirectionalEvent, RequestIdHex } from "./signet-requests.ts";
|
|
6
6
|
/**
|
|
7
7
|
* The least of midnight-js's `PublicDataProvider` the reader needs: raw
|
|
8
8
|
* contract state by address. Declared structurally (rather than a `Pick`) so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-response-reader.d.ts","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"signet-request-response-reader.d.ts","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;A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3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAGzB;IAEJ;;OAEG;gBACS,MAAM,EAAE,iCAAiC;IAIrD;;;;;;;OAOG;YACW,aAAa;IAc3B;;;;;;;;;OASG;IACG,mBAAmB,CACvB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,sBAAsB,CAAC;IAwBlC;;;;;;;;;OASG;IACG,qBAAqB,CACzB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAwBrC;;;;;;;;;;;;;OAaG;IACG,kCAAkC,CACtC,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,+BAA+B,CAAC;IAiC3C;;;;;;;;;;;OAWG;IACG,yBAAyB,CAC7B,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,WAAW,CAAC;IAMvB;;;;;;;;;;;;;;;OAeG;IACG,uBAAuB,CAC3B,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAcnC;;;;;;;;;;;;OAYG;IACG,6BAA6B,CACjC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAuBxC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { lookupSignetRequestAt } from "./signature-requests-state-reader.js";
|
|
12
12
|
import { readSignetContractLedgerFromState, signetMapEntryKey, } from "./signet-contract-state-reader.js";
|
|
13
13
|
import { recoverSignatureResponseSigner } from "./signature-response-verification.js";
|
|
14
|
-
import { signBidirectionalEventToSignedEVMTransaction, signBidirectionalEventToUnsignedEVMTransaction, } from "./signet-requests.js";
|
|
14
|
+
import { signBidirectionalEventToSignedEVMTransaction, signBidirectionalEventToUnsignedEVMTransaction, } from "./signet-evtype2tx-requests.js";
|
|
15
15
|
/**
|
|
16
16
|
* Reader over one requester contract / signet contract pair.
|
|
17
17
|
* Construct once per pair and reuse: fetched request records are cached (they
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,uBAAuB;AACvB,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,mEAAmE;AACnE,2EAA2E;AAC3E,6BAA6B;AAK7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,iCAAiC,EACjC,iBAAiB,GAGlB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EACL,4CAA4C,EAC5C,8CAA8C,
|
|
1
|
+
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,uBAAuB;AACvB,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,mEAAmE;AACnE,2EAA2E;AAC3E,6BAA6B;AAK7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,iCAAiC,EACjC,iBAAiB,GAGlB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EACL,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AAoExC;;;;;GAKG;AACH,MAAM,OAAO,2BAA2B;IACrB,MAAM,CAAoC;IAE3D,qEAAqE;IACpD,YAAY,GAAG,IAAI,GAAG,EAGpC,CAAC;IAEJ;;OAEG;IACH,YAAY,MAAyC;QACnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACK,KAAK,CAAC,aAAa,CACzB,eAAuB,EACvB,IAAY;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