-
Notifications
You must be signed in to change notification settings - Fork 21.3k
Description
The new feature added on 5b1a04b returning the full transaction on newPendingTransactions
subscription is really useful, but does not return the full information like subscribing for hashes and then using eth_getTransaction
with it does.
Please add from
and possibly chainId
(to make it complete) on the full transaction object.
Example of object returned with 'eth_subscribe', ['newPendingTransactions', true]
:
{
type: '0x2',
nonce: '0xe',
gasPrice: null,
maxPriorityFeePerGas: '0x59682f00',
maxFeePerGas: '0x8e26dacb2',
gas: '0x394de',
value: '0x0',
input: '0x5ae401dc0000000000000000000000000000000000000000000000000000000063542a0b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000e4472b43f30000000000000000000000000000000000000000000a17ae76b747b02bc0bb7800000000000000000000000000000000000000000000000007cc4a16fbd8c81e00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000038c15f59f2f14adb24672ea25da111c3f81637a0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004449404b7c00000000000000000000000000000000000000000000000007cc4a16fbd8c81e000000000000000000000000f9eb81b3807e3e9abc5537af73be2a0c8e6b923900000000000000000000000000000000000000000000000000000000',
v: '0x1',
r: '0x5aaf8b6da68451a1ac6fba1a00107179eac97500d4cb0b849d9671462eedd890',
s: '0x279d7df79cb05c3033de9d963cc9b2a785a43bca9c9b802fe33c2ee955edad09',
to: '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45',
chainId: '0x1',
accessList: [],
hash: '0x5ec2a5ae29fab77d7503e8cc5921b7c31d05e72ad2e7602526c6b3ecabbe18d0'
}
Example of object returned with 'eth_subscribe', ['newPendingTransactions']
, and then eth_getTransaction
on the result:
{
blockHash: null,
blockNumber: null,
from: '0x97521d509A028b1009F651e14E1e471f3452DE36',
gas: 69724,
gasPrice: '32950574540',
maxFeePerGas: '32950574540',
maxPriorityFeePerGas: '1000000000',
hash: '0xf5b75b99b293b20a4029718f165f356d2f3d3b2f5b2d36dfd0d0fd7454cc4968',
input: '0x095ea7b30000000000000000000000001111111254fb6c44bac0bed2854e76f90643097dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
nonce: 22,
to: '0x761D38e5ddf6ccf6Cf7c55759d5210750B5D60F3',
transactionIndex: null,
value: '0',
type: 2,
accessList: [],
chainId: '0x1',
v: '0x0',
r: '0x608844986b439407a7e49c3c2db9a4b46ff213cef692a4397cf202fea790edb6',
s: '0x424cce707fe6c5c366a4369d025ae4908def0afec259639f9f70d5dbf26d509b'
}
Note: web3.js (v1.8.0) does not support yet the true
argument when subscribing 'newPendingTransactions'
. I've opened an issue for it (web3/web3.js#5548).
Workaround for now is to comment out line 70 in \node_modules\web3-core-subscriptions\lib\subscription.js
if (args.length !== subscription.params) {
//throw errors.InvalidNumberOfParams(args.length, subscription.params, subscription.subscriptionName);
}
Note 2: I just noticed that while one method returns hex values, the other returns numbers. I am not sure if that's due to web3.js lack of support but maybe worth taking a look as well.