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: Injected Universal Provider #3177

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

ganchoradkov
Copy link
Member

Description

Please include a brief summary of the change.

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

changeset-bot bot commented Oct 31, 2024

🦋 Changeset detected

Latest commit: 2da6057

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

This PR includes changesets to release 18 packages
Name Type
@reown/appkit-scaffold-ui Patch
@reown/appkit Patch
@reown/appkit-core Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-common Patch
@reown/appkit-experimental Patch
@reown/appkit-polyfills Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-ui Patch
@reown/appkit-wallet Patch
@reown/appkit-wallet-button 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

vercel bot commented Oct 31, 2024

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

Name Status Preview Comments Updated (UTC)
appkit-builder ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 5:37pm
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 5:37pm
appkit-vue-solana ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 5:37pm
appkit-wagmi-cdn-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 5:37pm
vue-wagmi-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 5:37pm
web3modal-gallery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 5:37pm

Copy link
Contributor

github-actions bot commented Oct 31, 2024

Coverage Report for Coverage

Status Category Percentage Covered / Total
🔵 Lines 341.95000000000005% 4520 / 18806
🔵 Statements 341.95000000000005% 4520 / 18806
🔵 Functions 376.05% 372 / 1089
🔵 Branches 463.35% 684 / 1400
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/exports/index.ts 0% 0% 0% 0% 1-23
packages/appkit/src/client.ts 76.41% 74.5% 85.36% 76.41% 101-102, 108-110, 125-126, 129-130, 145-148, 151-154, 157-158, 187-198, 201-208, 303, 311, 349-352, 358-365, 368, 463-475, 490-493, 500-501, 511-512, 527-528, 531-532, 535-536, 539-540, 549-551, 557-564, 581-584, 624, 633-645
packages/appkit/src/library/react/index.ts 0% 0% 0% 0% 1-175
packages/appkit/src/universal-adapter/client.ts 50.45% 43.54% 45.94% 50.45% 118-122, 143-147, 151-152, 155, 160-161, 163-165, 177-181, 183-236, 249-251, 260-274, 290-306, 309-315, 317-323, 333-338, 341-345, 361, 374-379, 383-388, 395-417, 422-424, 426-429, 435-463, 480-488, 516-517, 519, 524-525, 547-548, 560-569, 572-575, 579-607, 646-650, 655-658, 675-676, 688-713, 730-737
packages/appkit/src/utils/TypesUtil.ts 100% 100% 100% 100%
packages/core/src/controllers/ChainController.ts 67.86% 59.37% 69.69% 67.86% 77-80, 83-87, 90-107, 115-116, 143-155, 159-167, 190-191, 233-243, 248-249, 269-270, 274-279, 282-297, 300-303, 314-319, 322-323, 328-329, 332-333, 348-353, 356-357, 362-363, 366-367, 383-384, 389-390, 402-403, 436-444, 447-448, 451-452, 491-492, 511-514, 537-538
packages/core/src/controllers/ConnectionController.ts 42.51% 63.15% 29.62% 42.51% 83-87, 94-95, 101-131, 154-156, 159-175, 178-179, 182-183, 186-187, 190-191, 194-195, 198-199, 202-203, 206-207, 210-211, 214-215, 236-237, 240-242, 245-246, 249-250, 253-254, 261-267, 273-274, 288-294, 299-300, 305-331
packages/core/src/controllers/RouterController.ts 56.79% 100% 62.5% 56.79% 117-118, 125-162, 201-208
packages/scaffold-ui/exports/index.ts 0% 0% 0% 0% 1-120
packages/scaffold-ui/src/modal/w3m-router/index.ts 0% 0% 0% 0% 1-195
packages/scaffold-ui/src/partials/w3m-connecting-wc-qrcode/index.ts 0% 0% 0% 0% 1-110
packages/scaffold-ui/src/partials/w3m-header/index.ts 0% 0% 0% 0% 1-329
packages/scaffold-ui/src/views/w3m-connecting-wc-basic-view/index.ts 0% 0% 0% 0% 1-40
packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts 0% 0% 0% 0% 1-208
Generated in workflow #7217 for commit 98fab2a by the Vitest Coverage Report Action

@enesozturk
Copy link
Contributor

@ganchoradkov @tomiir There is a Changeset file but the Changeset bot not detecting it, maybe something wrong with the current changeset?

* AppKit will generate its own instance by default in none provided
* @default undefined
*/
walletConnectProvider?: IUniversalProvider
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we call it walletConnectProvider (for company name matter) or universalProvider (or similar)?

@@ -237,6 +244,10 @@ export class AppKit {
// -- Public -------------------------------------------------------------------
public async open(options?: OpenOptions) {
await this.initOrContinue()
if (options?.uri && this.universalAdapter) {
console.log('options.uri', options.uri)
Copy link
Contributor

Choose a reason for hiding this comment

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

Log

@@ -1580,7 +1580,8 @@ export class AppKit {
}
}

this.universalProvider = await UniversalProvider.init(universalProviderOptions)
this.universalProvider =
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could avoid making changes to *-new packages until we start working on Reskin to keep the PRs smaller

* Enable manual control of WalletConnect connections.
* @default false
*/
enableUniversalProviderManualControl?: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this flag to expose to the users? If I'm not missing another detail, we could keep it as an internal state depending on the given walletConnectProvider, if they provide it this will be true, otherwise it'll be false by default. Just to keep the extra props as low as possible

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with Enes here. I think this can confuse user's.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can, the flag was to provide an option for delegating control of the provider entirely

@@ -225,6 +223,10 @@ export const ConnectionController = {
TransactionsController.resetTransactions()
StorageUtil.deleteWalletConnectDeepLink()
},
setUri(uri: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very important - an empty line between functions xd

const showConnectors =
featured.length || recommended.length || customWallets?.length || recent.length
// eslint-disable-next-line no-console
console.log('W3mConnectingWcBasicView.constructor()', recommended)
Copy link
Contributor

Choose a reason for hiding this comment

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

log

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.

5 participants