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

refactor: handle undefined caipNetwork when calling syncBalance #3679

Conversation

enesozturk
Copy link
Contributor

@enesozturk enesozturk commented Jan 17, 2025

Description

  • Refactors AppKit client to handle undefined network object when calling syncBalance
  • Refactors AppKit client tests to remove redundant mocks

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 Jan 17, 2025

🦋 Changeset detected

Latest commit: fe56fc5

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 Patch
@reown/appkit-core Patch
@reown/appkit-adapter-bitcoin 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-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 17, 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 17, 2025 2:24pm
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 17, 2025 2:24pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-vue-solana ⬜️ Ignored (Inspect) Jan 17, 2025 2:24pm
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) Jan 17, 2025 2:24pm
vue-wagmi-example ⬜️ Ignored (Inspect) Jan 17, 2025 2:24pm

Copy link
Contributor

github-actions bot commented Jan 17, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 68.47% 19479 / 28447
🔵 Statements 68.47% 19479 / 28447
🔵 Functions 59.12% 1697 / 2870
🔵 Branches 79.67% 3423 / 4296
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client.ts 61.48% 84.03% 77.17% 61.48% 172-173, 202-203, 218-219, 222-223, 238-241, 244-247, 267-268, 271-272, 288-305, 308-317, 588-589, 592-595, 598-599, 602-603, 606-607, 610-611, 618-622, 685-688, 715-716, 730-731, 740-741, 744-745, 750-751, 768-769, 790-806, 833-844, 847-884, 887-892, 908-912, 925-936, 939-958, 961-967, 970-980, 983-995, 998-1000, 1003-1005, 1008-1010, 1013-1015, 1018-1025, 1030-1088, 1092-1111, 1119-1133, 1136-1143, 1146-1160, 1163-1169, 1174, 1178, 1192, 1205-1206, 1214, 1217-1220, 1223-1229, 1239-1240, 1269-1285, 1293-1296, 1300, 1316-1326, 1335-1336, 1341, 1347-1365, 1371-1378, 1389-1397, 1402-1411, 1414-1424, 1427-1507, 1510-1530, 1549, 1556, 1573, 1586, 1623, 1646-1653, 1655-1666, 1669-1677, 1706-1722, 1737-1741, 1772-1776, 1797-1798, 1803-1804, 1806-1807, 1812-1815, 1826-1827, 1866-1870, 1895-1896, 1920-1921, 1950-1951, 1955-1956, 2045, 2047-2049, 299-804
packages/core/src/utils/StorageUtil.ts 69.43% 82.71% 77.55% 69.43% 22-23, 66-67, 83-86, 90-94, 102-103, 118-119, 128-131, 139-140, 149-152, 171-172, 179-182, 189-190, 197-200, 204-209, 216-217, 224-225, 236-239, 243-251, 255-263, 271-273, 275-276
Generated in workflow #8991 for commit a850e45 by the Vitest Coverage Report Action

Comment on lines +21 to +23
? isNaN(Number(stringChainId))
? stringChainId
: Number(stringChainId)
Copy link
Collaborator

@tomiir tomiir Jan 17, 2025

Choose a reason for hiding this comment

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

why do this instead of return?

Copy link
Contributor Author

@enesozturk enesozturk Jan 17, 2025

Choose a reason for hiding this comment

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

When we parse caipNetworkId, for both EVM and other chains the chainId will be string, but it's EVM only when Number(stringChainId)

This is to return correct typed chainId instead just string for it.

Previously we've been returning '1' for Mainnet, not it'll return 1

@enesozturk enesozturk merged commit 3305586 into main Jan 17, 2025
19 checks passed
@enesozturk enesozturk deleted the refactor/handle-syncbalance-for-unsupported-networks-and-cleanup-appkit-client-tests branch January 17, 2025 14:35
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.

4 participants