File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -14,22 +14,30 @@ export function cleanIExecSDKs() {
1414 readonlyIExec = null ;
1515}
1616
17- export async function initIExecSDKs ( { connector } : { connector ?: Connector } ) {
17+ export async function initIExecSDKs ( {
18+ connector,
19+ chainId,
20+ } : {
21+ connector ?: Connector ;
22+ chainId ?: number ;
23+ } ) {
24+ let provider = chainId as unknown as Eip1193Provider ;
1825 if ( ! connector || ! connector . getProvider ) {
1926 cleanIExecSDKs ( ) ;
20- return ;
27+ } else {
28+ provider = ( await connector . getProvider ( ) ) as Eip1193Provider ;
2129 }
22-
23- const provider = ( await connector . getProvider ( ) ) as Eip1193Provider ;
2430 if ( ! provider ) {
2531 cleanIExecSDKs ( ) ;
2632 return ;
2733 }
34+
2835 // Initialize
2936 const config = new IExecConfig (
3037 { ethProvider : provider } ,
3138 { allowExperimentalNetworks : true }
3239 ) ;
40+ console . log ( 'config' , provider ) ;
3341 iExec = new IExec ( config ) ;
3442
3543 IEXEC_CLIENT_RESOLVES . forEach ( ( resolve ) => resolve ( iExec ! ) ) ;
Original file line number Diff line number Diff line change @@ -42,11 +42,8 @@ export function ChainSyncManager() {
4242 if ( accountChain ?. id && chainId !== accountChain ?. id ) {
4343 setChainId ( accountChain ?. id ) ;
4444 }
45- if ( accountStatus === 'connected' ) {
46- initIExecSDKs ( { connector : accountConnector } ) ;
47- return ;
48- }
4945 cleanIExecSDKs ( ) ;
46+ initIExecSDKs ( { connector : accountConnector , chainId } ) ;
5047 } , [
5148 accountAddress ,
5249 accountIsConnected ,
You can’t perform that action at this time.
0 commit comments