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

fix: approved caip networks data for universal provider #2872

Merged
merged 32 commits into from
Sep 26, 2024

Conversation

zoruka
Copy link
Contributor

@zoruka zoruka commented Sep 18, 2024

Description

This PR is adding the logic to verify the available networks when connecting through Universal Provider.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-xxx
For GH issues: closes #...

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

Copy link

vercel bot commented Sep 18, 2024

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

Name Status Preview Updated (UTC)
appkit-laboratory ✅ Ready (Inspect) Visit Preview Sep 26, 2024 8:38pm
web3modal-gallery ✅ Ready (Inspect) Visit Preview Sep 26, 2024 8:38pm
web3modal-laboratory ✅ Ready (Inspect) Visit Preview Sep 26, 2024 8:38pm

Copy link

changeset-bot bot commented Sep 18, 2024

🦋 Changeset detected

Latest commit: db27a61

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 34 packages
Name Type
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-core Patch
@apps/demo Patch
@apps/gallery Patch
@apps/laboratory Patch
@examples/html-ethers Patch
@examples/html-ethers5 Patch
@examples/html-wagmi Patch
@examples/next-ethers Patch
@examples/next-wagmi Patch
@examples/react-ethers Patch
@examples/react-ethers5 Patch
@examples/react-solana Patch
@examples/react-wagmi Patch
@examples/vue-ethers5 Patch
@examples/vue-solana Patch
@examples/vue-wagmi Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-polkadot Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-common Patch
@reown/appkit-ethers Patch
@reown/appkit-ethers5 Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-solana Patch
@reown/appkit-ui Patch
@reown/appkit-wagmi Patch
@reown/appkit-wallet Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Sep 18, 2024

Coverage Report for Coverage

Status Category Percentage Covered / Total
🔵 Lines 254.53% 4154 / 10287
🔵 Statements 254.53% 4154 / 10287
🔵 Functions 265% 322 / 804
🔵 Branches 308.02% 572 / 1051
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/appkit/src/universal-adapter/client.ts 59.81% 50% 53.12% 59.81% 95-96, 104-108, 126-127, 130, 138-140, 149-153, 155-157, 159-161, 163-165, 167-172, 174, 176-185, 187, 189-192, 194-199, 201, 203, 205-208, 221-223, 232-234, 236-238, 240-243, 245-246, 272-273, 291-296, 300-305, 315, 317-320, 326-334, 336, 338-339, 356-357, 359-364, 393, 402-403, 439-442, 444, 446-448, 451-454, 458-459, 461-470, 472-473, 475-478, 516-520, 525-528, 545-546, 558-560, 562-577
packages/appkit/src/utils/HelpersUtil.ts 100% 90.9% 100% 100%
packages/core/src/controllers/NetworkController.ts 59.02% 65.78% 72.22% 59.02% 46-47, 53-56, 58-67, 75-76, 89-90, 93-94, 107-113, 126-127, 133-134, 148-151, 165-167, 169-171, 173, 175-182, 185-186, 188-190, 192-193, 195, 197-201, 203-204, 208-209, 221-222, 239-240, 243-244, 257-258, 268, 270-272, 274-275, 279
Generated in workflow #6406

Copy link
Contributor

github-actions bot commented Sep 18, 2024

♻️ Vite-Size ♻️

Size Difference

Size (kb) Gzip (kb)
Total Diff. 0 0

Current Size

Name Size (kb) Gzip (kb)
assets/index-9VIn8s8w.js 1866.465 533.124
assets/index.js 9.63 3.16
assets/index2.js 11.572 3.197
assets/w3m-modal.js 7.408 2.618
assets/noble-curves.js 31.941 12.778
assets/2.21.4_bufferutil.js 2.789 1.327
assets/index3.js 102.251 29.115
assets/index4.js 304.393 87.285
assets/hooks.module.js 74.443 25.59
index.html 0.329 0.234
Total Size 2411.221 698.428

Base Size

Name Size (kb) Gzip (kb)
assets/index-9VIn8s8w.js 1866.465 533.124
assets/index.js 9.63 3.16
assets/index2.js 11.572 3.197
assets/w3m-modal.js 7.408 2.618
assets/noble-curves.js 31.941 12.778
assets/2.21.4_bufferutil.js 2.789 1.327
assets/index3.js 102.251 29.115
assets/index4.js 304.393 87.285
assets/hooks.module.js 74.443 25.59
index.html 0.329 0.234
Total Size 2411.221 698.428

approvedCaipNetworkIds: data?.approvedCaipNetworkIds,
supportsAllNetworks: data?.supportsAllNetworks
})
const networkControllerClient = ChainController.getNetworkControllerClient()
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only get the active namespace's networkControllerClient. Do we need to set data for other adapter's at the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not understand the question. Is it something extra we need to implement? These changes are only cleaning up the code, there is no logic change here

}
}
}
RouterController.push('SwitchNetwork', { ...routerData, network })
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the other cases? Like multiple adapter flows (SwitchActiveChain)? or ConnectingWalletConnect case? I don't see the other cases handled in the SwitchNetwork view

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm still in progress with that, this was one attempt to clean up the logic because I could not figure out what was intended to happen here. But I'll jam more over to get it sorted.

Comment on lines 49 to 52
if (library === 'solana') {
// Solana doesn't have disabled networks
return
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have a solanaUnsupported chain do we not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants