Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

Commit

Permalink
Fix examples and add more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie committed Nov 24, 2022
1 parent ef8ec83 commit 0bf595f
Show file tree
Hide file tree
Showing 33 changed files with 422 additions and 132 deletions.
18 changes: 6 additions & 12 deletions docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,25 @@
- [ColonyNetwork](classes/ColonyNetwork.md)
- [ColonyToken](classes/ColonyToken.md)
- [PinataAdapter](classes/PinataAdapter.md)
- [TxCreator](classes/TxCreator.md)
- [VotingReputation](classes/VotingReputation.md)

## Interfaces

- [AnnotationMetadata](interfaces/AnnotationMetadata.md)
- [ColonyEvent](interfaces/ColonyEvent.md)
- [ColonyEventManagerOptions](interfaces/ColonyEventManagerOptions.md)
- [ColonyFilter](interfaces/ColonyFilter.md)
- [ColonyMultiFilter](interfaces/ColonyMultiFilter.md)
- [ColonyNetworkOptions](interfaces/ColonyNetworkOptions.md)
- [ColonyTopic](interfaces/ColonyTopic.md)
- [Ethers6Filter](interfaces/Ethers6Filter.md)
- [Ethers6FilterByBlockHash](interfaces/Ethers6FilterByBlockHash.md)
- [EventSources](interfaces/EventSources.md)
- [IpfsAdapter](interfaces/IpfsAdapter.md)
- [NetworkClientOptions](interfaces/NetworkClientOptions.md)
- [ParsedLogTransactionReceipt](interfaces/ParsedLogTransactionReceipt.md)
- [SupportedExtensions](interfaces/SupportedExtensions.md)

## Type Aliases

Expand Down Expand Up @@ -69,18 +75,6 @@ ___
| :------ | :------ |
| `K` | extends [`MetadataType`](enums/MetadataType.md) |

___

### ParametersFrom2

Ƭ **ParametersFrom2**<`F`\>: `F` extends (`arg0`: `any`, `arg1`: `any`, ...`rest`: infer R) => `any` ? `R` : `never`

#### Type parameters

| Name |
| :------ |
| `F` |

## Functions

### addressesAreEqual
Expand Down
56 changes: 28 additions & 28 deletions docs/api/classes/Colony.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ___

### ext

**ext**: `SupportedExtensions`
**ext**: [`SupportedExtensions`](../interfaces/SupportedExtensions.md)

___

Expand All @@ -53,15 +53,15 @@ If this is not an option, Colony SDK might throw errors at certain points. Usage

### annotateTransaction

