Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: if phantom is locked, might not able to open its popup #6115

Merged
merged 2 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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