Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return addresses.map(address => {
const client = new elements.APIClient([address]);
return {
address,
client
}
})
}
apiHelper.clients.forEach(helperClient => {
expect(this.addresses).that.includes(helperClient.address);
expect(helperClient.client).to.be.an.instanceof(APIClient);
});
});
validateCorrectNode() {
const { address } = this.state;
const nodeURL = address !== '' ? addHttp(address) : address;
if (this.state.network === networks.customNode.code) {
const liskAPIClient = new Lisk.APIClient([nodeURL], {});
liskAPIClient.node.getConstants()
.then((res) => {
if (res.data) {
this.props.liskAPIClientSet({
network: this.getNetwork(this.state.network),
});
this.props.history.push(routes.register.path);
} else {
throw new Error();
}
}).catch(() => {
this.props.errorToastDisplayed({ label: i18next.t('Unable to connect to the node') });
});
} else {
const network = this.getNetwork(this.state.network);
this.props.liskAPIClientSet({ network });
return this.peers.map(ip => {
const url = `http://${ip}:${this.httpPort}`;
const client = new elements.APIClient([url]);
return {
ip,
url,
client,
};
});
}