Files
zk-account-abstraction/test/debugTx.ts
Alex Forshtat f5fed715b8 AA-30: Add eslint task to the repository (#97)
Co-authored-by: Dror Tirosh <dror@opengsn.org>
2022-07-07 23:23:20 +03:00

27 lines
637 B
TypeScript

import { ethers } from 'hardhat'
export interface DebugLog {
pc: number
op: string
gasCost: number
depth: number
stack: string[]
memory: string[]
}
export interface DebugTransactionResult {
gas: number
failed: boolean
returnValue: string
structLogs: DebugLog[]
}
export async function debugTransaction (txHash: string, disableMemory = true, disableStorage = true): Promise<DebugTransactionResult> {
const debugTx = async (hash: string): Promise<DebugTransactionResult> => await ethers.provider.send('debug_traceTransaction', [hash, {
disableMemory,
disableStorage
}])
return await debugTx(txHash)
}