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

docs!: optimizing frontend apps #3573

Merged
merged 27 commits into from
Jan 10, 2025
Merged

docs!: optimizing frontend apps #3573

merged 27 commits into from
Jan 10, 2025

Conversation

danielbate
Copy link
Member

@danielbate danielbate commented Jan 10, 2025

Release notes

In this release, we:

  • Added documentation on optimizing frontend apps through transaction pre-loading

Summary

This PR primarily adds a dedicated page on optimizing transactions for apps and an advanced react example that utilises the techniques.

However some other decisions have been made in this PR, around the premise of transaction optimisation techniques:

Provider.sendTransactionAndAwaitStatus() and the contents of #3526 has been reverted. Rather than adding unnecessary bloat, we will just recommend Provider.sendTransaction() and Provider.waitForResult(). For accounts wanting to side-step any account level abstractions to sendTransaction(), they should fund and sign a request prior, and then use the provider to send the transaction, rather than the account. This technique is used in the added docs.

ScriptTransactionRequest.autoCost() has been renamed to ScriptTransactionRequest.estimateAndFund() as this seemed more appropriate. and BaseInvocationScope.autoCost() has been renamed back to BaseInvocationScope.fundWithRequiredCoins() as it is a relatively hidden method and to minimise breaking changes on the release. This was initially introduced in #3535.

Breaking Changes

// before
await request.autoCost(wallet);
// after
await request.estimateAndFund(wallet);
// before
const request = await contract.functions.increment().autoCost();
// after
const request = await contract.functions.increment().fundWithRequiredCoins();

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 docs Requests pertinent to documentation label Jan 10, 2025
@danielbate danielbate self-assigned this Jan 10, 2025
Copy link

vercel bot commented Jan 10, 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 10, 2025 4:04pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 4:04pm
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 4:04pm

@danielbate danielbate marked this pull request as ready for review January 10, 2025 12:27
apps/docs/package.json Outdated Show resolved Hide resolved
@danielbate danielbate enabled auto-merge (squash) January 10, 2025 16:09
Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
77.02%(-0.01%) 70.61%(-0.01%) 75.13%(-0.01%) 77.03%(-0.01%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/provider.ts 68.55%
(-0.21%)
58.37%
(-0.21%)
69.89%
(-0.32%)
68.28%
(-0.21%)

@danielbate danielbate merged commit 13977df into master Jan 10, 2025
24 checks passed
@danielbate danielbate deleted the db/docs/tx-speed branch January 10, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Requests pertinent to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation for tx dependency optimisation technique
5 participants