Open ifavo opened 4 days ago
Calling eth_getBlockByHash for a block that contains transactions without a clause, throws an error.
eth_getBlockByHash
The function _formatTransactionToRPC does expect every transaction to have at least one clause, that block 0x012071980ae777216d6ba417b202d8fe37408b4966802bfacb5ef02cb91485f9 however does not have a clause in its first transaction: https://mainnet.vechain.org/blocks/0x012071980ae777216d6ba417b202d8fe37408b4966802bfacb5ef02cb91485f9?expanded=true
_formatTransactionToRPC
0x012071980ae777216d6ba417b202d8fe37408b4966802bfacb5ef02cb91485f9
The code part that errors is:
https://github.com/vechain/vechain-sdk-js/blob/10787514e01b3b8bfb7bd3256e47ad27401382c3/packages/network/src/provider/utils/formatter/transactions/formatter.ts#L53-L55
https://www.val.town/v/ifavo/aquaMagpie
import { ThorClient, VeChainProvider } from "@vechain/sdk-network"; const thorClient = ThorClient.fromUrl("https://mainnet.vechain.org"); const provider = new VeChainProvider(thorClient); // this succeeds const rawData = await thorClient.blocks.getBlockExpanded( "0x012071980ae777216d6ba417b202d8fe37408b4966802bfacb5ef02cb91485f9", ); console.log("Raw Result", rawData); // this fails const rpcData = await provider.request({ method: "eth_getBlockByHash", params: ["0x012071980ae777216d6ba417b202d8fe37408b4966802bfacb5ef02cb91485f9", true], }); console.log("RPC Result", rpcData);
![DESCRIPTION](LINK.png)
No response
Description
Calling
eth_getBlockByHash
for a block that contains transactions without a clause, throws an error.The function
_formatTransactionToRPC
does expect every transaction to have at least one clause, that block0x012071980ae777216d6ba417b202d8fe37408b4966802bfacb5ef02cb91485f9
however does not have a clause in its first transaction: https://mainnet.vechain.org/blocks/0x012071980ae777216d6ba417b202d8fe37408b4966802bfacb5ef02cb91485f9?expanded=trueThe code part that errors is:
https://github.com/vechain/vechain-sdk-js/blob/10787514e01b3b8bfb7bd3256e47ad27401382c3/packages/network/src/provider/utils/formatter/transactions/formatter.ts#L53-L55
Reproduction URL
https://www.val.town/v/ifavo/aquaMagpie
Reproduction steps
Screenshots
Logs
No response
OS
No response