How to use the lisk-elements.APIClient function in lisk-elements

To help you get started, we’ve selected a few lisk-elements examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-core / support / api_helper.js View on Github external
return addresses.map(address => {
                const client = new elements.APIClient([address]);
                return {
                    address,
                    client
                }
            })
        }
github LiskHQ / lisk-core / step_definitions / background / node.js View on Github external
apiHelper.clients.forEach(helperClient => {
        expect(this.addresses).that.includes(helperClient.address);
        expect(helperClient.client).to.be.an.instanceof(APIClient);
    });
});
github LiskHQ / lisk-desktop / src / components / login / login.js View on Github external
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 });
github LiskHQ / lisk-core / qa / support / api.js View on Github external
return this.peers.map(ip => {
			const url = `http://${ip}:${this.httpPort}`;
			const client = new elements.APIClient([url]);
			return {
				ip,
				url,
				client,
			};
		});
	}