Skip to content

Commit

Permalink
add try catch blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
LukassF committed Feb 27, 2024
1 parent d4c6d5b commit 8953340
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 21 deletions.
16 changes: 10 additions & 6 deletions sdk/apps/modal-example/src/routes/aleph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ export default function Polkadot() {
fallback={
<button
onClick={async () => {
console.log(getPolkadotWallets())
await adapter()!.connect()
const accounts = await adapter()!.accounts.get()
console.log(accounts)
setPublicKey(accounts[0].address)
console.log('adapter', adapter())
try {
console.log(getPolkadotWallets())
await adapter()!.connect()
const accounts = await adapter()!.accounts.get()
console.log(accounts)
setPublicKey(accounts[0].address)
console.log('adapter', adapter())
} catch (err) {
console.log(err)
}
}}>
Connect
</button>
Expand Down
16 changes: 10 additions & 6 deletions sdk/apps/modal-example/src/routes/alephCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ export default function Polkadot() {
fallback={
<button
onClick={async () => {
console.log(getPolkadotWallets())
await adapter()!.connect()
const accounts = await adapter()!.accounts.get()
console.log(accounts)
setPublicKey(accounts[0].address)
console.log('adapter', adapter())
try {
console.log(getPolkadotWallets())
await adapter()!.connect()
const accounts = await adapter()!.accounts.get()
console.log(accounts)
setPublicKey(accounts[0].address)
console.log('adapter', adapter())
} catch (err) {
console.log(err)
}
}}>
Connect
</button>
Expand Down
16 changes: 10 additions & 6 deletions sdk/apps/modal-example/src/routes/alephInitOnConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ export default function Polkadot() {
fallback={
<button
onClick={async () => {
console.log(getPolkadotWallets())
await adapter()!.connect()
const accounts = await adapter()!.accounts.get()
console.log(accounts)
setPublicKey(accounts[0].address)
console.log('adapter', adapter())
try {
console.log(getPolkadotWallets())
await adapter()!.connect()
const accounts = await adapter()!.accounts.get()
console.log(accounts)
setPublicKey(accounts[0].address)
console.log('adapter', adapter())
} catch (err) {
console.log(err)
}
}}>
Connect
</button>
Expand Down
2 changes: 1 addition & 1 deletion sdk/packages/selector-polkadot/src/detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const getPolkadotWalletsList = (presetList: WalletMetadata[], recentWalle
detected: true,
injectedWallet: wallet,
walletType: 'hybrid',
homepage: ''
homepage: 'https://nightly.app/download'
}
}

Expand Down
8 changes: 6 additions & 2 deletions sdk/packages/selector-solana/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,12 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter {
) {
this.connectToMobileWallet(walletName)
} else {
await this.connectToStandardWallet(walletName)
resolve()
try {
await this.connectToStandardWallet(walletName)
resolve()
} catch (error) {
reject(error)
}
}
})

Expand Down

0 comments on commit 8953340

Please sign in to comment.