Skip to content
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

feat!: remove redundant gas price call for tx summary #3559

Merged
merged 17 commits into from
Jan 8, 2025

Conversation

danielbate
Copy link
Member

@danielbate danielbate commented Jan 7, 2025

Release notes

In this release, we:

  • Improved speed in assembling result for settled transactions

Summary

Removes a redundant get latest gas price network call for transactions that have settled, where we can obtain the fee from the status check, rather than recalculating it.

const tx = await sender.transfer(receiver.address, 1_000, await provider.getBaseAssetId());
const result = await tx.waitForResult(); // no longer needs to call `await provider.getLatestGasPrice()`
console.log(result.fee); // bn('0x01')

Breaking Changes

  • calculateTXFeeForSummary and subsequently the CalculateTXFeeForSummaryParams no longer accept a totalFee property. If you have the totalFee, then there is no need to call the calculateTxFeeForSummary() function.
// before
const totalFee = bn(..):
calculateTXFeeForSummary({ ..., totalFee } as CalculateTXFeeForSummaryParams);
// after
calculateTXFeeForSummary({ ... } as CalculateTXFeeForSummaryParams);

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@danielbate danielbate added the feat Issue is a feature label Jan 7, 2025
@danielbate danielbate self-assigned this Jan 7, 2025
Copy link

vercel bot commented Jan 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 5:08pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 5:08pm
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 5:08pm

@danielbate danielbate changed the title feat: remove redundant gas price call for tx summary feat!: remove redundant gas price call for tx summary Jan 7, 2025
Co-authored-by: Nedim Salkić <[email protected]>
nedsalk
nedsalk previously approved these changes Jan 8, 2025
@danielbate danielbate enabled auto-merge (squash) January 8, 2025 16:50
Copy link
Contributor

github-actions bot commented Jan 8, 2025

Coverage Report:

Lines Branches Functions Statements
76.9%(-0.07%) 70.35%(-0.14%) 74.89%(-0.13%) 76.9%(-0.07%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/provider.ts 68.69%
(-0.45%)
58.08%
(+0%)
70.21%
(-1.06%)
68.42%
(-0.43%)
🔴 packages/account/src/providers/generated/operations.ts 94.03%
(-0.67%)
100%
(+0%)
81.63%
(-2.04%)
94.51%
(-0.61%)
🔴 packages/account/src/providers/transaction-request/transaction-request.ts 88.57%
(+0%)
78.08%
(+1.37%)
84%
(+0%)
88.81%
(+0%)
🔴 packages/account/src/providers/transaction-response/transaction-response.ts 76.66%
(+0.26%)
64.4%
(-1.05%)
93.75%
(+0%)
76.66%
(+0.26%)
🔴 packages/account/src/providers/transaction-summary/assemble-transaction-summary.ts 100%
(+0%)
77.77%
(+6.35%)
100%
(+0%)
100%
(+0%)
🔴 packages/account/src/providers/transaction-summary/calculate-tx-fee-for-summary.ts 100%
(+0%)
90%
(-1.66%)
100%
(+0%)
100%
(+0%)
🔴 packages/account/src/providers/transaction-summary/status.ts 100%
(+0%)
93.33%
(+2.43%)
100%
(+0%)
100%
(+0%)
🔴 packages/address/src/address.ts 90.9%
(-0.17%)
86.66%
(+0%)
85.71%
(+0%)
91.07%
(-0.15%)
🔴 packages/address/src/utils.ts 69.23%
(-9.03%)
50%
(-21.42%)
77.77%
(-9.73%)
70.37%
(-8.79%)

@danielbate danielbate merged commit f2407dc into master Jan 8, 2025
24 checks passed
@danielbate danielbate deleted the db/feat/remove-redundant-gas-price-call branch January 8, 2025 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove redundant gas price call in TransactionResponse
4 participants