Skip to content

Commit

Permalink
try catches
Browse files Browse the repository at this point in the history
  • Loading branch information
awojciak committed Sep 22, 2023
1 parent a138691 commit 0d7b9a4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
22 changes: 13 additions & 9 deletions sdk/packages/selector-polkadot/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,16 +503,20 @@ export class NightlyConnectAdapter implements Injected {
}

this._app.on('userConnected', () => {
if (this._chosenMobileWalletName) {
persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, this.network)
} else {
clearRecentStandardWalletForNetwork(this.network)
try {
if (this._chosenMobileWalletName) {
persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, this.network)
} else {
clearRecentStandardWalletForNetwork(this.network)
}
this._connected = true
this._connecting = false
this._appSessionActive = true
this._modal?.closeModal()
resolve()
} catch {
this.disconnect()
}
this._connected = true
this._connecting = false
this._appSessionActive = true
this._modal?.closeModal()
resolve()
})

if (this._modal) {
Expand Down
26 changes: 15 additions & 11 deletions sdk/packages/selector-solana/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,18 +506,22 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter {
}

this._app.on('userConnected', (e) => {
if (this._chosenMobileWalletName) {
persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, SOLANA_NETWORK)
} else {
clearRecentStandardWalletForNetwork(SOLANA_NETWORK)
try {
if (this._chosenMobileWalletName) {
persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, SOLANA_NETWORK)
} else {
clearRecentStandardWalletForNetwork(SOLANA_NETWORK)
}
this._publicKey = new PublicKey(e.publicKeys[0])
this._connected = true
this._connecting = false
this._appSessionActive = true
this.emit('connect', this._publicKey)
this._modal?.closeModal()
resolve()
} catch {
this.disconnect()
}
this._publicKey = new PublicKey(e.publicKeys[0])
this._connected = true
this._connecting = false
this._appSessionActive = true
this.emit('connect', this._publicKey)
this._modal?.closeModal()
resolve()
})
if (this._modal) {
this._modal.onClose = () => {
Expand Down
3 changes: 1 addition & 2 deletions sdk/packages/selector-sui/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ export class NightlyConnectSuiAdapter implements WalletAdapter {
this._modal?.closeModal()
resolve()
} catch (e) {
this._connecting = false
this.connecting = false
this.disconnect()
this._modal?.closeModal()
reject(e)
}
Expand Down

0 comments on commit 0d7b9a4

Please sign in to comment.