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

gasPrice doesn't exist in web3.eth.getTransaction() return type #6501

Closed
avkos opened this issue Oct 11, 2023 · 0 comments · Fixed by #6539
Closed

gasPrice doesn't exist in web3.eth.getTransaction() return type #6501

avkos opened this issue Oct 11, 2023 · 0 comments · Fixed by #6539
Assignees
Labels
Bug Addressing a bug Estimate

Comments

@avkos
Copy link
Contributor

avkos commented Oct 11, 2023

gasPrice doesn't exist in web3.eth.getTransaction() return type

original link

Expected behavior

gasPrice exists in the returning type of web3.eth.getTransaction()

Actual behavior

The error:

 Property 'gasPrice' does not exist on type '{ readonly yParity: string; readonly r: string; readonly s: string; readonly maxFeePerGas: string; readonly maxPriorityFeePerGas: string; readonly accessList: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; ... 12 more ...; readonly transactionIndex?: string | undefined; } ...'.
      Property 'gasPrice' does not exist on type '{ readonly yParity: string; readonly r: string; readonly s: string; readonly maxFeePerGas: string; readonly maxPriorityFeePerGas: string; readonly accessList: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; ... 12 more ...; readonly transactionIndex?: string | undefined; }'.

    const gasPrice = BigInt(transactionDetails.gasPrice);

Steps to reproduce the behavior

Try to build code:

const test = async () => {
	const web3 = new Web3();
	const transactionDetails = await web3.eth.getTransaction('0x');
	// here it will throw error that gasPrice is not a property of transaction
	const gasPrice = BigInt(transactionDetails.gasPrice);

	console.log(gasPrice);
};
test().catch();

Logs

Environment

@mconnelly8 mconnelly8 added Bug Addressing a bug Estimate labels Oct 18, 2023
@avkos avkos self-assigned this Oct 19, 2023
@avkos avkos mentioned this issue Oct 23, 2023
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug Estimate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants