Skip to content

Commit

Permalink
feat!: provider being set correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixVS committed Feb 15, 2024
1 parent fc27f72 commit 622e909
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/solana/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ export class Web3Modal extends Web3ModalScaffold {
resolve(result)
}
})


}

const connectionControllerClient: ConnectionControllerClient = {
Expand Down Expand Up @@ -200,11 +198,10 @@ export class Web3Modal extends Web3ModalScaffold {
icons: ['https://avatars.githubusercontent.com/u/37784886'],
url: 'https://web3modal.com',
},
autoconnect: true,
autoconnect: false,
qrcode: true
})
SolStoreUtil.setConnection(new Connection(chain.rpcUrl ?? 'https://api.devnet.solana.com', 'recent'));
this.syncConnectors()

SolStoreUtil.subscribeKey('address', () => {
this.syncAccount()
Expand All @@ -217,6 +214,7 @@ export class Web3Modal extends Web3ModalScaffold {
if (typeof window === 'object') {
setTimeout(() => {
this.checkActiveProviders()
this.syncConnectors()
}, 500)
/*
Debugging for mobile
Expand Down Expand Up @@ -270,7 +268,6 @@ export class Web3Modal extends Web3ModalScaffold {
const w3mConnectors: Connector[] = []

const connectorType = PresetsUtil.ConnectorTypesMap[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID] as ConnectorType

w3mConnectors.push({
id: ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID,
explorerId: PresetsUtil.ConnectorExplorerIds[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID],
Expand Down
1 change: 0 additions & 1 deletion packages/solana/src/connectors/WalletConnectConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export class WalletConnectConnector extends BaseConnector implements Connector {
UniversalProviderFactory.getProvider().then(provider => {
provider.on('session_delete', () => {
delete provider.session?.namespaces['solana']
SolStoreUtil.setAddress('')
})
})

Expand Down
1 change: 1 addition & 0 deletions packages/solana/src/connectors/universalProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class UniversalProviderFactory {
}

public static async getProvider() {
console.log(`called get provider`, UniversalProviderFactory.provider);
if (!UniversalProviderFactory.provider) await UniversalProviderFactory.init()
if (!UniversalProviderFactory.provider)
throw new Error('Failed to initialize universal provider')
Expand Down

0 comments on commit 622e909

Please sign in to comment.