Skip to content

fix: bitcoin account publickey doesn't set on reconnect#4947

Merged
tomiir merged 9 commits intomainfrom
enes/apkt-3693-bob-when-refrefreshing-page-bitcoin-connector-reconnects-but
Sep 3, 2025
Merged

fix: bitcoin account publickey doesn't set on reconnect#4947
tomiir merged 9 commits intomainfrom
enes/apkt-3693-bob-when-refrefreshing-page-bitcoin-connector-reconnects-but

Conversation

@enesozturk
Copy link
Copy Markdown
Contributor

Description

When reconnecting the adapter connections, the publicKey field of the Bitcoin account doesn't get set as expected.

Two problem identified on the base class' initialize method:

  • We are calling both await this.syncExistingConnection() and await this.syncAdapterConnections() and this causes getting the connection two times which is unnecessary.
  • When getting the account with await this.syncExistingConnection(), the publicKey returns under allAccounts objects, but await this.syncAdapterConnections() doesn't return the publicKey as expected. So when this function run after syncExistingConnection, the publicKey lost.

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

Copilot AI review requested due to automatic review settings September 3, 2025 07:05
@linear
Copy link
Copy Markdown

linear bot commented Sep 3, 2025

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Sep 3, 2025

🦋 Changeset detected

Latest commit: b14a966

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

This PR includes changesets to release 24 packages
Name Type
@reown/appkit 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-universal-connector Patch
@reown/appkit-cdn Patch
@reown/appkit-experimental Patch
@reown/appkit-testing Patch
@reown/appkit-common Patch
@reown/appkit-ui Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-cli Patch
@reown/appkit-pay Patch
@reown/appkit-codemod 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

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Sep 3, 2025 0:21am
appkit-demo Ready Ready Preview Comment Sep 3, 2025 0:21am
appkit-gallery Ready Ready Preview Comment Sep 3, 2025 0:21am
appkit-laboratory Ready Ready Preview Sep 3, 2025 0:21am
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Sep 3, 2025 0:21am
appkit-basic-sign-client-example Ignored Ignored Sep 3, 2025 0:21am
appkit-basic-up-example Ignored Ignored Sep 3, 2025 0:21am
appkit-ethers5-bera Ignored Ignored Sep 3, 2025 0:21am
appkit-nansen-demo Ignored Ignored Sep 3, 2025 0:21am
appkit-vue-solana Ignored Ignored Sep 3, 2025 0:21am
appkit-wagmi-cdn-example Ignored Ignored Sep 3, 2025 0:21am
ethereum-provider-wagmi-example Ignored Ignored Sep 3, 2025 0:21am
next-wagmi-solana-bitcoin-example Ignored Ignored Sep 3, 2025 0:21am
vue-wagmi-example Ignored Ignored Sep 3, 2025 0:21am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where Bitcoin account publicKey is not properly set during adapter reconnection. The fix addresses duplicate synchronization calls and missing publicKey retrieval.

  • Removes duplicate call to syncExistingConnection() during initialization to prevent redundant connection syncing
  • Refactors syncAdapterConnections() to use a new syncAdapterConnection() method for cleaner code
  • Adds debug logging to investigate account data during synchronization

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/appkit/src/client/appkit-base-client.ts Removes duplicate sync call and refactors adapter connection logic with debug logging
packages/appkit/exports/constants.ts Updates package version from 1.8.0 to 1.8.2
apps/laboratory/src/layout/LayoutHeader.tsx Simplifies URL display logic by removing pathname dependency
.changeset/orange-parents-stay.md Adds changeset entry documenting the Bitcoin publicKey fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/appkit/src/client/appkit-base-client.ts Outdated
Comment thread packages/appkit/src/client/appkit-base-client.ts Outdated
cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 3, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.33% 34856 / 44498
🔵 Statements 78.33% 34856 / 44498
🔵 Functions 76.08% 3837 / 5043
🔵 Branches 86.65% 8219 / 9485
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/bitcoin/src/adapter.ts 85.12% 84.78% 73.33% 85.12% 68-81, 203-204, 292-293, 325-326, 338-339, 387-388, 444-447, 451-484, 488-489
packages/adapters/ethers/src/client.ts 64.6% 72.88% 68.57% 64.6% 51-52, 55-56, 63-65, 87-88, 102-105, 147-148, 179-180, 194-217, 230-266, 272-273, 280-297, 365-387, 390-395, 407-408, 418-439, 444-445, 468, 495-496, 505-506, 551-597, 604-605, 627, 656-657, 668-669, 703-704, 708, 735-740, 749-767, 773-774, 783-784, 795-796, 802-814
packages/adapters/ethers5/src/client.ts 55.38% 72.16% 60% 55.38% 48-134, 150-151, 182-183, 197-220, 233-269, 275-276, 283-300, 368-390, 393-398, 410-411, 421-442, 447-448, 471, 498-499, 508-509, 539-585, 607-608, 630, 659-660, 672-673, 710-711, 715, 734-748, 756-774, 780-781, 790-791, 802-803, 809-821
packages/adapters/solana/src/client.ts 65.11% 75.71% 38.88% 65.11% 92-99, 103-104, 132-135, 138-139, 142-143, 146-147, 150-153, 156-164, 171-172, 182-202, 205-258, 261-262, 265-266, 274-275, 280-287, 307-320, 343-346, 370-371, 381-382, 401-402, 409-410, 434-435, 439-440, 443-444, 481-485, 509-510, 533-539
packages/appkit-utils/src/HelpersUtil.ts 81.81% 100% 78.57% 81.81% 95-101, 127-136, 134
packages/appkit/exports/constants.ts 100% 100% 100% 100%
packages/appkit/src/adapters/ChainAdapterBlueprint.ts 75% 91.66% 75.75% 75% 152-163, 245-246, 250-251, 274-278, 284-287, 511-538, 566-571, 598-599, 612-640, 649-650, 549
packages/appkit/src/client/appkit-base-client.ts 72.21% 87.08% 75.89% 72.21% 184, 197-200, 203, 212-213, 282-283, 285-286, 291-292, 373-374, 410-416, 481-482, 508-509, 512-513, 555-556, 559, 600-604, 611-612, 615-616, 627-650, 659-660, 677-689, 693-714, 717-723, 726-732, 735-741, 744-750, 753-763, 766-772, 775-781, 801-810, 813-819, 822-823, 826-827, 846-847, 871-913, 920-932, 938-971, 974-984, 1036-1037, 1042, 1057-1073, 1087, 1091-1098, 1127-1128, 1165-1167, 1171-1184, 1189-1190, 1198-1199, 1201-1202, 1294-1295, 1307-1308, 1313, 1336-1341, 1384, 1405-1406, 1416, 1418-1434, 1439, 1484-1485, 1498-1509, 1555-1568, 1613, 1619-1623, 1642-1643, 1662-1665, 1701-1720, 1743-1754, 1783-1784, 1790-1816, 2026-2027, 2059-2060, 2063-2064, 2077-2080, 2083-2084, 2104-2105, 2108-2109, 2121-2131, 2149-2150, 2153-2160, 2164-2165, 2179, 2187, 2190, 2194, 2199-2218, 2221-2230, 2237-2238, 2252-2253, 2256-2257, 2264-2265, 2304-2305, 2388-2389, 2392-2393, 2396-2399, 2402-2403, 2406-2407, 2410-2411, 2414-2415, 2418-2422, 2431-2440, 2449-2460, 1182, 1750, 2201-2222
packages/appkit/src/connections/ConnectionManager.ts 91.28% 92.75% 60% 91.28% 67, 233-249, 326-247
Generated in workflow #14802 for commit b14a966 by the Vitest Coverage Report Action

