Skip to content

Commit f609ee0

Browse files
chore(txm): added debug log
1 parent 0146516 commit f609ee0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

packages/txm/lib/TransactionManager.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,33 +298,43 @@ export class TransactionManager {
298298
}
299299

300300
public async start(): Promise<void> {
301+
console.log("Starting transaction manager")
301302
// Start the gas price oracle to prevent other parts of the application from calling `suggestGasForNextBlock` before the gas price oracle has initialized the gas price after processing the first block
302303
const priceOraclePromise = this.gasPriceOracle.start()
303304

305+
console.log("Starting gas price oracle")
304306
// Get the chain ID of the RPC node
305307
const rpcChainIdPromise = this.viemClient.safeGetChainId()
306308

309+
console.log("Starting transaction repository")
307310
// Start the transaction repository
308311
await this.transactionRepository.start()
309312

313+
console.log("Starting nonce manager")
310314
// Start the nonce manager, which depends on the transaction repository
311315
await this.nonceManager.start()
312316

317+
console.log("Getting chain ID")
313318
const rpcChainId = await rpcChainIdPromise
314319

320+
console.log("Checking chain ID")
315321
if (rpcChainId.isErr()) {
322+
console.error("Error getting chain ID", rpcChainId.error)
316323
throw rpcChainId.error
317324
}
318325

326+
console.log("Checking chain ID match")
319327
if (rpcChainId.value !== this.chainId) {
320328
const errorMessage = `The chain ID of the RPC node (${rpcChainId.value}) does not match the chain ID of the transaction manager (${this.chainId}).`
321329
throw new Error(errorMessage)
322330
}
323331

332+
console.log("Awaiting gas price oracle initialization")
324333
// Wait for the gas price oracle to initialize before starting the block monitor,
325334
// which emits 'NewBlock' events as the TXM heartbeat.
326335
await priceOraclePromise
327336

337+
console.log("Starting block monitor")
328338
await this.blockMonitor.start()
329339
}
330340
}

0 commit comments

Comments
 (0)