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

chore: update the 'sendMessage' method in the 'DeeplinkProtocolService' class #10304

Conversation

omridan159
Copy link
Contributor

@omridan159 omridan159 commented Jul 15, 2024

Description

Updated the sendMessage method in the DeeplinkProtocolService class.

Changes Made:

  • Attached chainId and selectedAccounts to each sent message.

Code Snippet:

async sendMessage(message: any, forceRedirect?: boolean) {
  const messageWithMetadata = {
    ...message,
    data: {
      ...message.data,
      chainId: this.getChainId(),
      accounts: this.getSelectedAccounts(),
    },
  };
  // rest of the method implementation
}

This PR addresses several key issues and enhancements:

  1. Account Screen Hang Fix:
  • Resolved an issue where the account screen would hang due to a chain mismatch. Now, users will either be switched automatically or prompted to switch chains, ensuring a smooth user experience.
  1. Chain Switching Improvement:
  • Enhanced the handling of chain switching. Users can now switch chains in MetaMask without unnecessary alerts or state preservation issues. This allows for a more seamless interaction with Warpcast.
  1. Batch Request Handling:
  • Fixed the problem where batch requests were returning empty arrays. The system now correctly handles batch requests with methods like wallet_switchEthereumChain.
  1. Deeplink Protocol Service Updates:
  • Updated the sendMessage method to include chainId and selected accounts in the message metadata. This ensures that all messages carry the necessary information for accurate processing.
  • Improved the handling of multichain RPC call responses, ensuring that batch RPC responses are managed correctly and users are redirected appropriately if an error occurs.

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

@omridan159 omridan159 requested review from a team as code owners July 15, 2024 14:12
@omridan159 omridan159 self-assigned this Jul 15, 2024
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.

@omridan159 omridan159 added needs-qa Any New Features that needs a full manual QA prior to being added to a release. team-sdk SDK team needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jul 15, 2024
andreahaku
andreahaku previously approved these changes Jul 15, 2024
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

elefantel
elefantel previously approved these changes Jul 15, 2024
Copy link
Contributor

@elefantel elefantel left a comment

Choose a reason for hiding this comment

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

Looks good

@omridan159 omridan159 dismissed stale reviews from elefantel and andreahaku via 69b1866 July 16, 2024 07:30
Copy link

sonarcloud bot commented Jul 16, 2024

@christopherferreira9 christopherferreira9 added QA in Progress QA has started on the feature. QA Passed A successful QA run through has been done and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. QA in Progress QA has started on the feature. QA Passed A successful QA run through has been done labels Jul 16, 2024
@christopherferreira9
Copy link
Contributor

christopherferreira9 commented Jul 16, 2024

Good for iOS and Android using the ReactNative SDK.

Test cases

GIVEN that a user has a ReactNative SDK dapp installed on iOS
WHEN the user changes the chain on the wallet side after connecting
AND the user tries to sign
THEN the user should get a message warning that chains are out of sync

GIVEN that a user has a ReactNative SDK dapp installed on Android
AND the user tries to sign
WHEN the user changes the chain on the wallet side after connecting
THEN the suer should be prompt to sign

GIVEN that a user has a ReactNative SDK dapp installed on iOS
WHEN the user tris to perform batch with: switchChain + sign
THEN the response should not contain the null in the first response

A the time of testing this PR for android it still returns [null, 0x00..] but it is fixed for ios where the response looks like [0x00..]

@christopherferreira9 christopherferreira9 added QA Passed A successful QA run through has been done Run Smoke E2E Triggers smoke e2e on Bitrise and removed QA in Progress QA has started on the feature. labels Jul 16, 2024
Copy link
Contributor

github-actions bot commented Jul 16, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 3dadfe4
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/65cb9d88-2165-4b18-8a1d-b07c816e5fd4

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link
Contributor

@elefantel elefantel left a comment

Choose a reason for hiding this comment

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

Looks good

@christopherferreira9 christopherferreira9 removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jul 17, 2024
@christopherferreira9 christopherferreira9 merged commit 99ac349 into main Jul 17, 2024
59 of 62 checks passed
@christopherferreira9 christopherferreira9 deleted the feat_update-DeeplinkProtocolService-sendMessage-method branch July 17, 2024 08:40
@github-actions github-actions bot locked and limited conversation to collaborators Jul 17, 2024
@metamaskbot metamaskbot added the release-7.28.0 Issue or pull request that will be included in release 7.28.0 label Jul 17, 2024
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.28.0 Issue or pull request that will be included in release 7.28.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-sdk SDK team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants