@iexec/dataprotector
Version:
This product enables users to confidentially store data–such as mail address, documents, personal information ...
16 lines • 507 B
JavaScript
import { IExecNetworkModule } from 'iexec';
import { DEFAULT_CHAIN_ID } from '../config/config.js';
export async function getChainIdFromProvider(ethProvider) {
try {
const networkModule = new IExecNetworkModule({
ethProvider,
});
const { chainId } = await networkModule.getNetwork();
return Number(chainId);
}
catch (e) {
console.warn('Failed to detect chainId:', e);
}
return DEFAULT_CHAIN_ID;
}
//# sourceMappingURL=getChainId.js.map