Secure the networkBug Bounty 2019

Clients

Clients are aggregations of all the interactions possible with the colonyNetwork smart contracts that can be used to easily integrate Colony into your JavaScript application or service. Each client is a subclass of the ContractClient superclass (see ContractClient for more information).

Initializing Clients

colonyJS makes it simple to create a new instance of a ContractClient subclass. Let's take a look at examples for each subclass.

ColonyNetworkClient

You can create an instance of ColonyNetworkClient by providing an adapter:

const networkClient = new ColonyNetworkClient({ adapter });

await networkClient.init();

ColonyClient

The easiest way to initialize the ColonyClient is to ask the ColonyNetworkClient for a new instance:

const colonyClient = await networkClient.getColonyClient(colonyId);

You could also create an instance of ColonyClient by providing an adapter and a query:

const colonyClient = new ColonyClient({ adapter, query });

await colonyClient.init();

MetaColonyClient

The easiest way to initialize the MetaColonyClient is to ask the ColonyNetworkClient for a new instance:

const metaColonyClient = await networkClient.getMetaColonyClient();

You could create an instance of MetaColonyClient by providing an adapter and a query:

const metaColonyClient = new MetaColonyClient({ adapter, query });

await metaColonyClient.init();

TokenClient

The TokenClient is initialized for you when you ask the ColonyNetworkClient for a new instance of ColonyClient:

const tokenClient = colonyClient.token;

You could create an instance of TokenClient by providing an adapter and a query:

const tokenClient = new TokenClient({ adapter, query });

await tokenClient.init();