-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remove redundant gas price call in TransactionResponse
#3536
Comments
@danielbate What's the difference between what each method will return? Please, consider posting both returned objects in full so we can compare them. While I'm happy with the rationale, I'm not sure the API is quite there yet, but we can discuss it further. 🙂 |
Based on this check: /**
* If totalFee is provided it means that the TX was already processed and we could extract the fee
* from its status
*/
if (totalFee) {
return totalFee;
} fetching the const { totalFee } = processGraphqlStatus(this.status ?? this.gqlTransaction?.status);
const gasPrice = !totalFee && await this.provider.getLatestGasPrice(); |
I agree with @nedsalk's suggestion, it seems the best approach. Since And for cases where the user explicitly calls |
TransactionResponse
TransactionResponse
This issue initially made the below proposition, but has been superseded by comments from @nedsalk and @Torres-ssf 👏🏻
|
In instances where we are assembling a transaction summary for a transaction where we already have it's status, and therefore it's total fee, we are making a redundant network request to obtain the latest gas price. In these instances, we should instead build the response using the obtained fee, rather than recalculating it.
The text was updated successfully, but these errors were encountered: