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: sdk batch rpc calls #7628

Merged
merged 13 commits into from
Nov 3, 2023
Merged

feat: sdk batch rpc calls #7628

merged 13 commits into from
Nov 3, 2023

Conversation

abretonc7s
Copy link
Contributor

@abretonc7s abretonc7s commented Oct 27, 2023

Description

Allow dapp developers to create sequences of RPC method calls that are sent simultaneously and managed by the MM mobile app using the existing RPC queue.

Chained RPC Calls:

Implement the ability for the SDK to handle sequences of RPC method calls.
Address known issues in the RPC queue, especially when one of the methods fails.

Related issues

Fixes: sdk 391

Manual testing steps

  1. Use a dapp using metamask/sdk and call the following:
    const selectedAddress = provider?.selectedAddress;

    const rpcs: ChainRPC[] = [{
      method: "personal_sign",
      params: ["something to sign 1", selectedAddress],
    },
    {
      method: "personal_sign",
      params: ["hello world", selectedAddress],
    },
    {
      method: "personal_sign",
      params: ["Another one #3", selectedAddress],
    }];

    try {
      const response = await provider?.request({method: 'metamask_batch', params: rpcs}) as any[];
      ...

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@abretonc7s abretonc7s added needs-qa Any New Features that needs a full manual QA prior to being added to a release. team-sdk SDK team labels Oct 27, 2023
@abretonc7s abretonc7s marked this pull request as ready for review October 27, 2023 05:25
@abretonc7s abretonc7s requested a review from a team as a code owner October 27, 2023 05:25
@github-actions
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/096de163-929a-47c4-8b52-7bad774b90ab
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2023

Codecov Report

Attention: 83 lines in your changes are missing coverage. Please review.

Comparison is base (c312ee8) 34.95% compared to head (9ef6b0b) 34.86%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7628      +/-   ##
==========================================
- Coverage   34.95%   34.86%   -0.09%     
==========================================
  Files        1030     1031       +1     
  Lines       27363    27433      +70     
  Branches     2253     2262       +9     
==========================================
+ Hits         9564     9565       +1     
- Misses      17289    17358      +69     
  Partials      510      510              
Files Coverage Δ
app/core/SDKConnect/SDKConnect.ts 2.72% <0.00%> (-0.02%) ⬇️
app/core/DeeplinkManager.js 1.25% <0.00%> (-0.01%) ⬇️
app/core/SDKConnect/BatchRPCManager.ts 0.00% <0.00%> (ø)
app/core/SDKConnect/Connection.ts 0.69% <1.58%> (+0.26%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@socket-security
Copy link

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@metamask/sdk-communication-layer 0.7.0...0.10.1 None +0/-0 16.7 MB metamaskbot

Copy link
Contributor

@omridan159 omridan159 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

omridan159
omridan159 previously approved these changes Oct 27, 2023
omridan159
omridan159 previously approved these changes Oct 27, 2023
andreahaku
andreahaku previously approved these changes Oct 27, 2023
Copy link
Member

@andreahaku andreahaku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@christopherferreira9 christopherferreira9 added QA in Progress QA has started on the feature. and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Oct 31, 2023
@abretonc7s abretonc7s dismissed stale reviews from omridan159 and andreahaku via c890d73 November 1, 2023 05:05
Copy link

sonarcloud bot commented Nov 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.8% 0.8% Coverage
0.0% 0.0% Duplication

@christopherferreira9 christopherferreira9 added QA Passed A successful QA run through has been done and removed QA in Progress QA has started on the feature. labels Nov 3, 2023
Copy link
Member

@andreahaku andreahaku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@christopherferreira9 christopherferreira9 merged commit a803ec8 into main Nov 3, 2023
28 checks passed
@christopherferreira9 christopherferreira9 deleted the feat/chain-rpc branch November 3, 2023 12:47
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2023
@metamaskbot metamaskbot added the release-7.11.0 Issue or pull request that will be included in release 7.11.0 label Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed A successful QA run through has been done release-7.11.0 Issue or pull request that will be included in release 7.11.0 team-sdk SDK team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants