Options
All
  • Public
  • Public/Protected
  • All
Menu

@colony/colony-js

Index

Type aliases

ColonyClient

ColonyRoles

ColonyRoles: UserRoles[]

ContractClient

DomainRoles

DomainRoles: { domainId: number; roles: ColonyRole[] }

Type declaration

TokenClient

UserRoles

UserRoles: { address: string; domains: DomainRoles[] }

Type declaration

Variables

Const CurrentVersion

CurrentVersion: BurgundyGlider = ColonyVersion.BurgundyGlider

Const REPUTATION_ORACLE_ENDPOINT

REPUTATION_ORACLE_ENDPOINT: "https://colony.io/reputation" = "https://colony.io/reputation"

Const ROOT_DOMAIN_ID

ROOT_DOMAIN_ID: 1 = 1

Functions

Const getBlockTime

  • getBlockTime(provider: Provider, blockHash: string): Promise<number>
  • Get the JavaScript timestamp for a block

    Parameters

    • provider: Provider

      ethers compatible Provider

    • blockHash: string

      Hash of block to get time for

    Returns Promise<number>

    block timestamp in ms

Const getChildIndex

  • getChildIndex(client: ColonyClient, parentDomainId: BigNumberish, domainId: BigNumberish): 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

    • client: ColonyClient

      Any ColonyClient

    • parentDomainId: BigNumberish

      id of parent domain

    • domainId: BigNumberish

      id of the domain

    Returns Promise<BigNumber>

    Index in the children array (see above)

Const getColonyNetworkClient

  • getColonyNetworkClient(network?: Network, signerOrProvider: Signer | Provider, options?: NetworkClientOptions): ColonyNetworkClient

Const getColonyRoles

  • Get 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

    Returns Promise<ColonyRoles>

    Array of user roles in a colony (see above)

Const getEvents

  • getEvents(client: ContractClient, filter: Filter, options?: LogOptions): 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

    • client: ContractClient

      Any of the intantiated contract clients

    • filter: Filter

      ethers compatible Filter object

    • Optional options: LogOptions

      Configuration options to filter logs

    Returns Promise<LogDescription[]>

    Parsed ethers LogDescription array (events)

Const getLogs

  • getLogs(client: ContractClient, filter: Filter, options?: LogOptions): 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

    • client: ContractClient

      Any of the intantiated contract clients

    • filter: Filter

      ethers compatible Filter object

    • Default value options: LogOptions = {fromBlock: 1,}

      Configuration options to filter logs

    Returns Promise<Log[]>

    ethers Log array

Const getMoveFundsPermissionProofs

  • getMoveFundsPermissionProofs(client: ColonyClient, fromtPotId: BigNumberish, toPotId: BigNumberish, customAddress?: undefined | string): Promise<[BigNumber, BigNumber, BigNumber]>
  • Get the permission proofs for a user address and the moveFundsBetweenPots method

    The ColonyClientV1.moveFundsBetweenPots method is a special case as it requires the permission proofs for not only one but two domains (source and target domain pots). This helper will call the getPermissionProofs helper internally and apply the correct roles required.

    Parameters

    • client: ColonyClient

      Any ColonyClient

    • fromtPotId: BigNumberish

      Source pot id

    • toPotId: BigNumberish

      Target pot id

    • Optional customAddress: undefined | string

      A custom address to get the permission proofs for (defaults to the signer's address)

    Returns Promise<[BigNumber, BigNumber, BigNumber]>

    Tuple of [permissionDomainId, fromChildSkillIndex, toChildSkillIndex]

Const getMultipleEvents

  • getMultipleEvents(client: ContractClient, filters: EventFilter[], options?: LogOptions): Promise<LogDescription[]>
  • Get multiple events from multiple filters

    Parameters

    • client: ContractClient

      Any of the intantiated contract clients

    • filters: EventFilter[]
    • Optional options: LogOptions

      Configuration options to filter logs

    Returns Promise<LogDescription[]>

    Parsed ethers LogDescription array (events)

Const getPermissionProofs

  • getPermissionProofs(client: ColonyClient, domainId: BigNumberish, role: ColonyRole, customAddress?: undefined | string): Promise<[BigNumber, BigNumber]>
  • 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 in
    • childSkillIndex: the child index for a domain inside its corresponding skills parent children array

    Parameters

    • client: ColonyClient

      Any ColonyClient

    • domainId: BigNumberish

      Domain id the method needs to act in

    • role: ColonyRole

      Permissioning role that the methods needs to function

    • Optional customAddress: undefined | string

      A custom address to get the permission proofs for (defaults to the signer's address)

    Returns Promise<[BigNumber, BigNumber]>

    Tuple of [permissionDomainId, childSkillIndex]

Const getPotDomain

  • getPotDomain(client: ColonyClient, potId: BigNumberish): Promise<BigNumberish>
  • Get the associated domain for a pot id

    Parameters

    • client: ColonyClient

      Any ColonyClient

    • potId: BigNumberish

      The funding pot id

    Returns Promise<BigNumberish>

    The associated domainId

Const getTokenClient

  • getTokenClient(address: string, signerOrProvider: Signer | Provider): Promise<TokenClient>

Object literals

Const colonyNetworkAddresses

colonyNetworkAddresses: object

__computed

__computed: undefined = undefined

Const oneTxPaymentFactoryAddresses

oneTxPaymentFactoryAddresses: object

__computed

__computed: undefined = undefined

Const tokenAddresses

tokenAddresses: object

SAI

SAI: string = "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359"

Generated using TypeDoc