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: default account type option #3607

Merged
merged 10 commits into from
Jan 14, 2025
Merged

Conversation

zoruka
Copy link
Contributor

@zoruka zoruka commented Jan 9, 2025

Description

Add defaultAccountTypes option for AppKit initialization.

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-1870
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

linear bot commented Jan 9, 2025

Copy link

changeset-bot bot commented Jan 9, 2025

🦋 Changeset detected

Latest commit: e22eb34

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

This PR includes changesets to release 19 packages
Name Type
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-core Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-solana 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-scaffold-ui 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 Jan 9, 2025

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

Name Status Preview Comments Updated (UTC)
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:46pm
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:46pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-vue-solana ⬜️ Ignored (Inspect) Jan 14, 2025 5:46pm
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) Jan 14, 2025 5:46pm
vue-wagmi-example ⬜️ Ignored (Inspect) Jan 14, 2025 5:46pm

@zoruka zoruka force-pushed the feat/default-account-type-option branch from a55f3cd to 284b907 Compare January 9, 2025 22:18
Copy link
Contributor

github-actions bot commented Jan 9, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 66.01% 18715 / 28349
🔵 Statements 66.01% 18715 / 28349
🔵 Functions 57.19% 1634 / 2857
🔵 Branches 78.16% 3121 / 3993
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/ethers/src/client.ts 47.22% 54.09% 63.63% 47.22% 40-98, 114-115, 146-147, 160-183, 186-196, 209-246, 251-252, 259-276, 281-298, 301-323, 326-331, 341-342, 349-354, 377-387, 390-417, 421-422, 435-436, 438, 460-461, 465, 479, 496-498, 505-509, 549-550, 555-556, 558-563, 572-590, 596-597, 601-606, 615-616, 627-628
packages/adapters/ethers5/src/client.ts 45.06% 55.55% 63.63% 45.06% 41-99, 115-116, 147-148, 161-184, 187-197, 210-246, 251-252, 259-276, 281-298, 301-323, 326-331, 341-342, 349-354, 377-404, 407-417, 421-422, 435-436, 438, 463-464, 468, 482, 499-501, 508-512, 543-563, 571-589, 595-596, 600-605, 614-615, 626-627
packages/adapters/wagmi/src/connectors/AuthConnector.ts 5.93% 100% 50% 5.93% 31-32, 35-169
packages/appkit/src/client.ts 60.23% 83.5% 76.08% 60.23% 199-200, 229-230, 245-246, 249-250, 265-268, 271-274, 294-295, 298-299, 315-332, 335-344, 615-616, 619-622, 625-626, 629-630, 633-634, 637-638, 645-649, 712-715, 742-743, 757-758, 767-768, 771-772, 777-778, 795-796, 814-834, 860-887, 890-939, 942-947, 963-967, 980-991, 994-1013, 1016-1022, 1025-1035, 1038-1050, 1053-1055, 1058-1060, 1063-1065, 1068-1070, 1073-1080, 1085-1143, 1147-1166, 1174-1188, 1191-1198, 1201-1215, 1218-1224, 1229, 1233, 1247, 1260-1261, 1269, 1272-1275, 1278-1284, 1294-1295, 1324-1340, 1348-1351, 1355-1369, 1373-1383, 1392-1393, 1398, 1404-1422, 1428-1435, 1446-1454, 1459-1468, 1471-1481, 1484-1564, 1567-1587, 1606, 1613, 1630, 1643-1644, 1679, 1702-1709, 1711-1722, 1725-1733, 1762-1778, 1781, 1793-1797, 1828-1832, 1837, 1839-1840, 1853-1854, 1859-1860, 1862-1863, 1868-1871, 1918-1922, 1947-1948, 1972-1973, 2002-2003, 2007-2008, 2097, 2099-2101, 326-831
packages/appkit/src/adapters/ChainAdapterBlueprint.ts 69.56% 80% 57.14% 69.56% 95-104, 111-120, 130-131, 142-143, 166-170, 176-179, 230-231
packages/appkit/src/utils/TypesUtil.ts 100% 100% 100% 100%
packages/core/src/controllers/OptionsController.ts 81.25% 97.43% 50.74% 81.25% 181, 190-193, 236, 240, 280, 288-291, 295-298, 302-305, 309-312, 324-326, 334
packages/core/src/utils/ConstantsUtil.ts 100% 100% 100% 100%
Generated in workflow #8825 for commit e22eb34 by the Vitest Coverage Report Action

this.setPreferredAccountType(preferredAccountType, namespace)

const userAccounts = user.accounts?.map(account =>
CoreHelperUtil.createAccount(
namespace,
account.address,
namespace === ConstantsUtil.CHAIN.EVM ? account.type : 'eoa'
account.type || OptionsController.state.defaultAccountTypes[namespace]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not using preferredAccountType variable here?

Suggested change
account.type || OptionsController.state.defaultAccountTypes[namespace]
account.type || preferredAccountType

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's this way because here it is mapping the accounts from user, which seems to may be different from user.preferredAccountType

@zoruka zoruka merged commit a66de04 into main Jan 14, 2025
19 checks passed
@zoruka zoruka deleted the feat/default-account-type-option branch January 14, 2025 18:42
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