Skip to content

fix: add support for Bitcoin test net in OKX Wallet #4691

Merged
svenvoskamp merged 44 commits intomainfrom
fix/add-testnet-okx
Jul 22, 2025
Merged

fix: add support for Bitcoin test net in OKX Wallet #4691
svenvoskamp merged 44 commits intomainfrom
fix/add-testnet-okx

Conversation

@svenvoskamp
Copy link
Copy Markdown
Contributor

Description

add support for Bitcoin test net in OKX Wallet

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

svenvoskamp added 30 commits May 6, 2025 09:33
@svenvoskamp svenvoskamp marked this pull request as ready for review July 22, 2025 15:53
@svenvoskamp svenvoskamp requested a review from a team July 22, 2025 15:54
@vercel
Copy link
Copy Markdown

vercel bot commented Jul 22, 2025

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

Name Status Preview Comments Updated (UTC)
appkit-basic-html ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 4:35pm
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 4:35pm
appkit-gallery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 4:35pm
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 4:35pm
10 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-basic-example ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
appkit-basic-sign-client-example ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
appkit-basic-up-example ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
appkit-ethers5-bera ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
appkit-nansen-demo ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
appkit-vue-solana ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
ethereum-provider-wagmi-example ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
next-wagmi-solana-bitcoin-example ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm
vue-wagmi-example ⬜️ Ignored (Inspect) Jul 22, 2025 4:35pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 22, 2025

Warnings
⚠️

🔑 Potential High‑entropy string detected in packages/adapters/bitcoin/src/connectors/OKXConnector.ts (line 212): com/web3/build/docs/...

⚠️

🔑 Potential High‑entropy string detected in packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts (line 263): 000000000933ea01ad0e...

Generated by 🚫 dangerJS against 5451345

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 22, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.82% 31331 / 40257
🔵 Statements 77.82% 31331 / 40257
🔵 Functions 69.14% 2577 / 3727
🔵 Branches 84.45% 6587 / 7799
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/bitcoin/src/connectors/OKXConnector.ts 98.52% 97.22% 100% 98.52% 141-142
Generated in workflow #13596 for commit 5451345 by the Vitest Coverage Report Action

Comment thread packages/adapters/bitcoin/src/connectors/OKXConnector.ts Outdated
cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Network Switch Fails, Connector State Corrupted

The OKXConnector.switchNetwork method introduces a state inconsistency. It unbinds events and replaces the wallet instance before attempting to connect to the new network. If the subsequent connect() call fails, the connector is left with the new, unconnected wallet, without event bindings, and the original working wallet state is unrecoverable, rendering the connector unusable.

packages/adapters/bitcoin/src/connectors/OKXConnector.ts#L123-L143

public async switchNetwork(_caipNetworkId: CaipNetwork['caipNetworkId']): Promise<void> {
const connector = OKXConnector.getWallet({
requestedChains: this.requestedChains,
getActiveNetwork: this.getActiveNetwork,
requestedCaipNetworkId: _caipNetworkId
})
if (!connector) {
throw new Error(`${this.name} wallet does not support network switching`)
}
this.unbindEvents()
this.wallet = connector.wallet
try {
await this.connect()
} catch (error) {
throw new Error(`${this.name} wallet does not support network switching`)
}
}

Fix in CursorFix in Web


Bug: OKX Connector Filters Out Bitcoin Testnet Chains

The chains getter in the OKX connector incorrectly filters supported networks, returning only Bitcoin mainnet chains. It should include Bitcoin Testnet chains, as the connector now supports both networks and uses the OKX_NETWORK_KEYS mapping for network identification.

packages/adapters/bitcoin/src/connectors/OKXConnector.ts#L42-L46

this.getActiveNetwork = getActiveNetwork
this.imageUrl = imageUrl
}
public get chains() {

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@svenvoskamp svenvoskamp added this pull request to the merge queue Jul 22, 2025
Merged via the queue into main with commit 10a13e8 Jul 22, 2025
41 checks passed
@svenvoskamp svenvoskamp deleted the fix/add-testnet-okx branch July 22, 2025 17:03
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.

2 participants