Skip to content

Commit

Permalink
Merge pull request #27 from WalletConnect/feat/appkit
Browse files Browse the repository at this point in the history
Update AppKit store on disconnect - calling syncAccount
  • Loading branch information
glitch-txs authored Jun 25, 2024
2 parents 4f0be4b + a33acf6 commit eee51a7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pnpm run <tag>

2. Bump a `patch` / `minor` / `major` / `prerelease`

prerelease will bump `alpha` or `beta` releases (e.g. from `v0.1.1-alpha.0` -> `v0.1.1-alpha.0`).
prerelease will bump `alpha` or `beta` releases (e.g. from `v0.1.1-alpha.0` -> `v0.1.1-alpha.1`).

```sh
pnpm run <replace-with-version>
Expand Down
8 changes: 8 additions & 0 deletions packages/appkit-universal/appKitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ export class WalletConnectModal extends Web3ModalScaffold {
this.universalProvider.events.on('display_uri', onUri)

await this.universalProvider.connect({ optionalNamespaces: this.requestedNamespaces })
this.universalProvider.removeListener('display_uri', onUri)
this.syncAccount()
},

disconnect: async () => {
await this.universalProvider.disconnect()
this.syncAccount()
},
}

Expand Down Expand Up @@ -102,6 +104,12 @@ export class WalletConnectModal extends Web3ModalScaffold {
universalProvider.client.on('session_delete', this.syncAccount)
}


async disconnect(){
await this.universalProvider.disconnect()
this.syncAccount()
}

// -- Private -----------------------------------------------------------------

private async syncAccount() {
Expand Down
2 changes: 1 addition & 1 deletion packages/appkit-universal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@walletconnect/solana-adapter-ui",
"version": "0.0.1-alpha.0",
"version": "0.0.1-alpha.1",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/appKitClient.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/walletconnect-solana/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@walletconnect/solana-adapter",
"version": "0.0.1-alpha.0",
"version": "0.0.1-alpha.1",
"license": "Apache-2.0",
"type": "module",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/walletconnect-solana/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class WalletConnectWallet {

async disconnect() {
if (this._UniversalProvider?.session) {
await this._UniversalProvider.disconnect()
await this._modal?.disconnect()
this._session = undefined
} else {
throw new ClientNotInitializedError()
Expand Down

0 comments on commit eee51a7

Please sign in to comment.