Skip to content

Commit

Permalink
fix: if phantom is locked, might not able to open its popup (#6115)
Browse files Browse the repository at this point in the history
* fix: if phantom is locked, might not able to open its popup

* fixup! fix: if phantom is locked, might not able to open its popup
  • Loading branch information
UncleBill authored Apr 22, 2022
1 parent 4ffae82 commit c795aaa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/plugins/Solana/src/UI/SNSAdaptor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Web3UI } from '../Web3UI'
const sns: Plugin.SNSAdaptor.Definition = {
...base,
async init(signal, context) {
setupStorage(context.createKVStorage('memory', StorageDefaultValue))
setupStorage(context.createKVStorage('persistent', StorageDefaultValue))
sns.Web3State = createWeb3State(signal)
await connectWallet(true)
await watchAccount()
Expand Down
3 changes: 1 addition & 2 deletions packages/plugins/Solana/src/base.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Plugin } from '@masknet/plugin-infra'
import { languages } from './locales/languages'
import { PLUGIN_ID, PLUGIN_ICON, PLUGIN_NAME, PLUGIN_DESCRIPTION, PLUGIN_PROVIDERS, PLUGIN_NETWORKS } from './constants'
import { PLUGIN_ID, PLUGIN_NAME, PLUGIN_DESCRIPTION, PLUGIN_PROVIDERS, PLUGIN_NETWORKS } from './constants'

export const base: Plugin.Shared.Definition = {
ID: PLUGIN_ID,
icon: PLUGIN_ICON,
name: { fallback: PLUGIN_NAME },
description: { fallback: PLUGIN_DESCRIPTION },
publisher: { name: { fallback: 'Mask Network' }, link: 'https://mask.io/' },
Expand Down
1 change: 0 additions & 1 deletion packages/plugins/Solana/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { PublicKey } from '@solana/web3.js'
export const PLUGIN_META_KEY = 'com.mask.solana'
export const PLUGIN_ID = 'com.mask.solana'
export const PLUGIN_NAME = 'Solana Chain'
export const PLUGIN_ICON = '\u{1F305}'
export const PLUGIN_DESCRIPTION = ''
export const PLUGIN_NETWORKS: Web3Plugin.NetworkDescriptor[] = [
{
Expand Down
5 changes: 4 additions & 1 deletion packages/plugins/Solana/src/wallet/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export async function storeConnection(pubKey: string | BNLike, chainId?: number)
}
}
export async function connectWallet(init = false) {
const rsp = await bridgedSolanaProvider.connect({ onlyIfTrusted: init })
let rsp: Awaited<ReturnType<typeof bridgedSolanaProvider.connect>> | null = null
try {
rsp = await bridgedSolanaProvider.connect({ onlyIfTrusted: init })
} catch {}
if (rsp?.publicKey) {
await storeConnection(rsp.publicKey)
}
Expand Down

0 comments on commit c795aaa

Please sign in to comment.