@aztec/ethereum 3.0.0-canary.a9708bd → 3.0.0-devnet.3

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.
Files changed (144) hide show
  1. package/dest/client.d.ts +1 -1
  2. package/dest/client.d.ts.map +1 -1
  3. package/dest/config.d.ts +11 -6
  4. package/dest/config.d.ts.map +1 -1
  5. package/dest/config.js +124 -64
  6. package/dest/contracts/empire_base.d.ts +1 -1
  7. package/dest/contracts/empire_base.d.ts.map +1 -1
  8. package/dest/contracts/empire_slashing_proposer.d.ts +2 -2
  9. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
  10. package/dest/contracts/empire_slashing_proposer.js +1 -1
  11. package/dest/contracts/fee_asset_handler.d.ts +3 -3
  12. package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
  13. package/dest/contracts/governance.js +7 -3
  14. package/dest/contracts/governance_proposer.d.ts +1 -2
  15. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  16. package/dest/contracts/governance_proposer.js +1 -2
  17. package/dest/contracts/multicall.d.ts +3 -5
  18. package/dest/contracts/multicall.d.ts.map +1 -1
  19. package/dest/contracts/multicall.js +6 -4
  20. package/dest/contracts/rollup.d.ts +39 -19
  21. package/dest/contracts/rollup.d.ts.map +1 -1
  22. package/dest/contracts/rollup.js +84 -88
  23. package/dest/contracts/slasher_contract.d.ts +10 -0
  24. package/dest/contracts/slasher_contract.d.ts.map +1 -1
  25. package/dest/contracts/slasher_contract.js +18 -0
  26. package/dest/contracts/tally_slashing_proposer.d.ts +22 -3
  27. package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
  28. package/dest/contracts/tally_slashing_proposer.js +55 -5
  29. package/dest/deploy_l1_contracts.d.ts +22 -7
  30. package/dest/deploy_l1_contracts.d.ts.map +1 -1
  31. package/dest/deploy_l1_contracts.js +555 -362
  32. package/dest/index.d.ts +1 -1
  33. package/dest/index.d.ts.map +1 -1
  34. package/dest/index.js +1 -1
  35. package/dest/l1_artifacts.d.ts +8729 -6014
  36. package/dest/l1_artifacts.d.ts.map +1 -1
  37. package/dest/l1_artifacts.js +10 -5
  38. package/dest/l1_contract_addresses.d.ts +5 -1
  39. package/dest/l1_contract_addresses.d.ts.map +1 -1
  40. package/dest/l1_contract_addresses.js +16 -26
  41. package/dest/l1_reader.d.ts +1 -1
  42. package/dest/l1_reader.d.ts.map +1 -1
  43. package/dest/l1_reader.js +8 -8
  44. package/dest/l1_tx_utils/config.d.ts +59 -0
  45. package/dest/l1_tx_utils/config.d.ts.map +1 -0
  46. package/dest/l1_tx_utils/config.js +73 -0
  47. package/dest/l1_tx_utils/constants.d.ts +6 -0
  48. package/dest/l1_tx_utils/constants.d.ts.map +1 -0
  49. package/dest/l1_tx_utils/constants.js +14 -0
  50. package/dest/l1_tx_utils/factory.d.ts +24 -0
  51. package/dest/l1_tx_utils/factory.d.ts.map +1 -0
  52. package/dest/l1_tx_utils/factory.js +12 -0
  53. package/dest/l1_tx_utils/index.d.ts +10 -0
  54. package/dest/l1_tx_utils/index.d.ts.map +1 -0
  55. package/dest/l1_tx_utils/index.js +10 -0
  56. package/dest/l1_tx_utils/interfaces.d.ts +76 -0
  57. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
  58. package/dest/l1_tx_utils/interfaces.js +4 -0
  59. package/dest/l1_tx_utils/l1_tx_utils.d.ts +95 -0
  60. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
  61. package/dest/l1_tx_utils/l1_tx_utils.js +610 -0
  62. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
  63. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
  64. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
  65. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +81 -0
  66. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
  67. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +294 -0
  68. package/dest/l1_tx_utils/signer.d.ts +4 -0
  69. package/dest/l1_tx_utils/signer.d.ts.map +1 -0
  70. package/dest/l1_tx_utils/signer.js +16 -0
  71. package/dest/l1_tx_utils/types.d.ts +67 -0
  72. package/dest/l1_tx_utils/types.d.ts.map +1 -0
  73. package/dest/l1_tx_utils/types.js +26 -0
  74. package/dest/l1_tx_utils/utils.d.ts +4 -0
  75. package/dest/l1_tx_utils/utils.d.ts.map +1 -0
  76. package/dest/l1_tx_utils/utils.js +14 -0
  77. package/dest/publisher_manager.d.ts +7 -2
  78. package/dest/publisher_manager.d.ts.map +1 -1
  79. package/dest/publisher_manager.js +36 -8
  80. package/dest/queries.d.ts.map +1 -1
  81. package/dest/queries.js +11 -12
  82. package/dest/test/chain_monitor.d.ts +11 -0
  83. package/dest/test/chain_monitor.d.ts.map +1 -1
  84. package/dest/test/chain_monitor.js +81 -12
  85. package/dest/test/delayed_tx_utils.d.ts +2 -2
  86. package/dest/test/delayed_tx_utils.d.ts.map +1 -1
  87. package/dest/test/delayed_tx_utils.js +2 -2
  88. package/dest/test/eth_cheat_codes.d.ts +32 -6
  89. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  90. package/dest/test/eth_cheat_codes.js +115 -28
  91. package/dest/test/rollup_cheat_codes.d.ts +11 -9
  92. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  93. package/dest/test/rollup_cheat_codes.js +38 -6
  94. package/dest/test/upgrade_utils.d.ts.map +1 -1
  95. package/dest/test/upgrade_utils.js +3 -2
  96. package/dest/utils.d.ts.map +1 -1
  97. package/dest/utils.js +10 -161
  98. package/dest/zkPassportVerifierAddress.js +1 -1
  99. package/package.json +7 -7
  100. package/src/client.ts +1 -1
  101. package/src/config.ts +136 -68
  102. package/src/contracts/empire_base.ts +1 -1
  103. package/src/contracts/empire_slashing_proposer.ts +7 -3
  104. package/src/contracts/fee_asset_handler.ts +1 -1
  105. package/src/contracts/governance.ts +3 -3
  106. package/src/contracts/governance_proposer.ts +3 -4
  107. package/src/contracts/multicall.ts +12 -10
  108. package/src/contracts/rollup.ts +104 -106
  109. package/src/contracts/slasher_contract.ts +22 -0
  110. package/src/contracts/tally_slashing_proposer.ts +54 -6
  111. package/src/deploy_l1_contracts.ts +570 -328
  112. package/src/index.ts +1 -1
  113. package/src/l1_artifacts.ts +14 -6
  114. package/src/l1_contract_addresses.ts +17 -26
  115. package/src/l1_reader.ts +9 -9
  116. package/src/l1_tx_utils/README.md +177 -0
  117. package/src/l1_tx_utils/config.ts +140 -0
  118. package/src/l1_tx_utils/constants.ts +18 -0
  119. package/src/l1_tx_utils/factory.ts +64 -0
  120. package/src/l1_tx_utils/index.ts +12 -0
  121. package/src/l1_tx_utils/interfaces.ts +86 -0
  122. package/src/l1_tx_utils/l1_tx_utils.ts +718 -0
  123. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
  124. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +372 -0
  125. package/src/l1_tx_utils/signer.ts +28 -0
  126. package/src/l1_tx_utils/types.ts +85 -0
  127. package/src/l1_tx_utils/utils.ts +16 -0
  128. package/src/publisher_manager.ts +51 -9
  129. package/src/queries.ts +13 -8
  130. package/src/test/chain_monitor.ts +89 -9
  131. package/src/test/delayed_tx_utils.ts +2 -2
  132. package/src/test/eth_cheat_codes.ts +142 -29
  133. package/src/test/rollup_cheat_codes.ts +54 -14
  134. package/src/test/upgrade_utils.ts +3 -2
  135. package/src/utils.ts +13 -185
  136. package/src/zkPassportVerifierAddress.ts +1 -1
  137. package/dest/l1_tx_utils.d.ts +0 -250
  138. package/dest/l1_tx_utils.d.ts.map +0 -1
  139. package/dest/l1_tx_utils.js +0 -826
  140. package/dest/l1_tx_utils_with_blobs.d.ts +0 -19
  141. package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
  142. package/dest/l1_tx_utils_with_blobs.js +0 -85
  143. package/src/l1_tx_utils.ts +0 -1105
  144. package/src/l1_tx_utils_with_blobs.ts +0 -144
