@sovereign-sdk/web3 0.0.13 → 0.0.15
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.mts +138 -60
- package/dist/index.d.ts +138 -60
- package/dist/index.js +165 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +160 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.d.mts
CHANGED
|
@@ -86,6 +86,10 @@ type BaseTypeSpec = {
|
|
|
86
86
|
* The type of runtime call used in the rollup.
|
|
87
87
|
*/
|
|
88
88
|
RuntimeCall: any;
|
|
89
|
+
/**
|
|
90
|
+
* The type of the dedup data used to deduplicate transactions.
|
|
91
|
+
*/
|
|
92
|
+
Dedup: any;
|
|
89
93
|
};
|
|
90
94
|
type OverrideType<Base, Override> = {
|
|
91
95
|
[K in keyof Base]: K extends keyof Override ? Override[K] : Base[K];
|
|
@@ -137,46 +141,71 @@ type OverrideType<Base, Override> = {
|
|
|
137
141
|
*/
|
|
138
142
|
type RollupTypeSpec<T extends Partial<BaseTypeSpec>> = OverrideType<BaseTypeSpec, T>;
|
|
139
143
|
|
|
144
|
+
type DeepPartial<T> = T extends unknown[] ? T : T extends Record<string, unknown> ? {
|
|
145
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
146
|
+
} : T;
|
|
147
|
+
|
|
148
|
+
type UnsignedTransactionContext<S extends BaseTypeSpec, C extends RollupContext> = {
|
|
149
|
+
runtimeCall: S["RuntimeCall"];
|
|
150
|
+
sender: Uint8Array;
|
|
151
|
+
overrides: DeepPartial<S["UnsignedTransaction"]>;
|
|
152
|
+
rollup: Rollup<S, C>;
|
|
153
|
+
};
|
|
154
|
+
type TransactionContext<S extends BaseTypeSpec, C extends RollupContext> = {
|
|
155
|
+
unsignedTx: S["UnsignedTransaction"];
|
|
156
|
+
sender: Uint8Array;
|
|
157
|
+
signature: Uint8Array;
|
|
158
|
+
rollup: Rollup<S, C>;
|
|
159
|
+
};
|
|
160
|
+
type TypeBuilder<S extends BaseTypeSpec, C extends RollupContext> = {
|
|
161
|
+
unsignedTransaction: (context: UnsignedTransactionContext<S, C>) => Promise<S["UnsignedTransaction"]>;
|
|
162
|
+
transaction: (context: TransactionContext<S, C>) => Promise<S["Transaction"]>;
|
|
163
|
+
};
|
|
140
164
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @template Tx The type of the transaction
|
|
165
|
+
* Arbitrary context that is associated with the rollup.
|
|
144
166
|
*/
|
|
145
|
-
type
|
|
146
|
-
/**
|
|
147
|
-
* The response from the sequencer.
|
|
148
|
-
*/
|
|
149
|
-
response: SovereignClient__default.Sequencer.TxCreateResponse;
|
|
150
|
-
/**
|
|
151
|
-
* The transaction that was submitted.
|
|
152
|
-
*/
|
|
153
|
-
transaction: Tx;
|
|
154
|
-
};
|
|
167
|
+
type RollupContext = Record<string, unknown>;
|
|
155
168
|
/**
|
|
156
169
|
* The configuration for a rollup client.
|
|
157
170
|
*/
|
|
158
|
-
type RollupConfig = {
|
|
171
|
+
type RollupConfig<C extends RollupContext> = {
|
|
159
172
|
/**
|
|
160
173
|
* The base URL of the rollup full node API.
|
|
161
174
|
*/
|
|
162
175
|
url?: string;
|
|
176
|
+
/**
|
|
177
|
+
* The Sovereign SDK client to use for the rollup.
|
|
178
|
+
* If not provided, the default client will be used using {@link RollupConfig.url}.
|
|
179
|
+
*/
|
|
180
|
+
client?: SovereignClient__default;
|
|
163
181
|
/**
|
|
164
182
|
* The schema of the rollup.
|
|
165
183
|
*/
|
|
166
|
-
schema
|
|
184
|
+
schema?: RollupSchema;
|
|
167
185
|
/**
|
|
168
|
-
* The
|
|
169
|
-
*
|
|
170
|
-
* @deprecated
|
|
171
|
-
* @private
|
|
186
|
+
* The serializer to use for the rollup.
|
|
187
|
+
* If not provided, a serializer will be created using the provided {@link RollupConfig.schema}.
|
|
172
188
|
*/
|
|
173
|
-
|
|
189
|
+
serializer?: RollupSerializer;
|
|
190
|
+
/**
|
|
191
|
+
* Arbitrary context that is associated with the rollup.
|
|
192
|
+
*/
|
|
193
|
+
context: C;
|
|
174
194
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
195
|
+
/**
|
|
196
|
+
* The result of signing and submitting a transaction.
|
|
197
|
+
*
|
|
198
|
+
* @template Tx The type of the transaction
|
|
199
|
+
*/
|
|
200
|
+
type TransactionResult<Tx> = {
|
|
201
|
+
/**
|
|
202
|
+
* The response from the sequencer.
|
|
203
|
+
*/
|
|
204
|
+
response: SovereignClient__default.Sequencer.TxCreateResponse;
|
|
205
|
+
/**
|
|
206
|
+
* The transaction that was submitted.
|
|
207
|
+
*/
|
|
208
|
+
transaction: Tx;
|
|
180
209
|
};
|
|
181
210
|
/**
|
|
182
211
|
* The parameters for signing and submitting a transaction.
|
|
@@ -190,69 +219,58 @@ type SignerParams = {
|
|
|
190
219
|
/**
|
|
191
220
|
* The parameters for calling executing a runtime call transaction.
|
|
192
221
|
*/
|
|
193
|
-
type CallParams = {
|
|
194
|
-
|
|
195
|
-
* The transaction details to use for the call.
|
|
196
|
-
* @deprecated This will be removed soon to remove Sovereign SDK specific types.
|
|
197
|
-
* In favor of a looser type specification.
|
|
198
|
-
*/
|
|
199
|
-
txDetails?: TxDetails;
|
|
200
|
-
} & SignerParams;
|
|
201
|
-
/**
|
|
202
|
-
* The parameters for simulating a runtime call transaction.
|
|
203
|
-
*/
|
|
204
|
-
type SimulateParams = {
|
|
205
|
-
/**
|
|
206
|
-
* The transaction details to use for the simulation.
|
|
207
|
-
* @deprecated This will be removed soon to remove Sovereign SDK specific types.
|
|
208
|
-
* In favor of a looser type specification.
|
|
209
|
-
*/
|
|
210
|
-
txDetails: TxDetails;
|
|
222
|
+
type CallParams<S extends BaseTypeSpec> = {
|
|
223
|
+
overrides?: DeepPartial<S["UnsignedTransaction"]>;
|
|
211
224
|
} & SignerParams;
|
|
212
225
|
/**
|
|
213
|
-
*
|
|
226
|
+
* A generic rollup client.
|
|
214
227
|
*
|
|
215
|
-
* @template
|
|
228
|
+
* @template S - The type specification for the rollup.
|
|
216
229
|
* If not provided, the base type specification will be used which uses `any` for all types.
|
|
230
|
+
* @template C - The context for the rollup.
|
|
217
231
|
*/
|
|
218
|
-
declare class
|
|
232
|
+
declare class Rollup<S extends BaseTypeSpec, C extends RollupContext> {
|
|
219
233
|
private readonly _config;
|
|
220
234
|
private readonly _client;
|
|
221
235
|
private readonly _serializer;
|
|
236
|
+
private readonly _typeBuilder;
|
|
222
237
|
/**
|
|
223
238
|
* Creates a new rollup client.
|
|
224
239
|
*
|
|
240
|
+
* @throws {@link InvalidRollupConfigError} - If no schema or serializer is provided.
|
|
241
|
+
*
|
|
225
242
|
* @param config - The configuration for the rollup client.
|
|
243
|
+
* @param typeBuilder - The type builder for the rollup.
|
|
226
244
|
*/
|
|
227
|
-
constructor(config: RollupConfig);
|
|
245
|
+
constructor(config: RollupConfig<C>, typeBuilder: TypeBuilder<S, C>);
|
|
246
|
+
/**
|
|
247
|
+
* Retrieve dedup information about the provided address.
|
|
248
|
+
*
|
|
249
|
+
* @param address - The public key to dedup.
|
|
250
|
+
*/
|
|
251
|
+
dedup(address: Uint8Array): Promise<S["Dedup"]>;
|
|
228
252
|
/**
|
|
229
253
|
* Submits a transaction to the rollup.
|
|
230
254
|
*
|
|
231
255
|
* @param transaction - The transaction to submit.
|
|
232
256
|
*/
|
|
233
|
-
submitTransaction(transaction:
|
|
257
|
+
submitTransaction(transaction: S["Transaction"]): Promise<SovereignClient__default.Sequencer.TxCreateResponse>;
|
|
234
258
|
/**
|
|
235
259
|
* Signs and submits a transaction to the rollup.
|
|
236
260
|
* Utilizes the provided signer to sign the transaction.
|
|
237
261
|
*
|
|
238
262
|
* @param unsignedTx - The unsigned transaction to sign and submit.
|
|
263
|
+
* @param {SignerParams} params - The params for signing and submitting the transaction.
|
|
239
264
|
*/
|
|
240
|
-
signAndSubmitTransaction(unsignedTx:
|
|
265
|
+
signAndSubmitTransaction(unsignedTx: S["UnsignedTransaction"], { signer }: SignerParams): Promise<TransactionResult<S["Transaction"]>>;
|
|
241
266
|
/**
|
|
242
267
|
* Performs a runtime call transaction.
|
|
243
268
|
* Utilizes the provided signer to sign the transaction.
|
|
244
269
|
*
|
|
245
|
-
* @param
|
|
270
|
+
* @param runtimeCall - The runtime message to call.
|
|
271
|
+
* @param {CallParams<S>} params - The params for submitting a runtime call transaction.
|
|
246
272
|
*/
|
|
247
|
-
call(
|
|
248
|
-
/**
|
|
249
|
-
* Simulates a runtime call transaction.
|
|
250
|
-
*
|
|
251
|
-
* This method can be useful to estimate the gas cost of a runtime call transaction.
|
|
252
|
-
*
|
|
253
|
-
* @param runtimeMessage - The runtime message to call.
|
|
254
|
-
*/
|
|
255
|
-
simulate(runtimeMessage: T["RuntimeCall"], { signer, txDetails }: SimulateParams): Promise<SovereignClient__default.Rollup.SimulateExecutionResponse>;
|
|
273
|
+
call(runtimeCall: S["RuntimeCall"], { signer, overrides }: CallParams<S>): Promise<TransactionResult<S["Transaction"]>>;
|
|
256
274
|
/**
|
|
257
275
|
* A ledger client that can be used to query the ledger.
|
|
258
276
|
*/
|
|
@@ -277,13 +295,73 @@ declare class StandardRollup<T extends BaseTypeSpec = BaseTypeSpec> {
|
|
|
277
295
|
* See {@link RollupSerializer} for more information.
|
|
278
296
|
*/
|
|
279
297
|
get serializer(): RollupSerializer;
|
|
298
|
+
/**
|
|
299
|
+
* The context for the rollup.
|
|
300
|
+
*/
|
|
301
|
+
get context(): C;
|
|
280
302
|
}
|
|
281
303
|
|
|
304
|
+
type TxDetails = {
|
|
305
|
+
max_priority_fee_bips: number;
|
|
306
|
+
max_fee: number;
|
|
307
|
+
gas_limit?: number[];
|
|
308
|
+
chain_id: number;
|
|
309
|
+
};
|
|
310
|
+
type UnsignedTransaction = {
|
|
311
|
+
runtime_msg: Uint8Array;
|
|
312
|
+
nonce: number;
|
|
313
|
+
details: TxDetails;
|
|
314
|
+
};
|
|
315
|
+
type Transaction = {
|
|
316
|
+
pub_key: {
|
|
317
|
+
pub_key: Uint8Array;
|
|
318
|
+
};
|
|
319
|
+
signature: {
|
|
320
|
+
msg_sig: Uint8Array;
|
|
321
|
+
};
|
|
322
|
+
} & UnsignedTransaction;
|
|
323
|
+
type Dedup = {
|
|
324
|
+
nonce: number;
|
|
325
|
+
};
|
|
326
|
+
type StandardRollupContext = {
|
|
327
|
+
defaultTxDetails: TxDetails;
|
|
328
|
+
};
|
|
329
|
+
type StandardRollupSpec<RuntimeCall> = {
|
|
330
|
+
UnsignedTransaction: UnsignedTransaction;
|
|
331
|
+
Transaction: Transaction;
|
|
332
|
+
RuntimeCall: RuntimeCall;
|
|
333
|
+
Dedup: Dedup;
|
|
334
|
+
};
|
|
335
|
+
declare function standardTypeBuilder<S extends StandardRollupSpec<unknown>>(): TypeBuilder<S, StandardRollupContext>;
|
|
336
|
+
/**
|
|
337
|
+
* The parameters for simulating a runtime call transaction.
|
|
338
|
+
*/
|
|
339
|
+
type SimulateParams = {
|
|
340
|
+
/**
|
|
341
|
+
* The transaction details to use for the simulation.
|
|
342
|
+
*/
|
|
343
|
+
txDetails: TxDetails;
|
|
344
|
+
nonce?: number;
|
|
345
|
+
} & SignerParams;
|
|
346
|
+
declare class StandardRollup<RuntimeCall> extends Rollup<StandardRollupSpec<RuntimeCall>, StandardRollupContext> {
|
|
347
|
+
/**
|
|
348
|
+
* Simulates a runtime call transaction.
|
|
349
|
+
*
|
|
350
|
+
* This method can be useful to estimate the gas cost of a runtime call transaction.
|
|
351
|
+
*
|
|
352
|
+
* @param runtimeMessage - The runtime message to call.
|
|
353
|
+
*/
|
|
354
|
+
simulate(runtimeMessage: StandardRollupSpec<RuntimeCall>["RuntimeCall"], { signer, txDetails, nonce: overrideNonce }: SimulateParams): Promise<SovereignClient__default.Rollup.SimulateExecutionResponse>;
|
|
355
|
+
}
|
|
356
|
+
declare function createStandardRollup<RuntimeCall, C extends StandardRollupContext = StandardRollupContext>(config: RollupConfig<C>, typeBuilderOverrides?: Partial<TypeBuilder<StandardRollupSpec<RuntimeCall>, C>>): StandardRollup<RuntimeCall>;
|
|
357
|
+
|
|
282
358
|
/**
|
|
283
359
|
* Base error class for Sovereign SDK Web3.
|
|
284
360
|
*/
|
|
285
361
|
declare class SovereignError extends Error {
|
|
286
362
|
constructor(message: string);
|
|
287
363
|
}
|
|
364
|
+
declare class InvalidRollupConfigError extends SovereignError {
|
|
365
|
+
}
|
|
288
366
|
|
|
289
|
-
export { type BaseTypeSpec, type CallParams, type RollupConfig, type RollupSchema, type RollupSerializer, type RollupTypeSpec, type SignerParams, type SimulateParams, SovereignError, StandardRollup, type TransactionResult, createSerializer };
|
|
367
|
+
export { type BaseTypeSpec, type CallParams, type Dedup, InvalidRollupConfigError, Rollup, type RollupConfig, type RollupContext, type RollupSchema, type RollupSerializer, type RollupTypeSpec, type SignerParams, type SimulateParams, SovereignError, StandardRollup, type StandardRollupContext, type StandardRollupSpec, type Transaction, type TransactionContext, type TransactionResult, type TxDetails, type TypeBuilder, type UnsignedTransaction, type UnsignedTransactionContext, createSerializer, createStandardRollup, standardTypeBuilder };
|
package/dist/index.d.ts
CHANGED
|
@@ -86,6 +86,10 @@ type BaseTypeSpec = {
|
|
|
86
86
|
* The type of runtime call used in the rollup.
|
|
87
87
|
*/
|
|
88
88
|
RuntimeCall: any;
|
|
89
|
+
/**
|
|
90
|
+
* The type of the dedup data used to deduplicate transactions.
|
|
91
|
+
*/
|
|
92
|
+
Dedup: any;
|
|
89
93
|
};
|
|
90
94
|
type OverrideType<Base, Override> = {
|
|
91
95
|
[K in keyof Base]: K extends keyof Override ? Override[K] : Base[K];
|
|
@@ -137,46 +141,71 @@ type OverrideType<Base, Override> = {
|
|
|
137
141
|
*/
|
|
138
142
|
type RollupTypeSpec<T extends Partial<BaseTypeSpec>> = OverrideType<BaseTypeSpec, T>;
|
|
139
143
|
|
|
144
|
+
type DeepPartial<T> = T extends unknown[] ? T : T extends Record<string, unknown> ? {
|
|
145
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
146
|
+
} : T;
|
|
147
|
+
|
|
148
|
+
type UnsignedTransactionContext<S extends BaseTypeSpec, C extends RollupContext> = {
|
|
149
|
+
runtimeCall: S["RuntimeCall"];
|
|
150
|
+
sender: Uint8Array;
|
|
151
|
+
overrides: DeepPartial<S["UnsignedTransaction"]>;
|
|
152
|
+
rollup: Rollup<S, C>;
|
|
153
|
+
};
|
|
154
|
+
type TransactionContext<S extends BaseTypeSpec, C extends RollupContext> = {
|
|
155
|
+
unsignedTx: S["UnsignedTransaction"];
|
|
156
|
+
sender: Uint8Array;
|
|
157
|
+
signature: Uint8Array;
|
|
158
|
+
rollup: Rollup<S, C>;
|
|
159
|
+
};
|
|
160
|
+
type TypeBuilder<S extends BaseTypeSpec, C extends RollupContext> = {
|
|
161
|
+
unsignedTransaction: (context: UnsignedTransactionContext<S, C>) => Promise<S["UnsignedTransaction"]>;
|
|
162
|
+
transaction: (context: TransactionContext<S, C>) => Promise<S["Transaction"]>;
|
|
163
|
+
};
|
|
140
164
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @template Tx The type of the transaction
|
|
165
|
+
* Arbitrary context that is associated with the rollup.
|
|
144
166
|
*/
|
|
145
|
-
type
|
|
146
|
-
/**
|
|
147
|
-
* The response from the sequencer.
|
|
148
|
-
*/
|
|
149
|
-
response: SovereignClient__default.Sequencer.TxCreateResponse;
|
|
150
|
-
/**
|
|
151
|
-
* The transaction that was submitted.
|
|
152
|
-
*/
|
|
153
|
-
transaction: Tx;
|
|
154
|
-
};
|
|
167
|
+
type RollupContext = Record<string, unknown>;
|
|
155
168
|
/**
|
|
156
169
|
* The configuration for a rollup client.
|
|
157
170
|
*/
|
|
158
|
-
type RollupConfig = {
|
|
171
|
+
type RollupConfig<C extends RollupContext> = {
|
|
159
172
|
/**
|
|
160
173
|
* The base URL of the rollup full node API.
|
|
161
174
|
*/
|
|
162
175
|
url?: string;
|
|
176
|
+
/**
|
|
177
|
+
* The Sovereign SDK client to use for the rollup.
|
|
178
|
+
* If not provided, the default client will be used using {@link RollupConfig.url}.
|
|
179
|
+
*/
|
|
180
|
+
client?: SovereignClient__default;
|
|
163
181
|
/**
|
|
164
182
|
* The schema of the rollup.
|
|
165
183
|
*/
|
|
166
|
-
schema
|
|
184
|
+
schema?: RollupSchema;
|
|
167
185
|
/**
|
|
168
|
-
* The
|
|
169
|
-
*
|
|
170
|
-
* @deprecated
|
|
171
|
-
* @private
|
|
186
|
+
* The serializer to use for the rollup.
|
|
187
|
+
* If not provided, a serializer will be created using the provided {@link RollupConfig.schema}.
|
|
172
188
|
*/
|
|
173
|
-
|
|
189
|
+
serializer?: RollupSerializer;
|
|
190
|
+
/**
|
|
191
|
+
* Arbitrary context that is associated with the rollup.
|
|
192
|
+
*/
|
|
193
|
+
context: C;
|
|
174
194
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
195
|
+
/**
|
|
196
|
+
* The result of signing and submitting a transaction.
|
|
197
|
+
*
|
|
198
|
+
* @template Tx The type of the transaction
|
|
199
|
+
*/
|
|
200
|
+
type TransactionResult<Tx> = {
|
|
201
|
+
/**
|
|
202
|
+
* The response from the sequencer.
|
|
203
|
+
*/
|
|
204
|
+
response: SovereignClient__default.Sequencer.TxCreateResponse;
|
|
205
|
+
/**
|
|
206
|
+
* The transaction that was submitted.
|
|
207
|
+
*/
|
|
208
|
+
transaction: Tx;
|
|
180
209
|
};
|
|
181
210
|
/**
|
|
182
211
|
* The parameters for signing and submitting a transaction.
|
|
@@ -190,69 +219,58 @@ type SignerParams = {
|
|
|
190
219
|
/**
|
|
191
220
|
* The parameters for calling executing a runtime call transaction.
|
|
192
221
|
*/
|
|
193
|
-
type CallParams = {
|
|
194
|
-
|
|
195
|
-
* The transaction details to use for the call.
|
|
196
|
-
* @deprecated This will be removed soon to remove Sovereign SDK specific types.
|
|
197
|
-
* In favor of a looser type specification.
|
|
198
|
-
*/
|
|
199
|
-
txDetails?: TxDetails;
|
|
200
|
-
} & SignerParams;
|
|
201
|
-
/**
|
|
202
|
-
* The parameters for simulating a runtime call transaction.
|
|
203
|
-
*/
|
|
204
|
-
type SimulateParams = {
|
|
205
|
-
/**
|
|
206
|
-
* The transaction details to use for the simulation.
|
|
207
|
-
* @deprecated This will be removed soon to remove Sovereign SDK specific types.
|
|
208
|
-
* In favor of a looser type specification.
|
|
209
|
-
*/
|
|
210
|
-
txDetails: TxDetails;
|
|
222
|
+
type CallParams<S extends BaseTypeSpec> = {
|
|
223
|
+
overrides?: DeepPartial<S["UnsignedTransaction"]>;
|
|
211
224
|
} & SignerParams;
|
|
212
225
|
/**
|
|
213
|
-
*
|
|
226
|
+
* A generic rollup client.
|
|
214
227
|
*
|
|
215
|
-
* @template
|
|
228
|
+
* @template S - The type specification for the rollup.
|
|
216
229
|
* If not provided, the base type specification will be used which uses `any` for all types.
|
|
230
|
+
* @template C - The context for the rollup.
|
|
217
231
|
*/
|
|
218
|
-
declare class
|
|
232
|
+
declare class Rollup<S extends BaseTypeSpec, C extends RollupContext> {
|
|
219
233
|
private readonly _config;
|
|
220
234
|
private readonly _client;
|
|
221
235
|
private readonly _serializer;
|
|
236
|
+
private readonly _typeBuilder;
|
|
222
237
|
/**
|
|
223
238
|
* Creates a new rollup client.
|
|
224
239
|
*
|
|
240
|
+
* @throws {@link InvalidRollupConfigError} - If no schema or serializer is provided.
|
|
241
|
+
*
|
|
225
242
|
* @param config - The configuration for the rollup client.
|
|
243
|
+
* @param typeBuilder - The type builder for the rollup.
|
|
226
244
|
*/
|
|
227
|
-
constructor(config: RollupConfig);
|
|
245
|
+
constructor(config: RollupConfig<C>, typeBuilder: TypeBuilder<S, C>);
|
|
246
|
+
/**
|
|
247
|
+
* Retrieve dedup information about the provided address.
|
|
248
|
+
*
|
|
249
|
+
* @param address - The public key to dedup.
|
|
250
|
+
*/
|
|
251
|
+
dedup(address: Uint8Array): Promise<S["Dedup"]>;
|
|
228
252
|
/**
|
|
229
253
|
* Submits a transaction to the rollup.
|
|
230
254
|
*
|
|
231
255
|
* @param transaction - The transaction to submit.
|
|
232
256
|
*/
|
|
233
|
-
submitTransaction(transaction:
|
|
257
|
+
submitTransaction(transaction: S["Transaction"]): Promise<SovereignClient__default.Sequencer.TxCreateResponse>;
|
|
234
258
|
/**
|
|
235
259
|
* Signs and submits a transaction to the rollup.
|
|
236
260
|
* Utilizes the provided signer to sign the transaction.
|
|
237
261
|
*
|
|
238
262
|
* @param unsignedTx - The unsigned transaction to sign and submit.
|
|
263
|
+
* @param {SignerParams} params - The params for signing and submitting the transaction.
|
|
239
264
|
*/
|
|
240
|
-
signAndSubmitTransaction(unsignedTx:
|
|
265
|
+
signAndSubmitTransaction(unsignedTx: S["UnsignedTransaction"], { signer }: SignerParams): Promise<TransactionResult<S["Transaction"]>>;
|
|
241
266
|
/**
|
|
242
267
|
* Performs a runtime call transaction.
|
|
243
268
|
* Utilizes the provided signer to sign the transaction.
|
|
244
269
|
*
|
|
245
|
-
* @param
|
|
270
|
+
* @param runtimeCall - The runtime message to call.
|
|
271
|
+
* @param {CallParams<S>} params - The params for submitting a runtime call transaction.
|
|
246
272
|
*/
|
|
247
|
-
call(
|
|
248
|
-
/**
|
|
249
|
-
* Simulates a runtime call transaction.
|
|
250
|
-
*
|
|
251
|
-
* This method can be useful to estimate the gas cost of a runtime call transaction.
|
|
252
|
-
*
|
|
253
|
-
* @param runtimeMessage - The runtime message to call.
|
|
254
|
-
*/
|
|
255
|
-
simulate(runtimeMessage: T["RuntimeCall"], { signer, txDetails }: SimulateParams): Promise<SovereignClient__default.Rollup.SimulateExecutionResponse>;
|
|
273
|
+
call(runtimeCall: S["RuntimeCall"], { signer, overrides }: CallParams<S>): Promise<TransactionResult<S["Transaction"]>>;
|
|
256
274
|
/**
|
|
257
275
|
* A ledger client that can be used to query the ledger.
|
|
258
276
|
*/
|
|
@@ -277,13 +295,73 @@ declare class StandardRollup<T extends BaseTypeSpec = BaseTypeSpec> {
|
|
|
277
295
|
* See {@link RollupSerializer} for more information.
|
|
278
296
|
*/
|
|
279
297
|
get serializer(): RollupSerializer;
|
|
298
|
+
/**
|
|
299
|
+
* The context for the rollup.
|
|
300
|
+
*/
|
|
301
|
+
get context(): C;
|
|
280
302
|
}
|
|
281
303
|
|
|
304
|
+
type TxDetails = {
|
|
305
|
+
max_priority_fee_bips: number;
|
|
306
|
+
max_fee: number;
|
|
307
|
+
gas_limit?: number[];
|
|
308
|
+
chain_id: number;
|
|
309
|
+
};
|
|
310
|
+
type UnsignedTransaction = {
|
|
311
|
+
runtime_msg: Uint8Array;
|
|
312
|
+
nonce: number;
|
|
313
|
+
details: TxDetails;
|
|
314
|
+
};
|
|
315
|
+
type Transaction = {
|
|
316
|
+
pub_key: {
|
|
317
|
+
pub_key: Uint8Array;
|
|
318
|
+
};
|
|
319
|
+
signature: {
|
|
320
|
+
msg_sig: Uint8Array;
|
|
321
|
+
};
|
|
322
|
+
} & UnsignedTransaction;
|
|
323
|
+
type Dedup = {
|
|
324
|
+
nonce: number;
|
|
325
|
+
};
|
|
326
|
+
type StandardRollupContext = {
|
|
327
|
+
defaultTxDetails: TxDetails;
|
|
328
|
+
};
|
|
329
|
+
type StandardRollupSpec<RuntimeCall> = {
|
|
330
|
+
UnsignedTransaction: UnsignedTransaction;
|
|
331
|
+
Transaction: Transaction;
|
|
332
|
+
RuntimeCall: RuntimeCall;
|
|
333
|
+
Dedup: Dedup;
|
|
334
|
+
};
|
|
335
|
+
declare function standardTypeBuilder<S extends StandardRollupSpec<unknown>>(): TypeBuilder<S, StandardRollupContext>;
|
|
336
|
+
/**
|
|
337
|
+
* The parameters for simulating a runtime call transaction.
|
|
338
|
+
*/
|
|
339
|
+
type SimulateParams = {
|
|
340
|
+
/**
|
|
341
|
+
* The transaction details to use for the simulation.
|
|
342
|
+
*/
|
|
343
|
+
txDetails: TxDetails;
|
|
344
|
+
nonce?: number;
|
|
345
|
+
} & SignerParams;
|
|
346
|
+
declare class StandardRollup<RuntimeCall> extends Rollup<StandardRollupSpec<RuntimeCall>, StandardRollupContext> {
|
|
347
|
+
/**
|
|
348
|
+
* Simulates a runtime call transaction.
|
|
349
|
+
*
|
|
350
|
+
* This method can be useful to estimate the gas cost of a runtime call transaction.
|
|
351
|
+
*
|
|
352
|
+
* @param runtimeMessage - The runtime message to call.
|
|
353
|
+
*/
|
|
354
|
+
simulate(runtimeMessage: StandardRollupSpec<RuntimeCall>["RuntimeCall"], { signer, txDetails, nonce: overrideNonce }: SimulateParams): Promise<SovereignClient__default.Rollup.SimulateExecutionResponse>;
|
|
355
|
+
}
|
|
356
|
+
declare function createStandardRollup<RuntimeCall, C extends StandardRollupContext = StandardRollupContext>(config: RollupConfig<C>, typeBuilderOverrides?: Partial<TypeBuilder<StandardRollupSpec<RuntimeCall>, C>>): StandardRollup<RuntimeCall>;
|
|
357
|
+
|
|
282
358
|
/**
|
|
283
359
|
* Base error class for Sovereign SDK Web3.
|
|
284
360
|
*/
|
|
285
361
|
declare class SovereignError extends Error {
|
|
286
362
|
constructor(message: string);
|
|
287
363
|
}
|
|
364
|
+
declare class InvalidRollupConfigError extends SovereignError {
|
|
365
|
+
}
|
|
288
366
|
|
|
289
|
-
export { type BaseTypeSpec, type CallParams, type RollupConfig, type RollupSchema, type RollupSerializer, type RollupTypeSpec, type SignerParams, type SimulateParams, SovereignError, StandardRollup, type TransactionResult, createSerializer };
|
|
367
|
+
export { type BaseTypeSpec, type CallParams, type Dedup, InvalidRollupConfigError, Rollup, type RollupConfig, type RollupContext, type RollupSchema, type RollupSerializer, type RollupTypeSpec, type SignerParams, type SimulateParams, SovereignError, StandardRollup, type StandardRollupContext, type StandardRollupSpec, type Transaction, type TransactionContext, type TransactionResult, type TxDetails, type TypeBuilder, type UnsignedTransaction, type UnsignedTransactionContext, createSerializer, createStandardRollup, standardTypeBuilder };
|