@sovereign-sdk/web3 0.0.13 → 0.0.14
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 +144 -60
- package/dist/index.d.ts +144 -60
- package/dist/index.js +179 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -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,64 @@ 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;
|
|
222
|
+
type CallParams<S extends BaseTypeSpec> = {
|
|
223
|
+
overrides?: DeepPartial<S["UnsignedTransaction"]>;
|
|
200
224
|
} & SignerParams;
|
|
201
225
|
/**
|
|
202
|
-
*
|
|
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;
|
|
211
|
-
} & SignerParams;
|
|
212
|
-
/**
|
|
213
|
-
* The rollup client.
|
|
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.
|
|
244
|
+
*/
|
|
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.
|
|
226
250
|
*/
|
|
227
|
-
|
|
251
|
+
dedup(address: Uint8Array): Promise<S["Dedup"]>;
|
|
252
|
+
/**
|
|
253
|
+
* Submits a batch to the rollup.
|
|
254
|
+
*
|
|
255
|
+
* @param batch - The batch of transactions to submit.
|
|
256
|
+
*/
|
|
257
|
+
submitBatch(batch: S["Transaction"][]): Promise<SovereignClient__default.Sequencer.BatchCreateResponse>;
|
|
228
258
|
/**
|
|
229
259
|
* Submits a transaction to the rollup.
|
|
230
260
|
*
|
|
231
261
|
* @param transaction - The transaction to submit.
|
|
232
262
|
*/
|
|
233
|
-
submitTransaction(transaction:
|
|
263
|
+
submitTransaction(transaction: S["Transaction"]): Promise<SovereignClient__default.Sequencer.TxCreateResponse>;
|
|
234
264
|
/**
|
|
235
265
|
* Signs and submits a transaction to the rollup.
|
|
236
266
|
* Utilizes the provided signer to sign the transaction.
|
|
237
267
|
*
|
|
238
268
|
* @param unsignedTx - The unsigned transaction to sign and submit.
|
|
269
|
+
* @param {SignerParams} params - The params for signing and submitting the transaction.
|
|
239
270
|
*/
|
|
240
|
-
signAndSubmitTransaction(unsignedTx:
|
|
271
|
+
signAndSubmitTransaction(unsignedTx: S["UnsignedTransaction"], { signer }: SignerParams): Promise<TransactionResult<S["Transaction"]>>;
|
|
241
272
|
/**
|
|
242
273
|
* Performs a runtime call transaction.
|
|
243
274
|
* Utilizes the provided signer to sign the transaction.
|
|
244
275
|
*
|
|
245
|
-
* @param
|
|
276
|
+
* @param runtimeCall - The runtime message to call.
|
|
277
|
+
* @param {CallParams<S>} params - The params for submitting a runtime call transaction.
|
|
246
278
|
*/
|
|
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>;
|
|
279
|
+
call(runtimeCall: S["RuntimeCall"], { signer, overrides }: CallParams<S>): Promise<TransactionResult<S["Transaction"]>>;
|
|
256
280
|
/**
|
|
257
281
|
* A ledger client that can be used to query the ledger.
|
|
258
282
|
*/
|
|
@@ -277,7 +301,65 @@ declare class StandardRollup<T extends BaseTypeSpec = BaseTypeSpec> {
|
|
|
277
301
|
* See {@link RollupSerializer} for more information.
|
|
278
302
|
*/
|
|
279
303
|
get serializer(): RollupSerializer;
|
|
304
|
+
/**
|
|
305
|
+
* The context for the rollup.
|
|
306
|
+
*/
|
|
307
|
+
get context(): C;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type TxDetails = {
|
|
311
|
+
max_priority_fee_bips: number;
|
|
312
|
+
max_fee: number;
|
|
313
|
+
gas_limit?: number[];
|
|
314
|
+
chain_id: number;
|
|
315
|
+
};
|
|
316
|
+
type UnsignedTransaction = {
|
|
317
|
+
runtime_msg: Uint8Array;
|
|
318
|
+
nonce: number;
|
|
319
|
+
details: TxDetails;
|
|
320
|
+
};
|
|
321
|
+
type Transaction = {
|
|
322
|
+
pub_key: {
|
|
323
|
+
pub_key: Uint8Array;
|
|
324
|
+
};
|
|
325
|
+
signature: {
|
|
326
|
+
msg_sig: Uint8Array;
|
|
327
|
+
};
|
|
328
|
+
} & UnsignedTransaction;
|
|
329
|
+
type Dedup = {
|
|
330
|
+
nonce: number;
|
|
331
|
+
};
|
|
332
|
+
type StandardRollupContext = {
|
|
333
|
+
defaultTxDetails: TxDetails;
|
|
334
|
+
};
|
|
335
|
+
type StandardRollupSpec<RuntimeCall> = {
|
|
336
|
+
UnsignedTransaction: UnsignedTransaction;
|
|
337
|
+
Transaction: Transaction;
|
|
338
|
+
RuntimeCall: RuntimeCall;
|
|
339
|
+
Dedup: Dedup;
|
|
340
|
+
};
|
|
341
|
+
declare function standardTypeBuilder<S extends StandardRollupSpec<unknown>>(): TypeBuilder<S, StandardRollupContext>;
|
|
342
|
+
/**
|
|
343
|
+
* The parameters for simulating a runtime call transaction.
|
|
344
|
+
*/
|
|
345
|
+
type SimulateParams = {
|
|
346
|
+
/**
|
|
347
|
+
* The transaction details to use for the simulation.
|
|
348
|
+
*/
|
|
349
|
+
txDetails: TxDetails;
|
|
350
|
+
nonce?: number;
|
|
351
|
+
} & SignerParams;
|
|
352
|
+
declare class StandardRollup<RuntimeCall> extends Rollup<StandardRollupSpec<RuntimeCall>, StandardRollupContext> {
|
|
353
|
+
/**
|
|
354
|
+
* Simulates a runtime call transaction.
|
|
355
|
+
*
|
|
356
|
+
* This method can be useful to estimate the gas cost of a runtime call transaction.
|
|
357
|
+
*
|
|
358
|
+
* @param runtimeMessage - The runtime message to call.
|
|
359
|
+
*/
|
|
360
|
+
simulate(runtimeMessage: StandardRollupSpec<RuntimeCall>["RuntimeCall"], { signer, txDetails, nonce: overrideNonce }: SimulateParams): Promise<SovereignClient__default.Rollup.SimulateExecutionResponse>;
|
|
280
361
|
}
|
|
362
|
+
declare function createStandardRollup<RuntimeCall, C extends StandardRollupContext = StandardRollupContext>(config: RollupConfig<C>, typeBuilderOverrides?: Partial<TypeBuilder<StandardRollupSpec<RuntimeCall>, C>>): StandardRollup<RuntimeCall>;
|
|
281
363
|
|
|
282
364
|
/**
|
|
283
365
|
* Base error class for Sovereign SDK Web3.
|
|
@@ -285,5 +367,7 @@ declare class StandardRollup<T extends BaseTypeSpec = BaseTypeSpec> {
|
|
|
285
367
|
declare class SovereignError extends Error {
|
|
286
368
|
constructor(message: string);
|
|
287
369
|
}
|
|
370
|
+
declare class InvalidRollupConfigError extends SovereignError {
|
|
371
|
+
}
|
|
288
372
|
|
|
289
|
-
export { type BaseTypeSpec, type CallParams, type RollupConfig, type RollupSchema, type RollupSerializer, type RollupTypeSpec, type SignerParams, type SimulateParams, SovereignError, StandardRollup, type TransactionResult, createSerializer };
|
|
373
|
+
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,64 @@ 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;
|
|
222
|
+
type CallParams<S extends BaseTypeSpec> = {
|
|
223
|
+
overrides?: DeepPartial<S["UnsignedTransaction"]>;
|
|
200
224
|
} & SignerParams;
|
|
201
225
|
/**
|
|
202
|
-
*
|
|
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;
|
|
211
|
-
} & SignerParams;
|
|
212
|
-
/**
|
|
213
|
-
* The rollup client.
|
|
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.
|
|
244
|
+
*/
|
|
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.
|
|
226
250
|
*/
|
|
227
|
-
|
|
251
|
+
dedup(address: Uint8Array): Promise<S["Dedup"]>;
|
|
252
|
+
/**
|
|
253
|
+
* Submits a batch to the rollup.
|
|
254
|
+
*
|
|
255
|
+
* @param batch - The batch of transactions to submit.
|
|
256
|
+
*/
|
|
257
|
+
submitBatch(batch: S["Transaction"][]): Promise<SovereignClient__default.Sequencer.BatchCreateResponse>;
|
|
228
258
|
/**
|
|
229
259
|
* Submits a transaction to the rollup.
|
|
230
260
|
*
|
|
231
261
|
* @param transaction - The transaction to submit.
|
|
232
262
|
*/
|
|
233
|
-
submitTransaction(transaction:
|
|
263
|
+
submitTransaction(transaction: S["Transaction"]): Promise<SovereignClient__default.Sequencer.TxCreateResponse>;
|
|
234
264
|
/**
|
|
235
265
|
* Signs and submits a transaction to the rollup.
|
|
236
266
|
* Utilizes the provided signer to sign the transaction.
|
|
237
267
|
*
|
|
238
268
|
* @param unsignedTx - The unsigned transaction to sign and submit.
|
|
269
|
+
* @param {SignerParams} params - The params for signing and submitting the transaction.
|
|
239
270
|
*/
|
|
240
|
-
signAndSubmitTransaction(unsignedTx:
|
|
271
|
+
signAndSubmitTransaction(unsignedTx: S["UnsignedTransaction"], { signer }: SignerParams): Promise<TransactionResult<S["Transaction"]>>;
|
|
241
272
|
/**
|
|
242
273
|
* Performs a runtime call transaction.
|
|
243
274
|
* Utilizes the provided signer to sign the transaction.
|
|
244
275
|
*
|
|
245
|
-
* @param
|
|
276
|
+
* @param runtimeCall - The runtime message to call.
|
|
277
|
+
* @param {CallParams<S>} params - The params for submitting a runtime call transaction.
|
|
246
278
|
*/
|
|
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>;
|
|
279
|
+
call(runtimeCall: S["RuntimeCall"], { signer, overrides }: CallParams<S>): Promise<TransactionResult<S["Transaction"]>>;
|
|
256
280
|
/**
|
|
257
281
|
* A ledger client that can be used to query the ledger.
|
|
258
282
|
*/
|
|
@@ -277,7 +301,65 @@ declare class StandardRollup<T extends BaseTypeSpec = BaseTypeSpec> {
|
|
|
277
301
|
* See {@link RollupSerializer} for more information.
|
|
278
302
|
*/
|
|
279
303
|
get serializer(): RollupSerializer;
|
|
304
|
+
/**
|
|
305
|
+
* The context for the rollup.
|
|
306
|
+
*/
|
|
307
|
+
get context(): C;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type TxDetails = {
|
|
311
|
+
max_priority_fee_bips: number;
|
|
312
|
+
max_fee: number;
|
|
313
|
+
gas_limit?: number[];
|
|
314
|
+
chain_id: number;
|
|
315
|
+
};
|
|
316
|
+
type UnsignedTransaction = {
|
|
317
|
+
runtime_msg: Uint8Array;
|
|
318
|
+
nonce: number;
|
|
319
|
+
details: TxDetails;
|
|
320
|
+
};
|
|
321
|
+
type Transaction = {
|
|
322
|
+
pub_key: {
|
|
323
|
+
pub_key: Uint8Array;
|
|
324
|
+
};
|
|
325
|
+
signature: {
|
|
326
|
+
msg_sig: Uint8Array;
|
|
327
|
+
};
|
|
328
|
+
} & UnsignedTransaction;
|
|
329
|
+
type Dedup = {
|
|
330
|
+
nonce: number;
|
|
331
|
+
};
|
|
332
|
+
type StandardRollupContext = {
|
|
333
|
+
defaultTxDetails: TxDetails;
|
|
334
|
+
};
|
|
335
|
+
type StandardRollupSpec<RuntimeCall> = {
|
|
336
|
+
UnsignedTransaction: UnsignedTransaction;
|
|
337
|
+
Transaction: Transaction;
|
|
338
|
+
RuntimeCall: RuntimeCall;
|
|
339
|
+
Dedup: Dedup;
|
|
340
|
+
};
|
|
341
|
+
declare function standardTypeBuilder<S extends StandardRollupSpec<unknown>>(): TypeBuilder<S, StandardRollupContext>;
|
|
342
|
+
/**
|
|
343
|
+
* The parameters for simulating a runtime call transaction.
|
|
344
|
+
*/
|
|
345
|
+
type SimulateParams = {
|
|
346
|
+
/**
|
|
347
|
+
* The transaction details to use for the simulation.
|
|
348
|
+
*/
|
|
349
|
+
txDetails: TxDetails;
|
|
350
|
+
nonce?: number;
|
|
351
|
+
} & SignerParams;
|
|
352
|
+
declare class StandardRollup<RuntimeCall> extends Rollup<StandardRollupSpec<RuntimeCall>, StandardRollupContext> {
|
|
353
|
+
/**
|
|
354
|
+
* Simulates a runtime call transaction.
|
|
355
|
+
*
|
|
356
|
+
* This method can be useful to estimate the gas cost of a runtime call transaction.
|
|
357
|
+
*
|
|
358
|
+
* @param runtimeMessage - The runtime message to call.
|
|
359
|
+
*/
|
|
360
|
+
simulate(runtimeMessage: StandardRollupSpec<RuntimeCall>["RuntimeCall"], { signer, txDetails, nonce: overrideNonce }: SimulateParams): Promise<SovereignClient__default.Rollup.SimulateExecutionResponse>;
|
|
280
361
|
}
|
|
362
|
+
declare function createStandardRollup<RuntimeCall, C extends StandardRollupContext = StandardRollupContext>(config: RollupConfig<C>, typeBuilderOverrides?: Partial<TypeBuilder<StandardRollupSpec<RuntimeCall>, C>>): StandardRollup<RuntimeCall>;
|
|
281
363
|
|
|
282
364
|
/**
|
|
283
365
|
* Base error class for Sovereign SDK Web3.
|
|
@@ -285,5 +367,7 @@ declare class StandardRollup<T extends BaseTypeSpec = BaseTypeSpec> {
|
|
|
285
367
|
declare class SovereignError extends Error {
|
|
286
368
|
constructor(message: string);
|
|
287
369
|
}
|
|
370
|
+
declare class InvalidRollupConfigError extends SovereignError {
|
|
371
|
+
}
|
|
288
372
|
|
|
289
|
-
export { type BaseTypeSpec, type CallParams, type RollupConfig, type RollupSchema, type RollupSerializer, type RollupTypeSpec, type SignerParams, type SimulateParams, SovereignError, StandardRollup, type TransactionResult, createSerializer };
|
|
373
|
+
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 };
|