**annotateTransaction**(`txHash`, `annotationMetadata`): `TxCreator`<`ColonyClientV10`, ``"annotateTransaction"``, { `agent?`: `string` ; `metadata?`: `string` ; `txHash?`: `string` }, [`Annotation`](../enums/MetadataType.md#annotation)\>
**annotateTransaction**(`txHash`, `annotationMetadata`): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"annotateTransaction"``, { `agent?`: `string` ; `metadata?`: `string` ; `txHash?`: `string` }, [`Annotation`](../enums/MetadataType.md#annotation)\>

Annotate a transaction with IPFS metadata to provide extra information

This will annotate a transaction with an arbitrary text message. This only really works for transactions that happened within this Colony. This will upload the text string to IPFS and connect the transaction to the IPFS hash accordingly.

**`Remarks`**

If AnnotationMetadata is provided directly (as opposed to a [CID](https://docs.ipfs.io/concepts/content-addressing/#identifier-formats) for a JSON file) this requires an [IpfsAdapter](../interfaces/IpfsAdapter.md) that can upload and pin to IPFS. See its documentation for more information. Keep in mind that **the annotation itself is a transaction**.
If [AnnotationMetadata](../interfaces/AnnotationMetadata.md) is provided directly (as opposed to a [CID](https://docs.ipfs.io/concepts/content-addressing/#identifier-formats) for a JSON file) this requires an [IpfsAdapter](../interfaces/IpfsAdapter.md) that can upload and pin to IPFS. See its documentation for more information. Keep in mind that **the annotation itself is a transaction**.

**`Example`**

Expand All @@ -74,12 +74,12 @@ If AnnotationMetadata is provided directly (as opposed to a [CID](https://docs.i
const [, { transactionHash }] = await colony.ext.oneTx.pay(
'0xb77D57F4959eAfA0339424b83FcFaf9c15407461',
w`10`,
).motionTx();
).motion();
// Annotate the motion transaction with a little explanation :)
await colony.annotateTransaction(
transactionHash,
{ annotationMsg: 'I am creating this motion because I think I deserve a little bonus' },
).forceTx();
).force();
})();
```

Expand All @@ -88,13 +88,13 @@ If AnnotationMetadata is provided directly (as opposed to a [CID](https://docs.i
| Name | Type | Description |
| :------ | :------ | :------ |
| `txHash` | `string` | Transaction hash of the transaction to annotate (within the Colony) |
| `annotationMetadata` | `string` \| `AnnotationMetadata` | The annotation metadata you would like to annotate the transaction with (or an IPFS CID pointing to valid metadata) |
| `annotationMetadata` | `string` \| [`AnnotationMetadata`](../interfaces/AnnotationMetadata.md) | The annotation metadata you would like to annotate the transaction with (or an IPFS CID pointing to valid metadata) |

#### Returns

`TxCreator`<`ColonyClientV10`, ``"annotateTransaction"``, { `agent?`: `string` ; `metadata?`: `string` ; `txHash?`: `string` }, [`Annotation`](../enums/MetadataType.md#annotation)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"annotateTransaction"``, { `agent?`: `string` ; `metadata?`: `string` ; `txHash?`: `string` }, [`Annotation`](../enums/MetadataType.md#annotation)\>

A TxCreator
A [TxCreator](TxCreator.md)

**Event data**

Expand All @@ -108,7 +108,7 @@ ___

### claimFunds

**claimFunds**(`tokenAddress?`): `TxCreator`<`ColonyClientV10`, ``"claimColonyFunds"``, { `fee?`: `BigNumber` ; `payoutRemainder?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>
**claimFunds**(`tokenAddress?`): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"claimColonyFunds"``, { `fee?`: `BigNumber` ; `payoutRemainder?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>

Claim outstanding Colony funds

Expand All @@ -126,9 +126,9 @@ use `ethers.constants.AddressZero` to claim ETH.

#### Returns

`TxCreator`<`ColonyClientV10`, ``"claimColonyFunds"``, { `fee?`: `BigNumber` ; `payoutRemainder?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"claimColonyFunds"``, { `fee?`: `BigNumber` ; `payoutRemainder?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>

A TxCreator
A [TxCreator](TxCreator.md)

**Event data**

Expand All @@ -143,7 +143,7 @@ ___

### createTeam

**createTeam**(): `TxCreator`<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256)"``, { `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>
**createTeam**(): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256)"``, { `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>

Create a team (domain) within a Colony with no metadata attached

Expand All @@ -153,9 +153,9 @@ Currently you can only add domains within the `Root` domain. This restriction wi

#### Returns

`TxCreator`<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256)"``, { `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256)"``, { `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>

A TxCreator
A [TxCreator](TxCreator.md)

**Event data**

Expand All @@ -169,7 +169,7 @@ ___

### createTeamWithData

**createTeamWithData**(`teamMetadata`): `TxCreator`<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256,string)"``, { `agent?`: `string` ; `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` ; `metadata?`: `string` }, [`Domain`](../enums/MetadataType.md#domain)\>
**createTeamWithData**(`teamMetadata`): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256,string)"``, { `agent?`: `string` ; `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` ; `metadata?`: `string` }, [`Domain`](../enums/MetadataType.md#domain)\>

Create a team (domain) within a Colony with team details as metadata

Expand All @@ -185,9 +185,9 @@ Currently you can only add domains within the `Root` domain. This restriction wi

#### Returns

`TxCreator`<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256,string)"``, { `agent?`: `string` ; `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` ; `metadata?`: `string` }, [`Domain`](../enums/MetadataType.md#domain)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"addDomain(uint256,uint256,uint256,string)"``, { `agent?`: `string` ; `domainId?`: `BigNumber` ; `fundingPotId?`: `BigNumber` ; `metadata?`: `string` }, [`Domain`](../enums/MetadataType.md#domain)\>

A TxCreator
A [TxCreator](TxCreator.md)

**Event data**

Expand All @@ -210,7 +210,7 @@ ___

### deprecateTeam

**deprecateTeam**(`teamId`, `deprecated`): `TxCreator`<`ColonyClientV10`, ``"deprecateDomain"``, { `agent?`: `string` ; `deprecated?`: `boolean` ; `domainId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>
**deprecateTeam**(`teamId`, `deprecated`): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"deprecateDomain"``, { `agent?`: `string` ; `deprecated?`: `boolean` ; `domainId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>

Deprecate (remove) or undeprecate a team

Expand All @@ -225,9 +225,9 @@ Teams can be deprecated which will remove them from the UI. As they can't be del

#### Returns

`TxCreator`<`ColonyClientV10`, ``"deprecateDomain"``, { `agent?`: `string` ; `deprecated?`: `boolean` ; `domainId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"deprecateDomain"``, { `agent?`: `string` ; `deprecated?`: `boolean` ; `domainId?`: `BigNumber` }, [`MetadataType`](../enums/MetadataType.md)\>

A TxCreator
A [TxCreator](TxCreator.md)

**Event data**

Expand Down Expand Up @@ -349,7 +349,7 @@ ___

### makeArbitraryTransaction

**makeArbitraryTransaction**(`target`, `action`): `TxCreator`<`ColonyClientV10`, ``"makeArbitraryTransactions"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>
**makeArbitraryTransaction**(`target`, `action`): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"makeArbitraryTransactions"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>

Execute an arbitrary transaction in the name of the Colony

Expand All @@ -375,7 +375,7 @@ const encodedAction = ERC721.encodeFunctionData(
'0x06012c8cf97BEaD5deAe237070F9587f8E7A266d',
// encoded transaction from above
encodedAction
).forceTx();
).force();
})();
```

Expand All @@ -388,17 +388,17 @@ const encodedAction = ERC721.encodeFunctionData(

#### Returns

`TxCreator`<`ColonyClientV10`, ``"makeArbitraryTransactions"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"makeArbitraryTransactions"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>

A TxCreator
A [TxCreator](TxCreator.md)

**No event data**

___

### moveFundsToTeam

**moveFundsToTeam**(`amount`, `toTeam`, `fromTeam?`, `tokenAddress?`): `TxCreator`<`ColonyClientV10`, ``"moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)"``, { `agent?`: `string` ; `amount?`: `BigNumber` ; `fromPot?`: `BigNumber` ; `toPot?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>
**moveFundsToTeam**(`amount`, `toTeam`, `fromTeam?`, `tokenAddress?`): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)"``, { `agent?`: `string` ; `amount?`: `BigNumber` ; `fromPot?`: `BigNumber` ; `toPot?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>

Move funds from one team to another

Expand All @@ -421,7 +421,7 @@ import { Tokens, w } from '@colony/sdk';
w`10`,
2,
3,
).forceTx();
).force();
})();
```

Expand All @@ -436,9 +436,9 @@ import { Tokens, w } from '@colony/sdk';

#### Returns

`TxCreator`<`ColonyClientV10`, ``"moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)"``, { `agent?`: `string` ; `amount?`: `BigNumber` ; `fromPot?`: `BigNumber` ; `toPot?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)"``, { `agent?`: `string` ; `amount?`: `BigNumber` ; `fromPot?`: `BigNumber` ; `toPot?`: `BigNumber` ; `token?`: `string` }, [`MetadataType`](../enums/MetadataType.md)\>

