@emeris/chain-config
Advanced tools
Comparing version 0.2.2 to 0.2.3-pr-170-c95057c2d1a7eac3bc5f0c9c2ba22e7e83c09e2b.0
@@ -6,2 +6,3 @@ "use strict"; | ||
class ChainConfig { | ||
endpoint; | ||
constructor(endpoint) { | ||
@@ -21,6 +22,5 @@ this.endpoint = endpoint; | ||
async getChain(chain_name) { | ||
var _a; | ||
try { | ||
const result = (await (await fetch(this.endpoint + '/chain/' + chain_name)).json()); | ||
return (_a = result.chain) !== null && _a !== void 0 ? _a : null; | ||
return result.chain ?? null; | ||
} | ||
@@ -32,6 +32,5 @@ catch (e) { | ||
async getChainId(chain_name) { | ||
var _a, _b; | ||
try { | ||
const chain = await this.getChain(chain_name); | ||
return (_b = (_a = chain === null || chain === void 0 ? void 0 : chain.node_info) === null || _a === void 0 ? void 0 : _a.chain_id) !== null && _b !== void 0 ? _b : null; | ||
return chain?.node_info?.chain_id ?? null; | ||
} | ||
@@ -67,6 +66,5 @@ catch (e) { | ||
async getNumbers(chain_name, key_hash) { | ||
var _a; | ||
try { | ||
const result = (await (await fetch(this.endpoint + '/chain/' + chain_name + '/numbers/' + key_hash)).json()); | ||
return (_a = result.numbers) !== null && _a !== void 0 ? _a : null; | ||
return result.numbers ?? null; | ||
} | ||
@@ -87,3 +85,3 @@ catch (e) { | ||
})).json()); | ||
return result !== null && result !== void 0 ? result : null; | ||
return result ?? null; | ||
} | ||
@@ -90,0 +88,0 @@ catch (e) { |
{ | ||
"name": "@emeris/chain-config", | ||
"version": "0.2.2", | ||
"version": "0.2.3-pr-170-c95057c2d1a7eac3bc5f0c9c2ba22e7e83c09e2b.0+c95057c", | ||
"description": "Emeris chain config api Library", | ||
@@ -29,3 +29,3 @@ "author": "Ignite, Inc <hello@ignt.com>", | ||
"devDependencies": { | ||
"@emeris/types": "^0.2.2", | ||
"@emeris/types": "^0.2.3-pr-170-c95057c2d1a7eac3bc5f0c9c2ba22e7e83c09e2b.0+c95057c", | ||
"@types/node": "^17.0.23", | ||
@@ -37,3 +37,3 @@ "typescript": "^4.6.3" | ||
}, | ||
"gitHead": "e611fe47722136c46eeb24f067200c50bcf67a5d" | ||
"gitHead": "c95057c2d1a7eac3bc5f0c9c2ba22e7e83c09e2b" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5449
101
5