@enesozturk enesozturk force-pushed the enes/apkt-3693-bob-when-refrefreshing-page-bitcoin-connector-reconnects-but branch from 434b7c0 to 849b1c6 Compare September 3, 2025 10:46
Comment thread apps/laboratory/src/components/AppKitInfoMultiChain.tsx
Comment thread apps/laboratory/src/layout/LayoutHeader.tsx
Comment thread packages/adapters/bitcoin/src/adapter.ts Outdated
Comment thread packages/appkit/src/connections/ConnectionManager.ts
Comment thread packages/appkit-utils/src/HelpersUtil.ts
Comment thread packages/appkit/src/adapters/ChainAdapterBlueprint.ts Outdated
Comment thread packages/appkit/src/client/appkit-base-client.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 3, 2025

Warnings
⚠️

🔑 Potential UUID detected in packages/adapters/ethers/src/tests/client.test.ts (line 962): ba0ba0cd-17c6-4806-a...

Generated by 🚫 dangerJS against b14a966

@enesozturk enesozturk enabled auto-merge September 3, 2025 12:56
@enesozturk enesozturk added this pull request to the merge queue Sep 3, 2025
@tomiir tomiir removed this pull request from the merge queue due to a manual request Sep 3, 2025
@tomiir tomiir merged commit 382fb6b into main Sep 3, 2025
41 checks passed
@tomiir tomiir deleted the enes/apkt-3693-bob-when-refrefreshing-page-bitcoin-connector-reconnects-but branch September 3, 2025 13:02
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