Closed VladLypovyi closed 6 months ago
As we know, header info is changing as time pass, and we must obtain it from the Tron chain. There are many connections between each prop. So if you want to change any of those props, we always recommend you to use our sdk, which is tested and in most situation, it is well performed.
Then it is unfair to say that since version 5.2.0. - 'Support for building transactions locally with protobuf'.
Since it's still an external request to the network.
But the request only fetch the header info, the main building process is handled locally. The header info can only be fetched from the chain in any way. So we integrate it in TransactionBuilder.
Inspiration in passing header info by ourselves - because we obtain it in parallel, and don't need to use extra network requests in building scope. 'Support for building transactions locally with protobuf'. - but under the hood network call exists it's strange
Tronweb v5.3.2 now supports custom block header! You can pass a field named blockHeader
in options parameter.
Tronweb v5.3.2 now supports custom block header! You can pass a field named
blockHeader
in options parameter.
trx.sendTransaction
still ignoring these options? not sure if intended
sendTransaction
You need to use transactionBuilder to trigger the action.
const options = {
blockHeader: {...},
};
const transaction = await tronWeb.transactionBuilder.sendTrx(to, amount, address, options);
const signedTransaction = await tronWeb.trx.sign(transaction);
const result = await tronWeb.trx.sendRawTransaction(signedTransaction);
After the 5.2.0 release, it claims to 'Support build transactions locally with protobuf'.
But the
createTransaction
method still calls thegetHeaderInfo
method, which requests information about the block from the network using a request to the node via'wallet/getblock'
.file path: tronweb/src/lib/transactionBuilder.js
Then what was the point of abandoning transaction building with a node request as it was before 5.2.0?
Maybe it should be possible to pass headerInfo manually in transaction creation parameters?