@@ -1,4 +1,5 @@
1
1
  import type { Logger } from '@aztec/foundation/log';
2
+ import { DateProvider } from '@aztec/foundation/timer';
2
3
  import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
3
4
  import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
4
5
 
@@ -6,7 +7,7 @@ import { type GetContractReturnType, type PrivateKeyAccount, getContract } from
6
7
 
7
8
  import { extractProposalIdFromLogs } from '../contracts/governance.js';
8
9
  import type { L1ContractAddresses } from '../l1_contract_addresses.js';
9
- import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils.js';
10
+ import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils/index.js';
10
11
  import type { ExtendedViemWalletClient, ViemPublicClient } from '../types.js';
11
12
  import { EthCheatCodes } from './eth_cheat_codes.js';
12
13
 
@@ -30,7 +31,7 @@ export async function executeGovernanceProposal(
30
31
  });
31
32
  };
32
33
 
33
- const cheatCodes = new EthCheatCodes(rpcUrls, logger);
34
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), logger);
34
35
 
35
36
  const timeToActive = proposal.creation + proposal.config.votingDelay;
36
37
  logger.info(`Warping to ${timeToActive + 1n}`);
package/src/utils.ts CHANGED
@@ -181,41 +181,19 @@ export function formatViemError(error: any, abi: Abi = ErrorsAbi): FormattedViem
181
181
  return new FormattedViemError(error.message, (error as any)?.metaMessages);
