Skip to main content

API

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Domain

Ƭ Domain: ColonyDataTypes10.DomainStructOutput | ColonyDataTypes11.DomainStructOutput | ColonyDataTypes12.DomainStructOutput


EventSource

Ƭ EventSource: BaseContract

A valid eventsource (currently just an ethers.js BaseContract)


Metadata

Ƭ Metadata: AnnotationMetadata | ColonyMetadata | DecisionMetadata | DomainMetadata | MiscMetadata


MetadataEvent

Ƭ MetadataEvent<K>: typeof IpfsMetadataEvents[K]

Type parameters

NameType
Kextends MetadataType

Motion

Ƭ Motion: VotingReputationDataTypes7.MotionStructOutput | VotingReputationDataTypes8.MotionStructOutput | VotingReputationDataTypes9.MotionStructOutput


SignerOrProvider

Ƭ SignerOrProvider: Signer | Provider


SupportedColonyContract

Ƭ SupportedColonyContract: ColonyContract11 | ColonyContract12 | ColonyContract13


Token

Ƭ Token: ColonyToken | ERC20Token | ERC2612Token

Variables

ERC20Interface

Const ERC20Interface: TokenERC20Interface


ERC2612Interface

Const ERC2612Interface: TokenERC2612Interface


ERC721Interface

Const ERC721Interface: TokenERC721Interface


ExtensionVersions

Const ExtensionVersions: Object

Latest versions of all extension contracts

Type declaration

NameType
CoinMachine1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
EvaluatedExpenditure1 | 2 | 3 | 4
FundingQueue1 | 2 | 3 | 4 | 5
IVotingReputation1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
OneTxPayment1 | 2 | 3 | 4 | 5
ReputationBootstrapper1 | 2
StakedExpenditure1 | 2 | 3
StreamingPayments1 | 2
TokenSupplier1 | 2 | 3 | 4 | 5
VotingReputation1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Whitelist1 | 2 | 3 | 4

IpfsMetadataEvents

Const IpfsMetadataEvents: Object

Type declaration

NameType
annotation"Annotation(address,bytes32,string)"
colony"ColonyMetadata(address,string)"
decision"Annotation(address,bytes32,string)"
default""
domain"DomainMetadata(address,uint256,string)"
misc""

Functions

addressesAreEqual

addressesAreEqual(a, b): boolean

Check if two addresses are equal

Addresses can be displayed using a checksum format which contains uppercase and lowercase characters. This function can compare addresses in either format

Parameters

NameTypeDescription
astringLeft hand side address
bstringRight hand side address

Returns

boolean

Whether a and b are the same address


getToken

getToken(colonyNetwork, address): Promise<ERC20Token>

Get a properly instantiated Token contract client

This method tries to auto-detect the type of the token under the given address

Parameters

NameTypeDescription
colonyNetworkColonyNetworkA ColonyNetwork instance
addressstringThe token's address

Returns

Promise<ERC20Token>

A Token contract client


isExtensionCompatible

isExtensionCompatible(extension, extensionVersion, colonyVersion): boolean

Checks the compatibility of an extension version with a colony version it requests to be installed in Returns true if an extension version is compatible with the given colony version

Parameters

NameTypeDescription
extensionExtensionA valid Extension contract name
extensionVersionExtensionVersionThe version of the extension to check against the colony
colonyVersion2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13The version of the colony to check for

Returns

boolean

indication whether extension in given version is compatible with colony at the given version


parseLogs

parseLogs(logs, iface): LogDescription[]

Try to parse an array of logs with a given interface

Will filter out logs that can't be parsed with the given interface

Parameters

NameTypeDescription
logsLog[]Array of log entries (usually from a ContractReceipt)
ifaceInterfaceEthers compatible contract interface

Returns

LogDescription[]

A list of parsed log entries (events)


toEth

toEth(num): string

Convert any number to ETH (remove 18 zeros)

Example

import { toEth } from '@colony/sdk';

const oneEther = BigNumber.from("1000000000000000000");
console.log(toEth(oneEther)); // 1.0

Parameters

NameType
numBigNumberish

Returns

string


toWei

toWei(num): BigNumber

Convert any number to wei (add 18 zeros)

Example

import { toWei } from '@colony/sdk';

const oneEther = '1.0';
console.log(toWei(oneEther)); // { BigNumber: "1000000000000000000" }

Parameters

NameType
numstring

Returns

BigNumber


w

w(str): BigNumber

Short-hand method to convert a number to wei using JS tagged template strings

See also here: http://tc39wiki.calculist.org/es6/template-strings/

Remarks

This is only useful in contexts where the number is hard-coded (e.g. examples)

Example

import { w } from '@colony/sdk';

console.log(w`1.0`); // { BigNumber: "1000000000000000000" }

Parameters

NameType
strTemplateStringsArray

Returns

BigNumber