Skip to content

Commit

Permalink
polkadot: set _connecting to false on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
awojciak committed Nov 9, 2023
1 parent d20c5b9 commit 63abca0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sdk/apps/modal-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@nightlylabs/nightly-connect-sui": "0.0.28",
"@nightlylabs/wallet-selector-sui": "0.2.6",
"@nightlylabs/nightly-connect-polkadot": "0.0.12",
"@nightlylabs/wallet-selector-polkadot": "0.1.11",
"@nightlylabs/wallet-selector-polkadot": "0.1.12",
"@polkadot/extension-inject": "^0.46.5",
"@polkadot/api": "^10.10.1",
"@solana/web3.js": "^1.77.2",
Expand Down
2 changes: 1 addition & 1 deletion sdk/packages/selector-polkadot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nightlylabs/wallet-selector-polkadot",
"version": "0.1.11",
"version": "0.1.12",
"description": "",
"type": "module",
"exports": {
Expand Down
36 changes: 20 additions & 16 deletions sdk/packages/selector-polkadot/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,22 +574,26 @@ export class NightlyConnectAdapter implements Injected {
})

disconnect = async () => {
// Some apps might use disconnect to reset state / recreate session
clearSessionIdForNetwork(this.network)
this._appSessionActive = false
this._app = await AppPolkadot.build(this._appInitData)
if (this._innerStandardAdapter) {
this._innerStandardAdapter = undefined
persistStandardDisconnectForNetwork(this.network)
}
// Update recent wallet
this.walletsList = getPolkadotWalletsList(
this._metadataWallets,
getRecentStandardWalletForNetwork(this.network) ?? undefined
)
if (this._modal) {
this._modal.walletsList = this.walletsList
try {
// Some apps might use disconnect to reset state / recreate session
clearSessionIdForNetwork(this.network)
this._appSessionActive = false
this._app = await AppPolkadot.build(this._appInitData)
if (this._innerStandardAdapter) {
this._innerStandardAdapter = undefined
persistStandardDisconnectForNetwork(this.network)
}
// Update recent wallet
this.walletsList = getPolkadotWalletsList(
this._metadataWallets,
getRecentStandardWalletForNetwork(this.network) ?? undefined
)
if (this._modal) {
this._modal.walletsList = this.walletsList
}
this._connected = false
} finally {
this._connecting = false
}
this._connected = false
}
}
2 changes: 1 addition & 1 deletion sdk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63abca0

Please sign in to comment.