Better provider init

This commit is contained in:
Aleksandr Kraiz
2023-02-20 18:28:19 +04:00
parent e8934b1698
commit a2badabdbb
3 changed files with 5 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.17.15",
"version": "0.17.16",
"description": "Orion Protocol SDK",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",

View File

@@ -76,7 +76,9 @@ export default class OrionUnit {
// this.env = config.env;
this.chainId = config.chainId;
this.networkCode = chainInfo.code;
this.provider = new ethers.providers.StaticJsonRpcProvider(this.config.nodeJsonRpc);
const intNetwork = parseInt(this.chainId, 10);
if (Number.isNaN(intNetwork)) throw new Error('Invalid chainId (not a number)' + this.chainId);
this.provider = new ethers.providers.StaticJsonRpcProvider(this.config.nodeJsonRpc, intNetwork);
this.orionBlockchain = new OrionBlockchain(this.config.services.orionBlockchain.http);
this.orionAggregator = new OrionAggregator(

View File

@@ -3,6 +3,7 @@ import { SupportedChainId } from '../types';
export const developmentChains = [
SupportedChainId.BSC_TESTNET,
SupportedChainId.ROPSTEN,
SupportedChainId.GOERLI,
SupportedChainId.FANTOM_TESTNET,
SupportedChainId.POLYGON_TESTNET,
SupportedChainId.OKC_TESTNET,