Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement debug_traceTransaction and debug_traceCall #31

Merged
merged 3 commits into from
Sep 6, 2023
Merged

Conversation

libotony
Copy link
Member

Debug namespace is not included in standard web3.js or ethers.js, need to be called directly at the provider side, below is some example:

/**
 * debug_traceTransaction(txHash, traceOptions)
 * traceOptions: {
 * 	tracer: '', // name of tracer or custom js tracer code
 * 	config: {}  // struct logger config object
 * 	tracerConfig: {} // tracer specific config object
 * }
 */
provider.request({
        method: 'debug_traceTransaction',
        params: [
	        '0x0050c856835d72c00974eb53fb249e261f31c4a4b1ca107e8fca8198f0fb7aa4',
	        {
		        tracer: 'call',
		        tracerConfig: {
			        onlyTopCall: true
		        }
	        }
        ]
})
/**
 * debug_traceTransaction(txHash, traceOptions)
 * traceOptions: {
 * 	tracer: '', // name of tracer or custom js tracer code
 * 	config: {}  // struct logger config object
 * 	tracerConfig: {} // tracer specific config object
 * }
 */
provider.request({
	method: 'debug_traceCall',
	params: [
		{
			from: '0xe87140bcf5dfafde63bdd3930285ffc1fc7578e4',
			to: '0x0000000000000000000000000000456e65726779',
			data: '0xa9059cbb000000000000000000000000bec38ea2338a4dafc246eb7eaf1b81e8a15d635400000000000000000000000000000000000000000000003635c9adc5dea00000'
		},
		'latest',
		{
			tracer: 'call',
			tracerConfig: {}
		}
	]
})

TraceCall test cases will be uncommented after thor releases the new version, this PR will bring down the code coverage.

@libotony libotony requested a review from zzGHzz September 5, 2023 08:38
@zzGHzz zzGHzz merged commit 869dcad into main Sep 6, 2023
1 check passed
@libotony libotony deleted the debug_namespace branch September 7, 2023 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants