API
Namespaces
Enumerations
- ClientType
- ColonyNetworkAddress
- ColonyRole
- Core
- Extension
- FundingPotAssociatedType
- Id
- MotionState
- Network
- ReputationMinerEndpoints
- ReputationOracleEndpoint
- TokenClientType
Classes
Interfaces
- CoinMachineClientV1
- CoinMachineClientV2
- CoinMachineClientV3
- CoinMachineClientV4
- CoinMachineClientV5
- CoinMachineClientV6
- CoinMachineClientV7
- ColonyClientV1
- ColonyClientV10
- ColonyClientV11
- ColonyClientV12
- ColonyClientV2
- ColonyClientV3
- ColonyClientV4
- ColonyClientV5
- ColonyClientV6
- ColonyClientV7
- ColonyClientV8
- ColonyClientV9
- ColonyNetworkClient
- ColonyToken
- ColonyTokenClient
- DaiTokenClient
- ERC20Token
- ERC2612Token
- Erc20TokenClient
- Erc2612TokenClient
- EvaluatedExpenditureClientV1
- EvaluatedExpenditureClientV2
- IBasicMetaTransaction
- LegacyColonyTokenClient
- NetworkClientOptions
- OneTxPaymentClientV1
- OneTxPaymentClientV2
- OneTxPaymentClientV3
- OneTxPaymentClientV4
- StakedExpenditureClientV1
- StakedExpenditureClientV2
- StreamingPaymentsClientV1
- StreamingPaymentsClientV2
- Token
- TokenAuthority
- TokenLocking
- TokenLockingClient
- TokenSupplierClientV1
- TokenSupplierClientV2
- TokenSupplierClientV3
- TokenSupplierClientV4
- VotingReputationClientV1
- VotingReputationClientV2
- VotingReputationClientV3
- VotingReputationClientV4
- VotingReputationClientV5
- VotingReputationClientV6
- VotingReputationClientV7
- VotingReputationClientV8
- WhitelistClientV1
- WhitelistClientV2
- WhitelistClientV3
References
MetaTxToken
Renames and re-exports ColonyToken
MetaTxToken__factory
Renames and re-exports ColonyTokenFactory
TokenAuthority__factory
Re-exports TokenAuthority__factory
TokenLocking__factory
Re-exports TokenLocking__factory
Token__factory
Re-exports Token__factory
Type Aliases
AnyCoinMachineClient
Ƭ AnyCoinMachineClient: CoinMachineClientV1
| CoinMachineClientV2
| CoinMachineClientV3
| CoinMachineClientV4
| CoinMachineClientV5
| CoinMachineClientV6
| CoinMachineClientV7
AnyColonyClient
Ƭ AnyColonyClient: ColonyClientV1
| ColonyClientV2
| ColonyClientV3
| ColonyClientV4
| ColonyClientV5
| ColonyClientV6
| ColonyClientV7
| ColonyClientV8
| ColonyClientV9
| ColonyClientV10
| ColonyClientV11
| ColonyClientV12
AnyEvaluatedExpenditureClient
Ƭ AnyEvaluatedExpenditureClient: EvaluatedExpenditureClientV1
| EvaluatedExpenditureClientV2
AnyOneTxPaymentClient
Ƭ AnyOneTxPaymentClient: OneTxPaymentClientV1
| OneTxPaymentClientV2
| OneTxPaymentClientV3
| OneTxPaymentClientV4
AnyStakedExpenditureClient
Ƭ AnyStakedExpenditureClient: StakedExpenditureClientV1
| StakedExpenditureClientV2
AnyStreamingPaymentsClient
Ƭ AnyStreamingPaymentsClient: StreamingPaymentsClientV1
| StreamingPaymentsClientV2
AnyTokenSupplierClient
Ƭ AnyTokenSupplierClient: TokenSupplierClientV1
| TokenSupplierClientV2
| TokenSupplierClientV3
| TokenSupplierClientV4
AnyVotingReputationClient
Ƭ AnyVotingReputationClient: VotingReputationClientV1
| VotingReputationClientV2
| VotingReputationClientV3
| VotingReputationClientV4
| VotingReputationClientV5
| VotingReputationClientV6
| VotingReputationClientV7
| VotingReputationClientV8
AnyWhitelistClient
Ƭ AnyWhitelistClient: WhitelistClientV1
| WhitelistClientV2
| WhitelistClientV3
ColonyRoles
Ƭ ColonyRoles: UserRoles
[]
All users that have roles in a colony
ContractClient
Ƭ ContractClient: AnyColonyClient
| ColonyNetworkClient
| EventsClient
| ExtensionClient
| TokenClient
| TokenLockingClient
DomainRoles
Ƭ DomainRoles: Object
All roles a user has in domainId
Type declaration
Name | Type |
---|---|
domainId | number |
roles | ColonyRole [] |
EventsClient
Ƭ EventsClient: CoinMachineEvents
| EvaluatedExpenditureEvents
| IColonyEvents
| IColonyNetworkEvents
| IVotingReputationEvents
| MetaTxTokenEvents
| OneTxPaymentEvents
| StakedExpenditureEvents
| StreamingPaymentsEvents
| TokenSupplierEvents
| VotingReputationEvents
| WhitelistEvents
ExtensionClient
Ƭ ExtensionClient: AnyCoinMachineClient
| AnyEvaluatedExpenditureClient
| AnyFundingQueueClient
| AnyOneTxPaymentClient
| AnyReputationBootstrapperClient
| AnyStakedExpenditureClient
| AnyStreamingPaymentsClient
| AnyTokenSupplierClient
| AnyVotingReputationClient
| AnyWhitelistClient
SignerOrProvider
Ƭ SignerOrProvider: Signer
| Provider
TokenClient
Ƭ TokenClient: ColonyTokenClient
| LegacyColonyTokenClient
| Erc20TokenClient
| Erc2612TokenClient
| DaiTokenClient
UserRoles
Ƭ UserRoles: Object
All domains the user with address
has roles in
Type declaration
Name | Type |
---|---|
address | string |
domains | DomainRoles [] |
Variables
COLONY_VERSION_LATEST
• Const
COLONY_VERSION_LATEST: number
ERC20
• Const
ERC20: TokenERC20Interface
ERC721
• Const
ERC721: TokenERC721Interface
ExtensionVersions
• Const
ExtensionVersions: Object
Type declaration
Name | Type |
---|---|
CoinMachine | number |
EvaluatedExpenditure | number |
FundingQueue | number |
IVotingReputation | number |
OneTxPayment | number |
ReputationBootstrapper | number |
StakedExpenditure | number |
StreamingPayments | number |
TokenSupplier | number |
VotingReputation | number |
Whitelist | number |
Functions
formatColonyRoles
▸ formatColonyRoles(roleSetEvents
, recoveryRoleSetEvents
): Promise
<ColonyRoles
>
Format role events into an Array of all roles in the colony
E.g.:
[{
address: 0x5346D0f80e2816FaD329F2c140c870ffc3c3E2Ef // user address
domains: [{ // all domains the user has a role in
domainId: 1, // domainId for the roles
roles: [1, 2, 3] // Array of `ColonyRole`
}]
}]
Parameters
Name | Type |
---|---|
roleSetEvents | LogDescription [] |
recoveryRoleSetEvents | LogDescription [] |
Returns
Promise
<ColonyRoles
>
getBlockTime
▸ getBlockTime(provider
, blockHash
): Promise
<number
>
Get the JavaScript timestamp for a block
Parameters
Name | Type | Description |
---|---|---|
provider | Provider | ethers compatible Provider |
blockHash | string | Hash of block to get time for |
Returns
Promise
<number
>
block timestamp in ms
getChildIndex
▸ getChildIndex(client
, parentDomainId
, domainId
): Promise
<BigNumber
>
Get the child index for a domain inside its corresponding skills parent children array
E.g. (the values will differ for you!): domainId = 1 corresponding skillId = 2 parent of skillId 2:
{
// ...
children: [2]
}
childSkillIndex would be 0 in this case (0-position in children array)
Parameters
Name | Type | Description |
---|---|---|
client | AnyColonyClient | Any ColonyClient |
parentDomainId | BigNumberish | id of parent domain |
domainId | BigNumberish | id of the domain |
Returns
Promise
<BigNumber
>
Index in the children
array (see above)
getColonyNetworkClient
▸ getColonyNetworkClient(network
, signerOrProvider
, options?
): ColonyNetworkClient
The main entry point for accessing the deployed colonyNetwork contracts
Specify a network and an ethers compatible singer or provider to get back an initialized and extended (ethers) contract client for the colonyNetwork. From here you can access different colonies, extensions, ENS and other features of Colony.
Example
import { getColonyNetworkClient, Network } = from '@colony/colony-js';
import { providers } from 'ethers';
// For local connections (run an Ethereum node on port 8545);
const provider = new providers.JsonRpcProvider();
// Just for reading data - to sign transactions we need to pass in a signer.
const networkClient = await getColonyNetworkClient(Network.Xdai, provider);
Parameters
Name | Type | Description |
---|---|---|
network | Network | One of the available options. See Network. |
signerOrProvider | SignerOrProvider | An ethers compatible signer or provider instance |
options? | NetworkClientOptions | Here you can supply options for accessing certain contracts (mostly used in local/dev environments) |
Returns
getColonyRoles
▸ getColonyRoles(client
, options?
): Promise
<ColonyRoles
>
Get an array of all roles in the colony
Parameters
Name | Type | Description |
---|---|---|
client | AnyColonyClient | Any ColonyClient |
options? | LogOptions | - |
Returns
Promise
<ColonyRoles
>
Array of user roles in a colony (see above) fetching it's own network events
getCreateMotionProofs
▸ getCreateMotionProofs(client
, domainId
, altTarget
, action
): Promise
<{ actionCid
: BigNumber
; branchMask
: string
; key
: string
; siblings
: string
[] ; value
: string
}>
Gets the necessary proofs for motion creation
This gets the reputation and domain proofs for motion creation
Parameters
Name | Type | Description |
---|---|---|
client | AnyVotingReputationClient | Any VotingReputationClient |
domainId | BigNumberish | Domain id the motion will be created in |
altTarget | string | Target address for the motion (0x0 if Colony contract) |
action | BytesLike | The encoded action the motion will execute when finalized |
Returns
Promise
<{ actionCid
: BigNumber
; branchMask
: string
; key
: string
; siblings
: string
[] ; value
: string
}>
The necessary reputation and domain proofs to create a motion
getEvents
▸ getEvents(client
, filter
, options?
): Promise
<LogDescription
[]>
Get parsed event data from filter
Example:
// Gets the logs for the `ColonyFundsClaimed` event (not filtered)
const filter = colonyClient.filters.ColonyFundsClaimed(null, null, null);
const events = await getEvents(colonyClient, filter);
Parameters
Name | Type | Description |
---|---|---|
client | ContractClient | Any of the intantiated contract clients |
filter | Filter | ethers compatible Filter object |
options? | LogOptions | Configuration options to filter logs |
Returns
Promise
<LogDescription
[]>
Parsed ethers LogDescription array (events)
getExtensionHash
▸ getExtensionHash(extensionName
): string
Hashes to identify the colony extension contracts
Parameters
Name | Type |
---|---|
extensionName | string |
Returns
string
getHistoricColonyRoles
▸ getHistoricColonyRoles(client
, fromBlock?
, toBlock?
): Promise
<ColonyRoles
>
Parameters
Name | Type |
---|---|
client | AnyColonyClient |
fromBlock? | number |
toBlock? | number |
Returns
Promise
<ColonyRoles
>
getLogs
▸ getLogs(client
, filter
, options?
): Promise
<Log
[]>
Get raw (unparsed logs) from filter
Example:
// Gets the logs for the `ColonyFundsClaimed` event (not filtered)
const filter = colonyClient.filters.ColonyFundsClaimed(null, null, null);
const logs = await getLogs(colonyClient, filter);
Parameters
Name | Type | Description |
---|---|---|
client | ContractClient | Any of the intantiated contract clients |
filter | Filter | ethers compatible Filter object |
options | LogOptions | Configuration options to filter logs |
Returns
Promise
<Log
[]>
ethers Log array
getMultipleEvents
▸ getMultipleEvents(client
, filters
, options?
): Promise
<LogDescription
[]>
Get multiple events from multiple filters
Remarks
only works when all events are emitted by the same contract!
Parameters
Name | Type | Description |
---|---|---|
client | ContractClient | Any of the intantiated contract clients |
filters | EventFilter [] | Array of ethers compatible Filter objects |
options? | LogOptions | Configuration options to filter logs |
Returns
Promise
<LogDescription
[]>
Parsed ethers LogDescription array (events)
getPermissionProofs
▸ getPermissionProofs(client
, domainId
, roles
, customAddress?
): Promise
<[BigNumber
, BigNumber
, string
]>
Get the permission proofs for a user address and a certain role
Certain methods on Colony contracts require so called "permission proofs". These are made up by
the permissionDomainId
and the childSkillIndex
. We shall attempt an explanation here.
Domains within a colony can be nested and all the permissions in a parent domain apply for all child domains.
Yet at the time of calling a domain-permissioned method the contracts are unaware of the parent domain
a certain user has the required permission in. So when we these methods are called we have to supply them
the id of the parent domain the user has the permission in (it could also be the very same domain id they
want to act in!). Furthermore for the contracts the unidirectional chain downwards we have to supply
the method wuth the index of the domains associated skill in its parents children array
(childSkillIndex
, see [[getChildIndex
]]).
The contracts are then able to verify the permissions (the role) claimed by the caller.
tl;dr:
permissionDomainId
: id of the parent domain of the required domain the user has the required permission inchildSkillIndex
: the child index for a domain inside its corresponding skills parent children array
Parameters
Name | Type | Description |
---|---|---|
client | AnyColonyClient | Any ColonyClient |
domainId | BigNumberish | Domain id the method needs to act in |
roles | ColonyRole | ColonyRole [] | Permissioning role(s) that the methods needs to function |
customAddress? | string | A custom address to get the permission proofs for (defaults to the signer's address) |
Returns
Promise
<[BigNumber
, BigNumber
, string
]>
Tuple of [permissionDomainId, childSkillIndex, permissionAddress]
getPotDomain
▸ getPotDomain(client
, potId
): Promise
<BigNumberish
>
Get the associated domain for a pot id
Remarks
pots can be associated with different types, like domains, payments or tasks
See [[FundingPotAssociatedType
]] for details
Parameters
Name | Type | Description |
---|---|---|
client | AnyColonyClient | Any ColonyClient |
potId | BigNumberish | The funding pot id |
Returns
Promise
<BigNumberish
>
The associated domainId
getTokenClient
▸ getTokenClient(address
, signerOrProvider
): Promise
<TokenClient
>
Parameters
Name | Type |
---|---|
address | string |
signerOrProvider | SignerOrProvider |
Returns
Promise
<TokenClient
>
getTokenLockingClient
▸ getTokenLockingClient(address
, signerOrProvider
): TokenLockingClient
Parameters
Name | Type |
---|---|
address | string |
signerOrProvider | SignerOrProvider |
Returns
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
Name | Type | Description |
---|---|---|
extension | Extension | A valid Extension contract name |
extensionVersion | ExtensionVersion | The version of the extension to check against the colony |
colonyVersion | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | The version of the colony to check for |
Returns
boolean
indication whether extension in given version is compatible with colony at the given version