A TxCreator
A [TxCreator](TxCreator.md)

**Event data**

Expand Down
16 changes: 8 additions & 8 deletions docs/api/classes/ColonyEventManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Create a new ColonyEvents instance

**`Remarks`**

As opposed to the ColonyNetwork.ColonyNetwork class, this constructor _needs_ an _ethers_ JsonRpcProvider (or a subclass of it) as it's
As opposed to the [ColonyNetwork](ColonyNetwork.md) class, this constructor _needs_ an _ethers_ JsonRpcProvider (or a subclass of it) as it's
the only provider that supports topic filtering by multiple addresses

#### Parameters
Expand Down Expand Up @@ -64,7 +64,7 @@ We can do that as we do not have ambiguous events across our contracts, so we wi

**`Example`**

Filter for all `DomainAdded` events between block 21830000 and 21840000 (across all deployed ColonyNetwork.Colony contracts)
Filter for all `DomainAdded` events between block 21830000 and 21840000 (across all deployed [ColonyNetwork](ColonyNetwork.md) contracts)
```typescript
const domainAdded = colonyEvents.createFilter(
colonyEvents.eventSources.Colony,
Expand Down Expand Up @@ -116,7 +116,7 @@ We can do that as we do not have ambiguous events across our contracts, so we wi

**`Example`**

Filter for all `DomainAdded` events for a specific ColonyNetwork.Colony contract
Filter for all `DomainAdded` events for a specific [Colony](Colony.md) contract
```typescript
const domainAdded = colonyEvents.createFilter(
colonyEvents.eventSources.Colony,
Expand Down Expand Up @@ -158,7 +158,7 @@ Gets events for an individual filter and automatically parses the data if possib

**`Example`**

Retrieve and parse all `DomainAdded` events for a specific ColonyNetwork.Colony contract
Retrieve and parse all `DomainAdded` events for a specific [Colony](Colony.md) contract
```typescript
const domainAdded = colonyEvents.createFilter(
colonyEvents.eventSources.Colony,
Expand All @@ -181,7 +181,7 @@ const domainAdded = colonyEvents.createFilter(

| Name | Type | Description |
| :------ | :------ | :------ |
| `filter` | [`ColonyFilter`](../interfaces/ColonyFilter.md) | A [ColonyFilter](../interfaces/ColonyFilter.md). ColonyMultiFilters will not work |
| `filter` | [`ColonyFilter`](../interfaces/ColonyFilter.md) | A [ColonyFilter](../interfaces/ColonyFilter.md). [ColonyMultiFilter](../interfaces/ColonyMultiFilter.md)s will not work |

#### Returns

Expand All @@ -206,8 +206,8 @@ This is handy when you want to listen to a fixed set of events for a lot of diff

**`Example`**

Retrieve and parse all `DomainAdded` and `DomainMetadata` events for a specific ColonyNetwork.Colony contract.
Note that we're using ColonyEvents.createMultiFilter here. The two `colonyAddress`es could also be different
Retrieve and parse all `DomainAdded` and `DomainMetadata` events for a specific [ColonyNetwork](ColonyNetwork.md) contract.
Note that we're using [createMultiFilter](ColonyEventManager.md#createmultifilter) here. The two `colonyAddress`es could also be different

```typescript
const domainAdded = colonyEvents.createMultiFilter(
Expand Down Expand Up @@ -237,7 +237,7 @@ const domainMetadata = colonyEvents.createMultiFilter(

| Name | Type | Description |
| :------ | :------ | :------ |
| `filters` | [`ColonyMultiFilter`](../interfaces/ColonyMultiFilter.md)[] | An array of [ColonyMultiFilter](../interfaces/ColonyMultiFilter.md)s. Normal ColonyFilters will not work |
| `filters` | [`ColonyMultiFilter`](../interfaces/ColonyMultiFilter.md)[] | An array of [ColonyMultiFilter](../interfaces/ColonyMultiFilter.md)s. Normal [ColonyFilter](../interfaces/ColonyFilter.md)s will not work |
| `options` | `Object` | You can define `fromBlock` and `toBlock` only once for all the filters given |
| `options.fromBlock?` | `BlockTag` | Starting block in which to look for this event - inclusive (default: 'latest') |
| `options.toBlock?` | `BlockTag` | Ending block in which to look for this event - inclusive (default: 'latest') |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/ColonyNetwork.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const colonyNetwork = new ColonyNetwork(provider);
| Name | Type | Description |
| :------ | :------ | :------ |
| `signerOrProvider` | `SignerOrProvider` | An _ethers_ compatible Signer or Provider instance |
| `options?` | `ColonyNetworkOptions` | Optional custom ColonyNetworkOptions |
| `options?` | [`ColonyNetworkOptions`](../interfaces/ColonyNetworkOptions.md) | Optional custom [ColonyNetworkOptions](../interfaces/ColonyNetworkOptions.md) |

## Properties

Expand Down
10 changes: 5 additions & 5 deletions docs/api/classes/ColonyToken.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ___

### mint

**mint**(`amount`): `TxCreator`<`ColonyClientV10`, ``"mintTokens"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>
**mint**(`amount`): [`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"mintTokens"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>

Mints `amount` of a Colony's native token.

Expand All @@ -163,10 +163,10 @@ import { w } from '@colony/sdk';
const token = await colony.getToken();
// Mint 100 tokens of the Colony's native token
// (forced transaction example)
await token.mint(w`100`).forceTx();
await token.mint(w`100`).force();
// Claim the minted tokens for the Colony
// (forced transaction example)
await colony.claimFunds().forceTx();
await colony.claimFunds().force();
})();
```

Expand All @@ -178,9 +178,9 @@ import { w } from '@colony/sdk';

#### Returns

`TxCreator`<`ColonyClientV10`, ``"mintTokens"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>
[`TxCreator`](TxCreator.md)<`ColonyClientV10`, ``"mintTokens"``, `Record`<`string`, `unknown`\>, [`MetadataType`](../enums/MetadataType.md)\>

A TxCreator
A [TxCreator](TxCreator.md)

___

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/PinataAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PinataAdapter

A Colony SDK IPFS adapter for Pinata (https://pinata.cloud). In order to use this, sign up for Pinata (if you haven't already) and generate a token. Then either supply this token when instantiating the class (example below) or provide it via the environment variable `COLONY_IPFS_PINATA_TOKEN` (when using NodeJS). Then provide an instance of this class to the [ColonyNetwork](ColonyNetwork.md) or ColonyEventManger classes (depending on your needs).
A Colony SDK IPFS adapter for Pinata (https://pinata.cloud). In order to use this, sign up for Pinata (if you haven't already) and generate a token. Then either supply this token when instantiating the class (example below) or provide it via the environment variable `COLONY_IPFS_PINATA_TOKEN` (when using NodeJS). Then provide an instance of this class to the [ColonyNetwork](ColonyNetwork.md) or [ColonyEventManager](ColonyEventManager.md) classes (depending on your needs).

**`Remarks`**

Expand Down
Loading

0 comments on commit 0bf595f

Please sign in to comment.