182
182
  }
183
183
 
184
- // Extract the actual error message and highlight it for clarity
185
- let formattedRes = extractAndFormatRequestBody(error?.message || String(error));
186
-
187
- let errorDetail = '';
188
- // Look for specific details in known locations
189
- if (error) {
190
- // Check for details property which often has the most specific error message
191
- if (typeof error.details === 'string' && error.details) {
192
- errorDetail = error.details;
193
- }
194
- // Check for shortMessage which is often available in Viem errors
195
- else if (typeof error.shortMessage === 'string' && error.shortMessage) {
196
- errorDetail = error.shortMessage;
197
- }
198
- }
199
-
200
- // If we found a specific error detail, format it clearly
201
- if (errorDetail) {
202
- // Look for key sections of the formatted result to replace with highlighted error
203
- let replaced = false;
204
-
205
- // Try to find the Details: section
206
- const detailsMatch = formattedRes.match(/Details: ([^\n]+)/);
207
- if (detailsMatch) {
208
- formattedRes = formattedRes.replace(detailsMatch[0], `Details: *${errorDetail}*`);
209
- replaced = true;
210
- }
211
-
212
- // If we didn't find a Details section, add the error at the beginning
213
- if (!replaced) {
214
- formattedRes = `Error: *${errorDetail}*\n\n${formattedRes}`;
215
- }
216
- }
217
-
218
- return new FormattedViemError(formattedRes.replace(/\\n/g, '\n'), error?.metaMessages);
184
+ const body = String(error);
185
+ const length = body.length;
186
+ // LogExplorer can only render up to 2500 characters in it's summary view. Try to keep the whole message below this number
187
+ // Limit the error to 2000 chacaters in order to allow code higher up to decorate this error with extra details (up to 500 characters)
188
+ if (length > 2000) {
189
+ const chunk = 950;
190
+ const truncated = length - 2 * chunk;
191
+ return new FormattedViemError(
192
+ body.slice(0, chunk) + `...${truncated} characters truncated...` + body.slice(-1 * chunk),
193
+ );
194
+ }
195
+
196
+ return new FormattedViemError(body);
219
197
  }
