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: allow provider re-instantiation from chain + node info #3726

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

petertonysmith94
Copy link
Contributor

@petertonysmith94 petertonysmith94 commented Feb 21, 2025

Release notes

In this release, we:

  • TBD

Summary

  • In this change, we have added the following to the SendTranscationJsonRpc specification:
interface SendTransactionJsonRpc extends ExistingSendTransactionJsonRpc {
  provider: {
    url: string,
    cache?: {
      consensusParameterTimestamp?: string,
      chain: SerializedChainInfo,
      nodeInfo: SerializedNodeInfo,
    }
  }
}
  • We can now re-instantiate a Provider using the serialised cache above:
function sendTransaction(request: TransactionRequest, { provider: { url, cache } }) {
  // This will then not perform a request to the node for chain + node info
  const provider = new Provider(url, { cache });
  
  // ...
}

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)

@petertonysmith94 petertonysmith94 added the feat Issue is a feature label Feb 21, 2025
@petertonysmith94 petertonysmith94 self-assigned this Feb 21, 2025
Copy link

vercel bot commented Feb 21, 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 Feb 21, 2025 5:52pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 21, 2025 5:52pm
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 21, 2025 5:52pm

Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
77.19%(+0.04%) 70.84%(+0.15%) 75.35%(+0.05%) 77.19%(+0.04%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 ✨ packages/abi-coder/src/utils/scriptData.ts 0%
(+0%)
0%
(+0%)
0%
(+0%)
0%
(+0%)
🔴 packages/account/src/account.ts 81.14%
(+0.56%)
72.36%
(+1.13%)
82.5%
(+0%)
80.89%
(+0.55%)
🔴 packages/account/src/connectors/fuel-connector.ts 30%
(+1.43%)
100%
(+0%)
4.54%
(-0.22%)
30%
(+1.43%)
🔴 packages/account/src/connectors/fuel.ts 96.75%
(+0.02%)
90.66%
(+0%)
93.33%
(+0%)
96.87%
(+0.02%)
🔴 packages/account/src/providers/provider.ts 67.6%
(+0.65%)
60.18%
(+3.11%)
67.7%
(-0.34%)
67.36%
(+0.63%)
🔴 packages/account/src/providers/generated/operations.ts 94.19%
(+0.65%)
100%
(+0%)
82.35%
(+1.96%)
94.64%
(+0.6%)
✨ packages/account/src/providers/utils/serialization.ts 100%
(+100%)
100%
(+100%)
100%
(+100%)
100%
(+100%)
🔴 packages/errors/src/test-utils/expect-to-throw-fuel-error.ts 91.66%
(-0.34%)
88.88%
(+0%)
100%
(+0%)
91.66%
(-0.34%)

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.

1 participant