API
Namespaces
Enumerations
Classes
- CloudflareReadonlyAdapter
- Colony
- ColonyEventManager
- ColonyNetwork
- ColonyToken
- ColonyTxCreator
- ERC20Token
- ERC2612Token
- IpfsMetadata
- MetaTxCreator
- OneTxPayment
- PinataAdapter
- ReputationClient
- TokenLocking
- TxCreator
- VotingReputation
Interfaces
- AnnotationData
- BaseContract
- ColonyData
- ColonyEvent
- ColonyEventManagerOptions
- ColonyFilter
- ColonyMetaTransaction
- ColonyMultiFilter
- ColonyNetworkOptions
- ColonyTopic
- ColonyTransaction
- ContractReceipt
- ContractTransaction
- DecisionData
- DomainData
- Ethers6Filter
- Ethers6FilterByBlockHash
- EventData
- IpfsAdapter
- MetaTxBaseContract
- ParsedLogTransactionReceipt
- PermissionConfig
- SafeInfo
- SupportedExtensions
- TokenData
- TransactionResponse
- TxConfig
- TxCreatorConfig
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
| Name | Type |
|---|---|
K | extends 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
| Name | Type |
|---|---|
CoinMachine | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
EvaluatedExpenditure | 1 | 2 | 3 | 4 |
FundingQueue | 1 | 2 | 3 | 4 | 5 |
IVotingReputation | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
OneTxPayment | 1 | 2 | 3 | 4 | 5 |
ReputationBootstrapper | 1 | 2 |
StakedExpenditure | 1 | 2 | 3 |
StreamingPayments | 1 | 2 |
TokenSupplier | 1 | 2 | 3 | 4 | 5 |
VotingReputation | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Whitelist | 1 | 2 | 3 | 4 |
IpfsMetadataEvents
• Const IpfsMetadataEvents: Object
Type declaration
| Name | Type |
|---|---|
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
| Name | Type | Description |
|---|---|---|
a | string | Left hand side address |
b | string | Right 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
| Name | Type | Description |
|---|---|---|
colonyNetwork | ColonyNetwork | A ColonyNetwork instance |
address | string | The 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
| 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 | 13 | The 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
| Name | Type | Description |
|---|---|---|
logs | Log[] | Array of log entries (usually from a ContractReceipt) |
iface | Interface | Ethers 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
| Name | Type |
|---|---|
num | BigNumberish |
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
| Name | Type |
|---|---|
num | string |
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
| Name | Type |
|---|---|
str | TemplateStringsArray |
Returns
BigNumber