220
198
 
221
199
  function stripAbis(obj: any) {
@@ -241,156 +219,6 @@ function stripAbis(obj: any) {
241
219
  });
242
220
  }
243
221
 
244
- function extractAndFormatRequestBody(message: string): string {
245
- // First check if message is extremely large and contains very large hex strings
246
- if (message.length > 50000) {
247
- message = replaceHexStrings(message, { minLength: 10000, truncateLength: 200 });
248
- }
249
-
250
- // Add a specific check for RPC calls with large params
251
- if (message.includes('"method":"eth_sendRawTransaction"')) {
252
- message = replaceHexStrings(message, {
253
- pattern: /"params":\s*\[\s*"(0x[a-fA-F0-9]{1000,})"\s*\]/g,
254
- transform: hex => `"params":["${truncateHex(hex, 200)}"]`,
255
- });
256
- }
257
-
258
- // First handle Request body JSON
259
- const requestBodyRegex = /Request body: ({[\s\S]*?})\n/g;
260
- let result = message.replace(requestBodyRegex, (match, body) => {
261
- return `Request body: ${formatRequestBody(body)}\n`;
262
- });
263
-
264
- // Then handle Arguments section
265
- const argsRegex = /((?:Request |Estimate Gas )?Arguments:[\s\S]*?(?=\n\n|$))/g;
266
- result = result.replace(argsRegex, section => {
267
- const lines = section.split('\n');
268
- const processedLines = lines.map(line => {
269
- // Check if line contains a colon followed by content
270
- const colonIndex = line.indexOf(':');
271
- if (colonIndex !== -1) {
272
- const [prefix, content] = [line.slice(0, colonIndex + 1), line.slice(colonIndex + 1).trim()];
273
- // If content contains a hex string, truncate it
274
- if (content.includes('0x')) {
275
- const processedContent = replaceHexStrings(content);
276
- return `${prefix} ${processedContent}`;
277
- }
278
- }
279
- return line;
280
- });
281
- return processedLines.join('\n');
282
- });
283
-
284
- // Finally, catch any remaining hex strings in the message
285
- result = replaceHexStrings(result);
286
-
287
- return result;
288
- }
289
-
290
- function truncateHex(hex: string, length = 100) {
291
- if (!hex || typeof hex !== 'string') {
292
- return hex;
293
- }
294
- if (!hex.startsWith('0x')) {
295
- return hex;
296
- }
297
- if (hex.length <= length * 2) {
298
- return hex;
299
- }
300
- // For extremely large hex strings, use more aggressive truncation
301
- if (hex.length > 10000) {
302
- return `${hex.slice(0, length)}...<${hex.length - length * 2} chars omitted>...${hex.slice(-length)}`;
303
- }
304
- return `${hex.slice(0, length)}...${hex.slice(-length)}`;
305
- }
306
-
307
- function replaceHexStrings(
308
- text: string,
309
- options: {
310
- minLength?: number;
311
- maxLength?: number;
312
- truncateLength?: number;
313
- pattern?: RegExp;
314
- transform?: (hex: string) => string;
315
- } = {},
316
- ): string {
317
- const {
318
- minLength = 10,
319
- maxLength = Infinity,
320
- truncateLength = 100,
321
- pattern,
322
- transform = hex => truncateHex(hex, truncateLength),
323
- } = options;
324
-
325
- const hexRegex = pattern ?? new RegExp(`(0x[a-fA-F0-9]{${minLength},${maxLength}})`, 'g');
326
- return text.replace(hexRegex, match => transform(match));
327
- }
328
-
329
- function formatRequestBody(body: string) {
330
- try {
331
- // Special handling for eth_sendRawTransaction
332
- if (body.includes('"method":"eth_sendRawTransaction"')) {
333
- try {
334
- const parsed = JSON.parse(body);
335
- if (parsed.params && Array.isArray(parsed.params) && parsed.params.length > 0) {
336
- // These are likely large transaction hex strings
337
- parsed.params = parsed.params.map((param: any) => {
338
- if (typeof param === 'string' && param.startsWith('0x') && param.length > 1000) {
339
- return truncateHex(param, 200);
340
- }
341
- return param;
342
- });
343
- }
344
- return JSON.stringify(parsed, null, 2);
345
- } catch {
346
- // If specific parsing fails, fall back to regex-based truncation
347
- return replaceHexStrings(body, {
348
- pattern: /"params":\s*\[\s*"(0x[a-fA-F0-9]{1000,})"\s*\]/g,
349
- transform: hex => `"params":["${truncateHex(hex, 200)}"]`,
350
- });
351
- }
352
- }
353
-
354
- // For extremely large request bodies, use simple truncation instead of parsing
355
- if (body.length > 50000) {
356
- const jsonStart = body.indexOf('{');
357
- const jsonEnd = body.lastIndexOf('}');
358
- if (jsonStart >= 0 && jsonEnd > jsonStart) {
359
- return replaceHexStrings(body, { minLength: 10000, truncateLength: 200 });
360
- }
361
- }
362
-
363
- const parsed = JSON.parse(body);
364
-
365
- // Process the entire request body
366
- const processed = processParams(parsed);
367
- return JSON.stringify(processed, null, 2);
368
- } catch {
369
- // If JSON parsing fails, do a simple truncation of any large hex strings
370
- return replaceHexStrings(body, { minLength: 1000, truncateLength: 150 });
371
- }
372
- }
373
-
374
- // Recursively process all parameters that might contain hex strings
375
- function processParams(obj: any): any {
376
- if (Array.isArray(obj)) {
377
- return obj.map(item => processParams(item));
378
- }
379
- if (typeof obj === 'object' && obj !== null) {
380
- const result: any = {};
381
- for (const [key, value] of Object.entries(obj)) {
382
- result[key] = processParams(value);
383
- }
384
- return result;
385
- }
386
- if (typeof obj === 'string') {
387
- if (obj.startsWith('0x')) {
388
- return truncateHex(obj);
389
- }
390
- }
391
- return obj;
392
- }
393
-
394
222
  export function tryGetCustomErrorName(err: any) {
395
223
  try {
396
224
  // See https://viem.sh/docs/contract/simulateContract#handling-custom-errors
@@ -4,7 +4,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
4
4
  * The address of the zk passport verifier on sepolia
5
5
  * get address from: ROOT/l1-contracts/lib/circuits/src/solidity/deployments/deployment-11155111.json
6
6
  */
7
- export const ZK_PASSPORT_VERIFIER_ADDRESS = EthAddress.fromString('0x62e33cC35e29130e135341586e8Cf9C2BAbFB3eE');
7
+ export const ZK_PASSPORT_VERIFIER_ADDRESS = EthAddress.fromString('0x3101Bad9eA5fACadA5554844a1a88F7Fe48D4DE0');
8
8
  /**
9
9
  * The default domain of the zk passport site
10
10
  */
@@ -1,250 +0,0 @@
1
- import { type ConfigMappingsType } from '@aztec/foundation/config';
2
- import { EthAddress } from '@aztec/foundation/eth-address';
3
- import type { ViemTransactionSignature } from '@aztec/foundation/eth-signature';
4
- import { type Logger } from '@aztec/foundation/log';
5
- import { DateProvider } from '@aztec/foundation/timer';
6
- import { type Abi, type Account, type Address, type BlockOverrides, type ContractFunctionExecutionError, type Hex, type PrepareTransactionRequestRequest, type StateOverride, type TransactionReceipt, type TransactionSerializable, type WalletClient } from 'viem';
7
- import type { EthSigner } from './eth-signer/eth-signer.js';
8
- import type { ExtendedViemWalletClient, ViemClient } from './types.js';
9
- export interface L1TxUtilsConfig {
10
- /**
11
- * How much to increase calculated gas limit.
12
- */
13
- gasLimitBufferPercentage?: number;
14
- /**
15
- * Maximum gas price in gwei
16
- */
17
- maxGwei?: bigint;
18
- /**
19
- * Maximum blob fee per gas in gwei
20
- */
21
- maxBlobGwei?: bigint;
22
- /**
23
- * Priority fee bump percentage
24
- */
25
- priorityFeeBumpPercentage?: number;
26
- /**
27
- * How much to increase priority fee by each attempt (percentage)
28
- */
29
- priorityFeeRetryBumpPercentage?: number;
30
- /**
31
- * Fixed priority fee per gas in Gwei. Overrides any priority fee bump percentage config
32
- */
33
- fixedPriorityFeePerGas?: number;
34
- /**
35
- * Maximum number of speed-up attempts
36
- */
37
- maxAttempts?: number;
38
- /**
39
- * How often to check tx status
40
- */
41
- checkIntervalMs?: number;
42
- /**
43
- * How long before considering tx stalled
44
- */
45
- stallTimeMs?: number;
46
- /**
47
- * How long to wait for a tx to be mined before giving up
48
- */
49
- txTimeoutMs?: number;
50
- /**
51
- * How many attempts will be done to get a tx after it was sent?
52
- * First attempt is done at 1s, second at 2s, third at 3s, etc.
53
- */
54
- txPropagationMaxQueryAttempts?: number;
55
- /**
56
- * Whether to attempt to cancel a tx if it's not mined after txTimeoutMs
57
- */
58
- cancelTxOnTimeout?: boolean;
59
- }
60
- export declare const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig>;
61
- export declare const defaultL1TxUtilsConfig: L1TxUtilsConfig;
62
- export declare function getL1TxUtilsConfigEnvVars(): L1TxUtilsConfig;
63
- export interface L1TxRequest {
64
- to: Address | null;
65
- data?: Hex;
66
- value?: bigint;
67
- abi?: Abi;
68
- }
69
- export type L1GasConfig = Partial<L1TxUtilsConfig> & {
70
- gasLimit?: bigint;
71
- txTimeoutAt?: Date;
72
- };
73
- export interface L1BlobInputs {
74
- blobs: Uint8Array[];
75
- kzg: any;
76
- maxFeePerBlobGas?: bigint;
77
- }
78
- export interface GasPrice {
79
- maxFeePerGas: bigint;
80
- maxPriorityFeePerGas: bigint;
81
- maxFeePerBlobGas?: bigint;
82
- }
83
- export type TransactionStats = {
84
- /** Address of the sender. */
85
- sender: string;
86
- /** Hash of the transaction. */
87
- transactionHash: string;
88
- /** Size in bytes of the tx calldata */
89
- calldataSize: number;
90
- /** Gas required to pay for the calldata inclusion (depends on size and number of zeros) */
91
- calldataGas: number;
92
- };
93
- export declare enum TxUtilsState {
94
- IDLE = 0,
95
- SENT = 1,
96
- SPEED_UP = 2,
97
- CANCELLED = 3,
98
- NOT_MINED = 4,
99
- MINED = 5
100
- }
101
- export declare class ReadOnlyL1TxUtils {
102
- client: ViemClient;
103
- protected logger: Logger;
104
- readonly dateProvider: DateProvider;
105
- protected debugMaxGasLimit: boolean;
106
- readonly config: L1TxUtilsConfig;
107
- protected interrupted: boolean;
108
- constructor(client: ViemClient, logger: Logger | undefined, dateProvider: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean);
109
- interrupt(): void;
110
- restart(): void;
111
- getBlock(): Promise<{
112
- number: bigint;
113
- hash: `0x${string}`;
114
- nonce: `0x${string}`;
115
- logsBloom: `0x${string}`;
116
- baseFeePerGas: bigint | null;
117
- blobGasUsed: bigint;
118
- difficulty: bigint;
119
- excessBlobGas: bigint;
120
- extraData: Hex;
121
- gasLimit: bigint;
122
- gasUsed: bigint;
123
- miner: Address;
124
- mixHash: import("viem").Hash;
125
- parentBeaconBlockRoot?: `0x${string}` | undefined;
126
- parentHash: import("viem").Hash;
127
- receiptsRoot: Hex;
128
- sealFields: Hex[];
129
- sha3Uncles: import("viem").Hash;
130
- size: bigint;
131
- stateRoot: import("viem").Hash;
132
- timestamp: bigint;
133
- totalDifficulty: bigint | null;
134
- transactionsRoot: import("viem").Hash;
135
- uncles: import("viem").Hash[];
136
- withdrawals?: import("viem").Withdrawal[] | undefined | undefined;
137
- withdrawalsRoot?: `0x${string}` | undefined;
138
- transactions: `0x${string}`[];
139
- }>;
140
- getBlockNumber(): Promise<bigint>;
141
- /**
142
- * Gets the current gas price with bounds checking
143
- */
144
- getGasPrice(_gasConfig?: L1TxUtilsConfig, isBlobTx?: boolean, attempt?: number, previousGasPrice?: typeof attempt extends 0 ? never : GasPrice): Promise<GasPrice>;
145
- /**
146
- * Estimates gas and adds buffer
147
- */
148
- estimateGas(account: Account | Hex, request: L1TxRequest, _gasConfig?: L1TxUtilsConfig, _blobInputs?: L1BlobInputs): Promise<bigint>;
149
- getTransactionStats(txHash: string): Promise<TransactionStats | undefined>;
150
- tryGetErrorFromRevertedTx(data: Hex, args: {
151
- args: readonly any[];
152
- functionName: string;
153
- abi: Abi;
154
- address: Hex;
155
- }, blobInputs: (L1BlobInputs & {
156
- maxFeePerBlobGas: bigint;
157
- }) | undefined, stateOverride?: StateOverride): Promise<string | undefined>;
158
- simulate(request: L1TxRequest & {
159
- gas?: bigint;
160
- from?: Hex;
161
- }, blockOverrides?: BlockOverrides<bigint, number>, stateOverrides?: StateOverride, abi?: Abi, _gasConfig?: L1TxUtilsConfig & {
162
- fallbackGasEstimate?: bigint;
163
- }): Promise<{
164
- gasUsed: bigint;
165
- result: `0x${string}`;
166
- }>;
167
- protected _simulate(call: any, blockOverrides: BlockOverrides<bigint, number> | undefined, stateOverrides: StateOverride | undefined, gasConfig: L1TxUtilsConfig & {
168
- fallbackGasEstimate?: bigint;
169
- }, abi: Abi): Promise<{
170
- gasUsed: bigint;
171
- result: `0x${string}`;
172
- }>;
173
- bumpGasLimit(gasLimit: bigint, _gasConfig?: L1TxUtilsConfig): bigint;
174
- }
175
- export type SigningCallback = (transaction: TransactionSerializable, signingAddress: EthAddress) => Promise<ViemTransactionSignature>;
176
- export declare class L1TxUtils extends ReadOnlyL1TxUtils {
177
- client: ViemClient;
178
- address: EthAddress;
179
- private signer;
180
- protected logger: Logger;
181
- private txUtilsState;
182
- private lastMinedBlockNumber;
183
- private nonceManager;
184
- constructor(client: ViemClient, address: EthAddress, signer: SigningCallback, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean);
185
- get state(): TxUtilsState;
186
- get lastMinedAtBlockNumber(): bigint | undefined;
187
- private set lastMinedAtBlockNumber(value);
188
- private set state(value);
189
- getSenderAddress(): EthAddress;
190
- getSenderBalance(): Promise<bigint>;
191
- private signTransaction;
192
- protected prepareSignedTransaction(txData: PrepareTransactionRequestRequest): Promise<`0x${string}`>;
193
- /**
194
- * Sends a transaction with gas estimation and pricing
195
- * @param request - The transaction request (to, data, value)
196
- * @param gasConfig - Optional gas configuration
197
- * @returns The transaction hash and parameters used
198
- */
199
- sendTransaction(request: L1TxRequest, _gasConfig?: L1GasConfig, blobInputs?: L1BlobInputs, stateChange?: TxUtilsState): Promise<{
200
- txHash: Hex;
201
- gasLimit: bigint;
202
- gasPrice: GasPrice;
203
- }>;
204
- /**
205
- * Monitors a transaction until completion, handling speed-ups if needed
206
- * @param request - Original transaction request (needed for speed-ups)
207
- * @param initialTxHash - Hash of the initial transaction
208
- * @param params - Parameters used in the initial transaction
209
- * @param gasConfig - Optional gas configuration
210
- */
211
- monitorTransaction(request: L1TxRequest, initialTxHash: Hex, params: {
212
- gasLimit: bigint;
213
- }, _gasConfig?: Partial<L1TxUtilsConfig> & {
214
- txTimeoutAt?: Date;
215
- }, _blobInputs?: L1BlobInputs, isCancelTx?: boolean): Promise<TransactionReceipt>;
216
- /**
217
- * Sends a transaction and monitors it until completion
218
- * @param request - The transaction request (to, data, value)
219
- * @param gasConfig - Optional gas configuration
220
- * @returns The receipt of the successful transaction
221
- */
222
- sendAndMonitorTransaction(request: L1TxRequest, gasConfig?: L1GasConfig, blobInputs?: L1BlobInputs): Promise<{
223
- receipt: TransactionReceipt;
224
- gasPrice: GasPrice;
225
- }>;
226
- simulate(request: L1TxRequest & {
227
- gas?: bigint;
228
- from?: Hex;
229
- }, _blockOverrides?: BlockOverrides<bigint, number>, stateOverrides?: StateOverride, abi?: Abi, _gasConfig?: L1TxUtilsConfig & {
230
- fallbackGasEstimate?: bigint;
231
- ignoreBlockGasLimit?: boolean;
232
- }): Promise<{
233
- gasUsed: bigint;
234
- result: `0x${string}`;
235
- }>;
236
- /**
237
- * Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
238
- * @param nonce - The nonce of the transaction to cancel
239
- * @param previousGasPrice - The gas price of the previous transaction
240
- * @param attempts - The number of attempts to cancel the transaction
241
- * @returns The hash of the cancellation transaction
242
- */
243
- protected attemptTxCancellation(currentTxHash: Hex, nonce: number, isBlobTx?: boolean, previousGasPrice?: GasPrice, attempts?: number): Promise<`0x${string}`>;
244
- }
245
- export declare function createViemSigner(client: WalletClient): SigningCallback;
246
- export declare function createL1TxUtilsFromViemWallet(client: ExtendedViemWalletClient, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtils;
247
- export declare function createL1TxUtilsFromEthSigner(client: ViemClient, signer: EthSigner, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtils;
248
- export declare function tryGetCustomErrorNameContractFunction(err: ContractFunctionExecutionError): string;
249
- export declare function getCalldataGasUsage(data: Uint8Array): number;
250
- //# sourceMappingURL=l1_tx_utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"l1_tx_utils.d.ts","sourceRoot":"","sources":["../src/l1_tx_utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,KAAK,cAAc,EACnB,KAAK,8BAA8B,EAEnC,KAAK,GAAG,EAIR,KAAK,gCAAgC,EACrC,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EAQlB,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAuBvE,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;OAEG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