File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11import { IExec , IExecConfig , Eip1193Provider } from 'iexec' ;
22import { type Connector } from 'wagmi' ;
3+ import { getChainFromId } from '@/utils/chain.utils' ;
34
45let iExec : IExec | null = null ;
56let readonlyIExec : IExec | null = null ;
@@ -41,9 +42,12 @@ export function getIExec(): Promise<IExec> {
4142 return Promise . resolve ( iExec ) ;
4243}
4344
44- export function getReadonlyIExec ( ) : IExec {
45+ export function getReadonlyIExec ( chainId : number ) : IExec {
46+ const chain = getChainFromId ( chainId ) ;
47+ if ( ! chain ) throw new Error ( `Unknown chainId ${ chainId } ` ) ;
48+
4549 if ( ! readonlyIExec ) {
46- readonlyIExec = new IExec ( { ethProvider : 'bellecour' } ) ;
50+ readonlyIExec = new IExec ( { ethProvider : chain ?. slug } ) ;
4751 }
4852 return readonlyIExec ;
4953}
Original file line number Diff line number Diff line change @@ -70,7 +70,9 @@ export function SearcherBar({
7070 let resolvedValue = value ;
7171
7272 if ( value . endsWith ( '.eth' ) ) {
73- const iexec = isConnected ? await getIExec ( ) : getReadonlyIExec ( ) ;
73+ const iexec = isConnected
74+ ? await getIExec ( )
75+ : getReadonlyIExec ( chainId ! ) ;
7476 const resolved = await iexec . ens . resolveName ( value ) ;
7577 if ( ! resolved ) {
7678 throw new Error ( `Fail to resolve ENS : ${ value } ` ) ;
You can’t perform that action at this time.
0 commit comments