Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/okx-disconnect-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@satoshai/kit": patch
---

Fix OKX connect failure disconnecting the wrong provider by skipping the generic disconnect path for OKX, which uses its own SDK directly.
9 changes: 7 additions & 2 deletions packages/kit/src/provider/stacks-wallet-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,13 @@ export const StacksWalletProvider = ({
} catch (error) {
if (connectGenRef.current !== gen) return;
console.error('Failed to connect wallet:', error);
getSelectedProvider()?.disconnect?.();
clearSelectedProviderId();
// OKX uses its own SDK and never calls setSelectedProviderId,
// so getSelectedProvider() would return the previously connected
// provider — disconnecting the wrong wallet.
if (typedProvider !== 'okx') {
getSelectedProvider()?.disconnect?.();
clearSelectedProviderId();
}
options?.onError?.(error as Error);
} finally {
if (connectGenRef.current === gen) {
Expand Down