2.0.2 • Published 7 days ago

@colony/sdk v2.0.2

Weekly downloads
-
License
GPL-3.0-only
Repository
-
Last release
7 days ago

🚀 The Colony SDK. Get started with Colony quickly

Discord

Colony SDK

The Colony SDK is under heavy development by the community and will be an easy-to-use interface for the Colony Network contracts, providing simple functions that hide the dark magic going on under the hood of ColonyJS. It should cover the most common use cases and is constantly updated with new features.

Colony SDK also includes a variety of examples to get you up and building with Colony in no time!

Quickstart

// index.js
import { providers } from 'ethers';
import { ColonyNetwork, toEth } from '@colony/sdk';

// If MetaMask is installed there will be an `ethereum` object on the `window`
// NOTE: Make sure MetaMask is connected to Gnosis chain (see https://www.xdaichain.com/for-users/wallets/metamask/metamask-setup)
const provider = new providers.Web3Provider(window.ethereum);

// Get the Colony's XDAI funding in the ROOT pot (id 1)
const start = async () => {
  // This will try to connect the page to MetaMask
  await provider.send('eth_requestAccounts', []);
  // Create a new connection to the Colony Network contracts using the MetaMask "wallet"
  const colonyNetwork = new ColonyNetwork(provider.getSigner());
  // Connect to the MetaColony (this could be replaced with your own colony using `colonyNetwork.getColony(COLONY_ADDRESS)`)
  const metaColony = await colonyNetwork.getMetaColony();
  // Get the CLNY funding for the MetaColony (CLNY is it's native token)
  const funding = await metaColony.getBalance();
  // The funding will be in wei (x * 10^18), so we format into a readable string using the `toEth` function
  alert('MetaColony balance is ' + toEth(funding) + ' CLNY');
};

start();

For more info, see the docs.

Running the examples

First, clone this repo:

git clone https://github.com/JoinColony/colonySDK.git

Then install all the required dependencies (this will install ethers.js and colonyJS as well as some required development dependencies):

npm install

Then you can run the examples:

Node.js

npm run examples:node

Browser (vanilla JS example)

npm run examples:browser

Some notes

These examples will run on Gnosis chain. If you'd like to make transactions, you will need some XDAI. Reach out to us in our Discord if you're having trouble starting out.

Development

Prerequisites

  • Node >=16.0.0

You may find it helpful to use Node Version Manager (nvm) to manage Node versions.

Creating a new release

colonySDK is using release-it to create new releases. To create and publish a new release, commit your changes, then execute

npm run release -- SEMVER_TAG # SEMVER_TAG is major, minor, patch

If you don't supply a GITHUB_TOKEN environment variable, release-it will open a browser window and pre-populate the corresponding release input fields for you.

Frequent commits and descriptive commit messages will help when release-it tries to autogenerate the changelog.

Contribute

Are you interested in contributing? Check out the following document for more information:

2.0.3-next.0

2 months ago

2.0.2

4 months ago

2.0.1

5 months ago

2.0.0

5 months ago

2.0.0-next.8

8 months ago

2.0.0-next.9

7 months ago

2.0.0-next.6

10 months ago

2.0.0-next.7

9 months ago

2.0.0-next.4

10 months ago

2.0.0-next.5

10 months ago

2.0.0-next.10

7 months ago

2.0.0-next.11

7 months ago

2.0.0-next.3

11 months ago

2.0.0-next.2

11 months ago

2.0.0-next.0

1 year ago

2.0.0-next.1

1 year ago

1.6.0

1 year ago

2.0.0-alpha.0

1 year ago

2.0.0-alpha.1

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.3

1 year ago

1.2.0

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.0.2

1 year ago

1.1.0

1 year ago

1.2.0-beta.1

1 year ago

1.2.0-beta.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.7.0-beta.0

2 years ago

0.7.0-beta.1

1 year ago

0.7.0-beta.2

1 year ago

0.8.0

1 year ago

0.7.0

1 year ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago