@sig-net/midnight 0.0.8 → 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/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
|
@@ -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;QAEZ,MAAM,KAAK,GACT,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,cAAc,eAAe,qBAAqB,CAClF,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC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U,EAAE,KAAK,EAAE,EAAE,CAAC;YACjD,MAAM,QAAQ,GAAG,uBAAuB,CAAC,GAAG,CAC1C,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CACpC,CAAC;YACF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CACb,0CAA0C,KAAK,gBAAgB,SAAS,GAAG;oBACzE,+BAA+B,UAAU,iCAAiC,CAC7E,CAAC;YACJ,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type CompactType } from "@midnight-ntwrk/compact-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import type { SignatureRespondedEvent } from "./signet-contract-state-reader.ts";
|
|
2
|
+
import type { EVMType2TxParams } from "./signet-evtype2tx-requests.ts";
|
|
4
3
|
/**
|
|
5
4
|
* 32-byte signet request id (Compact: `new type RequestId = Bytes<32>`).
|
|
6
5
|
* Chain-agnostic: downstream consumers treat it as an opaque key. Ids are
|
|
@@ -24,7 +23,7 @@ export interface ContractAddress {
|
|
|
24
23
|
* `enum`) so the values stay structurally `number`.
|
|
25
24
|
*/
|
|
26
25
|
export declare const TxParamType: {
|
|
27
|
-
/**
|
|
26
|
+
/** `EVMType2TxParams` (signet-evtype2tx-requests.ts): an EIP-1559 EVM transaction. */
|
|
28
27
|
readonly evmType2: 0;
|
|
29
28
|
/**
|
|
30
29
|
* Never emitted — mirrors the Compact-side padding variant that keeps the
|
|
@@ -62,75 +61,19 @@ export interface Maybe<T> {
|
|
|
62
61
|
is_some: boolean;
|
|
63
62
|
value: T;
|
|
64
63
|
}
|
|
65
|
-
/**
|
|
66
|
-
* ABI calldata as a 4-byte selector + 32-byte word slots (Compact:
|
|
67
|
-
* `EVMCalldata<#maxWords>`). Each word is a little-endian field embed (what the
|
|
68
|
-
* contract's `x as Field as Bytes<32>` cast produces); the MPC re-encodes the
|
|
69
|
-
* leading {@link noWords} of them big-endian to form the calldata body —
|
|
70
|
-
* `data = selector || BE(words[0..noWords])`, see {@link assembleCalldata}.
|
|
71
|
-
*/
|
|
72
|
-
export interface EVMCalldata {
|
|
73
|
-
/** The literal first 4 calldata bytes (big-endian, as broadcast). */
|
|
74
|
-
selector: Uint8Array;
|
|
75
|
-
/** How many leading {@link words} are real (Compact `noWords: Uint<16>`). */
|
|
76
|
-
noWords: bigint;
|
|
77
|
-
/** 32-byte word slots; capacity is the contract's `#maxWords` (vault: 2). */
|
|
78
|
-
words: Uint8Array[];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* One EIP-2930 access-list entry (Compact:
|
|
82
|
-
* `EVMAccessListEntry<#maxStorageKeys>`).
|
|
83
|
-
*/
|
|
84
|
-
export interface EVMAccessListEntry {
|
|
85
|
-
/** The pre-declared contract address, 20 display-order bytes. */
|
|
86
|
-
address: Uint8Array;
|
|
87
|
-
/** How many leading {@link storageKeys} are real. */
|
|
88
|
-
storageKeyCount: bigint;
|
|
89
|
-
/** Raw 32-byte storage keys, copied verbatim into the transaction. */
|
|
90
|
-
storageKeys: Uint8Array[];
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* The EVM transaction to be signed, decomposed into typed fields (Compact:
|
|
94
|
-
* `EVMType2TxParams<#maxCalldataWords, #maxAccessListEntries,
|
|
95
|
-
* #maxStorageKeysPerEntry>`; EIP-1559 — https://eips.ethereum.org/EIPS/eip-1559).
|
|
96
|
-
* Compact `Bytes<N>` fields arrive as N-byte `Uint8Array`s, `Uint<N>` as
|
|
97
|
-
* `bigint`. Vector capacities are each contract's compile-time throttle;
|
|
98
|
-
* the runtime counts say how many leading slots are real.
|
|
99
|
-
*/
|
|
100
|
-
export interface EVMType2TxParams {
|
|
101
|
-
/** Call target (e.g. the ERC20 contract), 20 bytes. */
|
|
102
|
-
to: Uint8Array;
|
|
103
|
-
/** EVM chain id (also expressed in {@link SignBidirectionalEvent.caip2Id}). */
|
|
104
|
-
chainId: bigint;
|
|
105
|
-
/** Account nonce of the MPC-derived sender address. */
|
|
106
|
-
nonce: bigint;
|
|
107
|
-
/** Gas ceiling for the call. */
|
|
108
|
-
gasLimit: bigint;
|
|
109
|
-
/** Max total fee per gas, wei. */
|
|
110
|
-
maxFeePerGas: bigint;
|
|
111
|
-
/** Max priority fee per gas, wei. */
|
|
112
|
-
maxPriorityFeePerGas: bigint;
|
|
113
|
-
/** ETH sent with the call, wei. */
|
|
114
|
-
value: bigint;
|
|
115
|
-
/** How many leading {@link accessList} entries are real. */
|
|
116
|
-
accessListEntryCount: bigint;
|
|
117
|
-
/** EIP-2930 access list slots (capacity = contract's throttle). */
|
|
118
|
-
accessList: EVMAccessListEntry[];
|
|
119
|
-
/** Call data; `is_some: false` means a plain ETH transfer (`0x` data). */
|
|
120
|
-
calldata: Maybe<EVMCalldata>;
|
|
121
|
-
}
|
|
122
64
|
/**
|
|
123
65
|
* Canonical signet request record (Compact:
|
|
124
66
|
* `SignBidirectionalEvent<TxParams, #LenOutputDeserialization,
|
|
125
67
|
* #LenRespondSerialization>`), stored per {@link RequestId} in a requesting
|
|
126
68
|
* contract's `SignBidirectionalEventMap` (at whichever ledger field the
|
|
127
|
-
* contract declares it — its notifications name the position).
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* widths in their array
|
|
132
|
-
|
|
133
|
-
|
|
69
|
+
* contract declares it — its notifications name the position). Generic over
|
|
70
|
+
* the tx-params decomposition, exactly like the Compact struct; the default
|
|
71
|
+
* instantiation is {@link EVMType2TxParams} — the only decomposition so far;
|
|
72
|
+
* new tx kinds supply their own type argument alongside their Compact struct.
|
|
73
|
+
* The schema fields carry their contract-declared byte widths in their array
|
|
74
|
+
* lengths.
|
|
75
|
+
*/
|
|
76
|
+
export interface SignBidirectionalEvent<TxParams = EVMType2TxParams> {
|
|
134
77
|
/** Address of the client contract that stores this event (`kernel.self()`). */
|
|
135
78
|
sender: ContractAddress;
|
|
136
79
|
/** Contract-local nonce captured when the request was created. */
|
|
@@ -148,7 +91,7 @@ export interface SignBidirectionalEvent {
|
|
|
148
91
|
/** A {@link TxParamType} value tagging the txParams decomposition. */
|
|
149
92
|
txParamType: number;
|
|
150
93
|
/** The transaction decomposition. */
|
|
151
|
-
txParams:
|
|
94
|
+
txParams: TxParams;
|
|
152
95
|
/** Target chain in CAIP-2 form (https://chainagnostic.org/CAIPs/caip-2), zero-padded; 32 bytes. */
|
|
153
96
|
caip2Id: Uint8Array;
|
|
154
97
|
/** MPC output_deserialization_schema (destination chain -> MPC); contract-declared width. */
|
|
@@ -157,154 +100,45 @@ export interface SignBidirectionalEvent {
|
|
|
157
100
|
respondSerializationSchema: Uint8Array;
|
|
158
101
|
}
|
|
159
102
|
/**
|
|
160
|
-
*
|
|
161
|
-
* of
|
|
103
|
+
* Build the runtime descriptor of a Compact struct from its per-field
|
|
104
|
+
* descriptors — the generic form of the struct descriptor classes the
|
|
105
|
+
* compiler generates (field-by-field concatenation of alignments and values).
|
|
162
106
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
|
|
166
|
-
export declare function evmCalldataDescriptor(maxWords: number): CompactType<EVMCalldata>;
|
|
167
|
-
/**
|
|
168
|
-
* Descriptor of {@link EVMAccessListEntry} at one storage-key capacity
|
|
169
|
-
* (Compact: `EVMAccessListEntry<#maxStorageKeys>`).
|
|
107
|
+
* Field ORDER must match the Compact struct declaration order; object
|
|
108
|
+
* literals preserve insertion order for string keys, so pass fields in
|
|
109
|
+
* declaration order.
|
|
170
110
|
*
|
|
171
|
-
* @param
|
|
172
|
-
* @returns The
|
|
111
|
+
* @param fields - One runtime descriptor per struct field, in declaration order.
|
|
112
|
+
* @returns The composed struct descriptor.
|
|
173
113
|
*/
|
|
174
|
-
export declare function
|
|
114
|
+
export declare function compactStructDescriptor<T extends object>(fields: {
|
|
115
|
+
readonly [K in keyof T]-?: CompactType<T[K]>;
|
|
116
|
+
}): CompactType<T>;
|
|
175
117
|
/**
|
|
176
|
-
* Descriptor of
|
|
177
|
-
*
|
|
178
|
-
* #maxAccessListEntries, #maxStorageKeysPerEntry>`.
|
|
118
|
+
* Descriptor of Compact's standard-library `Maybe<T>` — the compiler
|
|
119
|
+
* generates it as the struct `{ is_some: Boolean, value: T }`.
|
|
179
120
|
*
|
|
180
|
-
* @param
|
|
181
|
-
* @
|
|
182
|
-
* @param maxStorageKeysPerEntry - Storage-key capacity per entry.
|
|
183
|
-
* @returns The tx-params descriptor.
|
|
121
|
+
* @param inner - Descriptor of the wrapped type.
|
|
122
|
+
* @returns The Maybe struct descriptor.
|
|
184
123
|
*/
|
|
185
|
-
export declare function
|
|
124
|
+
export declare function compactMaybeDescriptor<T>(inner: CompactType<T>): CompactType<Maybe<T>>;
|
|
186
125
|
/**
|
|
187
|
-
* Descriptor of {@link SignBidirectionalEvent}
|
|
126
|
+
* Descriptor of {@link SignBidirectionalEvent} over ANY tx-params
|
|
127
|
+
* decomposition — the TS analogue of Compact's generic
|
|
128
|
+
* `SignBidirectionalEvent<TxParams, #LenOutputDeserialization,
|
|
129
|
+
* #LenRespondSerialization>`. Each decomposition wraps this with its own
|
|
130
|
+
* capacity-parameterized convenience (see `signBidirectionalEventDescriptor`
|
|
131
|
+
* in signet-evtype2tx-requests.ts for the EVM Type-2 one).
|
|
188
132
|
*
|
|
189
|
-
* @param
|
|
190
|
-
*
|
|
191
|
-
* @param maxStorageKeysPerEntry - Storage-key capacity per entry.
|
|
133
|
+
* @param txParams - Descriptor of the tx-params decomposition, already at
|
|
134
|
+
* its capacity instantiation.
|
|
192
135
|
* @param lenOutputDeserialization - Declared byte width of
|
|
193
136
|
* `outputDeserializationSchema` (Compact `#LenOutputDeserialization`).
|
|
194
137
|
* @param lenRespondSerialization - Declared byte width of
|
|
195
138
|
* `respondSerializationSchema` (Compact `#LenRespondSerialization`).
|
|
196
139
|
* @returns The event record descriptor.
|
|
197
140
|
*/
|
|
198
|
-
export declare function
|
|
199
|
-
/**
|
|
200
|
-
* Canonical id of a signet request: the persistent hash of the entire event
|
|
201
|
-
* record (which commits to every field, the sender address included — there
|
|
202
|
-
* is deliberately no extra domain tag). TS twin of Signet.compact's
|
|
203
|
-
* `calculateRequestId` circuit (see the deviation note atop this section),
|
|
204
|
-
* generic over the capacity instantiation via the record's own array
|
|
205
|
-
* lengths — pass the record exactly as the ledger stores it, unused slots
|
|
206
|
-
* included and schemas at their declared widths.
|
|
207
|
-
*
|
|
208
|
-
* @param request - The full event record (contract-shaped, all slots).
|
|
209
|
-
* @returns The 32-byte request id — the record's ledger map key.
|
|
210
|
-
*/
|
|
211
|
-
export declare function calculateRequestId(request: SignBidirectionalEvent): RequestId;
|
|
212
|
-
/**
|
|
213
|
-
* The 32-byte value of a numeric ABI word: the little-endian field embed of
|
|
214
|
-
* the number, exactly what Compact's `x as Field as Bytes<32>` cast produces
|
|
215
|
-
* in-circuit. Use when building words off-chain (UIs, expected-record
|
|
216
|
-
* builders, tests).
|
|
217
|
-
*
|
|
218
|
-
* @param value - The word's numeric value (e.g. an amount).
|
|
219
|
-
* @returns The 32-byte LE embed to store in an {@link EVMCalldata} word.
|
|
220
|
-
*/
|
|
221
|
-
export declare function numericAbiWordValue(value: bigint): Uint8Array;
|
|
222
|
-
/**
|
|
223
|
-
* The 32-byte staticArg word value for an EVM address: the BIG-ENDIAN
|
|
224
|
-
* numeric reading of its 20 display-order bytes, LE-embedded. TS mirror of
|
|
225
|
-
* Signet.compact's `evmAddressAbiValue` circuit (+ `as Bytes<32>`); see the
|
|
226
|
-
* warning there — embedding the display-order bytes directly would come out
|
|
227
|
-
* byte-reversed in the assembled calldata.
|
|
228
|
-
*
|
|
229
|
-
* @param address - The 20-byte address in display order.
|
|
230
|
-
* @returns The 32-byte word value to store in an {@link EVMCalldata} word.
|
|
231
|
-
*/
|
|
232
|
-
export declare function evmAddressAbiWord(address: Uint8Array): Uint8Array;
|
|
233
|
-
/**
|
|
234
|
-
* Re-assemble the raw calldata a request's words describe:
|
|
235
|
-
* `data = selector || BE(words[0..noWords])`. Each word is a little-endian
|
|
236
|
-
* field embed (the contract's `x as Field as Bytes<32>` cast); the leading
|
|
237
|
-
* `noWords` are re-encoded big-endian into 32-byte ABI words and any remaining
|
|
238
|
-
* capacity slots are dropped. This is THE implementation of the MPC re-assembly
|
|
239
|
-
* documented on `EVMCalldata` in Signet.compact.
|
|
240
|
-
*
|
|
241
|
-
* @param calldata - The request's calldata field.
|
|
242
|
-
* @returns Hex calldata for the transaction (`"0x"` when absent).
|
|
243
|
-
*/
|
|
244
|
-
export declare function assembleCalldata(calldata: Maybe<EVMCalldata>): string;
|
|
245
|
-
/**
|
|
246
|
-
* Rebuild the unsigned EIP-1559 transaction a request record describes,
|
|
247
|
-
* byte-identical to the one the MPC assembles and signs: calldata from the
|
|
248
|
-
* tagged words (see {@link assembleCalldata}), the count-trimmed access
|
|
249
|
-
* list, and the stored envelope fields. This is the canonical
|
|
250
|
-
* request→transaction transform; response-side verification
|
|
251
|
-
* (`signature-response-verification.ts`) and the signed-transaction builder
|
|
252
|
-
* below both go through it, so the transaction a client broadcasts is
|
|
253
|
-
* provably the one the MPC put its signature over.
|
|
254
|
-
*
|
|
255
|
-
* @param request - The on-ledger request record.
|
|
256
|
-
* @returns The unsigned ethers transaction (`unsignedHash` is the digest the
|
|
257
|
-
* MPC signs).
|
|
258
|
-
* @throws Error if a calldata word carries an unknown kind.
|
|
259
|
-
*/
|
|
260
|
-
export declare function signBidirectionalEventToUnsignedEVMTransaction(request: SignBidirectionalEvent): Transaction;
|
|
261
|
-
/**
|
|
262
|
-
* Decode a response signature record (as posted to the signet contract's
|
|
263
|
-
* signature response log — the canonical MPC `Signature { big_r, s,
|
|
264
|
-
* recovery_id }` shape) into an ethers {@link Signature}: `r` is `bigR`'s x
|
|
265
|
-
* coordinate, `v` the legacy parity derived from the recovery id.
|
|
266
|
-
*
|
|
267
|
-
* @param response - The posted signature record.
|
|
268
|
-
* @returns The ethers signature.
|
|
269
|
-
* @throws Error if the recovery id is not 0 or 1.
|
|
270
|
-
*/
|
|
271
|
-
export declare function signatureRespondedEventToSignature(response: SignatureRespondedEvent): Signature;
|
|
272
|
-
/**
|
|
273
|
-
* Encode an ECDSA signature as the response record posted to the signet
|
|
274
|
-
* contract — the inverse of {@link signatureRespondedEventToSignature},
|
|
275
|
-
* for MPC-side posters (the fakenet signer, tests). The canonical record
|
|
276
|
-
* carries `bigR` as a full affine point but an `r || s || v` signature only
|
|
277
|
-
* has R.x and the parity of R.y, so R.y is recovered by decompressing the
|
|
278
|
-
* point on the curve (y² = x³ + 7 over the secp256k1 base field).
|
|
279
|
-
*
|
|
280
|
-
* The parameter is structural (the r/s/yParity subset of an ethers
|
|
281
|
-
* {@link Signature}) so signatures from ANY ethers instance qualify — posters
|
|
282
|
-
* living in other repos resolve their own ethers install, and nominal class
|
|
283
|
-
* typing would reject it.
|
|
284
|
-
*
|
|
285
|
-
* @param signature - The signature to encode (`r`/`s` as 0x hex, `yParity` 0 or 1).
|
|
286
|
-
* @returns The response record, ready to post.
|
|
287
|
-
* @throws Error if `r` is not the x coordinate of a curve point.
|
|
288
|
-
*/
|
|
289
|
-
export declare function signatureToSignatureRespondedEvent(signature: Pick<Signature, "r" | "s" | "yParity">): SignatureRespondedEvent;
|
|
290
|
-
/**
|
|
291
|
-
* Assemble the broadcast-ready signed EIP-1559 transaction for a request from
|
|
292
|
-
* its MPC signature response: rebuild the exact unsigned transaction the MPC
|
|
293
|
-
* signed (see {@link signBidirectionalEventToUnsignedEVMTransaction}) and
|
|
294
|
-
* attach the signature. Does NOT check that the signature recovers to the
|
|
295
|
-
* requester's derived address — the response log is unauthenticated, so
|
|
296
|
-
* verify first with `verifySignatureRespondedEvent`.
|
|
297
|
-
*
|
|
298
|
-
* @param request - The on-ledger request record.
|
|
299
|
-
* @param response - The posted signature record answering it.
|
|
300
|
-
* @returns The signed ethers transaction; `serialized` is the raw payload for
|
|
301
|
-
* `eth_sendRawTransaction`, `hash` its on-chain hash, `from` the recovered
|
|
302
|
-
* sender.
|
|
303
|
-
* @throws Error if the request record is malformed (see
|
|
304
|
-
* {@link signBidirectionalEventToUnsignedEVMTransaction}) or the response
|
|
305
|
-
* is not a decodable signature.
|
|
306
|
-
*/
|
|
307
|
-
export declare function signBidirectionalEventToSignedEVMTransaction(request: SignBidirectionalEvent, response: SignatureRespondedEvent): Transaction;
|
|
141
|
+
export declare function signBidirectionalEventDescriptorWith<TxParams>(txParams: CompactType<TxParams>, lenOutputDeserialization: number, lenRespondSerialization: number): CompactType<SignBidirectionalEvent<TxParams>>;
|
|
308
142
|
/**
|
|
309
143
|
* The generated ledger shape of `Map<RequestId, SignBidirectionalEvent>`:
|
|
310
144
|
* what a contract's `ledger(state).signetRequestsIndex` provides. Structural,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-requests.d.ts","sourceRoot":"","sources":["../src/signet-requests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signet-requests.d.ts","sourceRoot":"","sources":["../src/signet-requests.ts"],"names":[],"mappings":"AAqBA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,CAAC;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW;IACtB,sFAAsF;;IAEtF;;;;OAIG;;CAEK,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB;IAChC,4BAA4B;;IAE5B,2EAA2E;;CAEnE,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB,sCAAsC;;IAEtC,2EAA2E;;CAEnE,CAAC;AAEX;;;;GAIG;AACH,MAAM,WA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