Options
All
  • Public
  • Public/Protected
  • All
Menu

@colony/colony-js

colonyJS

colonyJS is a JavaScript library with a simple and predictable interface for application-layer integrations with the colonyNetwork smart contracts. To learn more about Colony, you can visit colony.io or read the White Paper.

This software is in ALPHA state. The API is subject to change (but shouldn't really).

Documentation

The documentation is automatically generated using TypeDoc. It's pretty alpha right now. You should check out the getColonyNetworkClient function in ColonyNetworkClient and the docs for the extended colony contracts clients/Colony/ColonyClientVX.

Get Started

import { getColonyNetworkClient, Network } = from '@colony/colony-js';
import { Wallet } from 'ethers';
import { JsonRpcProvider } from 'ethers/providers';

// For local connections (run an Ethereum node on port 8545);
const provider = new JsonRpcProvider();

// Put in your local network address here (deployed ether router address)
const networkAddress = '0xdabbad00';

(async () => {
  // Get a wallet instance
  const wallet = new Wallet(
    // This is a private key that is generated by the colony network ganache instance
    '0x0355596cdb5e5242ad082c4fe3f8bbe48c9dba843fe1f99dd8272f487e70efae',
    provider,
  );

  // Check out the logs to see the wallet address
  console.log('Wallet Address:', wallet.address);

  // Get a network client instance
  const networkClient = await getColonyNetworkClient(Network.Local, wallet, networkAddress)

  // Check out the logs to see the network address
  console.log('Network Address:', networkClient.address);

  // Get the colony client for the Meta Colony
  const colonyClient = await networkClient.getColonyClient(1);

  console.log('Meta Colony address:', colonyClient.address);
})()
  .then(() => process.exit())
  .catch(error => console.error(error));

Contributing

We welcome all contributions to colonyJS! See Contributing for more information.

Development

To release a new version

1) First, commit all your changes. Then run the tests:

npm test #just to be sure

2) Adjust the version in package.json

3) Let npm adjust the version in package-lock.json:

npm install

4) Commit the npm package files. Use the version set in the package.json (make sure to follow the version pattern):

git add pack*
git commit -m '2.0.1' # no `v`!

5) Tag the commit:

git tag v2.0.1 # here we use the `v`!

6) Push the changes and tags:

git push && git push --tags

7) Publish on npm:

npm publish --access=public 

Done 🎊

License

GPL-3.0

Generated using TypeDoc