This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Description
Expected behavior
When the Number and Bytes type is passed to the typesystem it should return back the correct format desired.
Actual behavior
The object is getting the correct format, but hte typesystem is not.
Steps to reproduce the behavior
- Start a new project npm init -y && npm i [email protected]
- Create the a simple code to getTransactionReceipt()
import Web3, { FMT_BYTES, FMT_NUMBER } from "web3";
async function main() {
const web3 = new Web3('<SOME_ENDPOINT>')
const receipt = await web3.eth.getTransactionReceipt('<SOME_HASH>',
{ number: FMT_NUMBER.NUMBER, bytes: FMT_BYTES.HEX })
const hex: string = receipt.blockHash
}
main()
Logs
web3test.ts:10:11 - error TS2322: Type 'Bytes' is not assignable to type 'string'.
Type 'Uint8Array' is not assignable to type 'string'.
10 const hex: string = receipt.blockHash
Environment
OS: OS X VENTURA 13.4
NODE: v18.13.0
NPM: 9.6.6
TS: Version 4.9.5