File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
packages/sdk/src/providers/gno-wallet Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,27 @@ export class GnoSocialWalletProvider extends GnoWalletProvider {
120120 ...( this . extraLoginOptions && { extraLoginOptions : this . extraLoginOptions } ) ,
121121 } ;
122122
123+ if ( this . web3auth . connected ) {
124+ const userInfo = await this . web3auth . getUserInfo ( ) ;
125+ const currentLoginType = userInfo . typeOfLogin ;
126+
127+ if ( currentLoginType !== this . socialType ) {
128+ const networks = [ ...this . networks ] ;
129+ await this . disconnect ( ) ;
130+
131+ this . setNetworks ( networks ) ;
132+ this . web3auth = await this . initializeWeb3Auth ( ) ;
133+ } else {
134+ const privateKey = await this . requestPrivateKey ( ) ;
135+ const privateKeyBytes = hexToUint8Array ( privateKey ) ;
136+ const wallet = await GnoWallet . fromPrivateKey ( privateKeyBytes , {
137+ addressPrefix : this . currentNetwork . addressPrefix ,
138+ } )
139+ this . wallet = wallet ;
140+ return this . connectProvider ( )
141+ }
142+ }
143+
123144 const provider = await this . web3auth . connectTo ( WALLET_ADAPTERS . AUTH , connectOptions ) ;
124145
125146 if ( ! provider ) {
You can’t perform that action at this time.
0 commit comments