Skip to content

Commit

Permalink
chore: Generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie committed Aug 9, 2023
1 parent e931d0e commit f0fbbb7
Show file tree
Hide file tree
Showing 18 changed files with 435 additions and 31 deletions.
138 changes: 137 additions & 1 deletion packages/sdk/docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,33 @@
## Interfaces

- [AnnotationData](interfaces/AnnotationData.md)
- [AnnotationMetadata](interfaces/AnnotationMetadata.md)
- [BaseContract](interfaces/BaseContract.md)
- [ColonyData](interfaces/ColonyData.md)
- [ColonyEvent](interfaces/ColonyEvent.md)
- [ColonyEventManagerOptions](interfaces/ColonyEventManagerOptions.md)
- [ColonyFilter](interfaces/ColonyFilter.md)
- [ColonyMetaTransaction](interfaces/ColonyMetaTransaction.md)
- [ColonyMetadata](interfaces/ColonyMetadata.md)
- [ColonyMultiFilter](interfaces/ColonyMultiFilter.md)
- [ColonyNetworkOptions](interfaces/ColonyNetworkOptions.md)
- [ColonyTopic](interfaces/ColonyTopic.md)
- [ColonyTransaction](interfaces/ColonyTransaction.md)
- [ContractReceipt](interfaces/ContractReceipt.md)
- [ContractTransaction](interfaces/ContractTransaction.md)
- [DataTypeMap](interfaces/DataTypeMap.md)
- [DecisionData](interfaces/DecisionData.md)
- [DecisionMetadata](interfaces/DecisionMetadata.md)
- [DomainData](interfaces/DomainData.md)
- [DomainMetadata](interfaces/DomainMetadata.md)
- [Ethers6Filter](interfaces/Ethers6Filter.md)
- [Ethers6FilterByBlockHash](interfaces/Ethers6FilterByBlockHash.md)
- [EventData](interfaces/EventData.md)
- [IpfsAdapter](interfaces/IpfsAdapter.md)
- [MetaTxBaseContract](interfaces/MetaTxBaseContract.md)
- [MetadataTypeMap](interfaces/MetadataTypeMap.md)
- [MiscData](interfaces/MiscData.md)
- [MiscMetadata](interfaces/MiscMetadata.md)
- [ParsedLogTransactionReceipt](interfaces/ParsedLogTransactionReceipt.md)
- [PermissionConfig](interfaces/PermissionConfig.md)
- [SafeInfo](interfaces/SafeInfo.md)
Expand All @@ -69,6 +77,12 @@

## Type Aliases

### Data

Ƭ **Data**: [`AnnotationData`](interfaces/AnnotationData.md) \| [`ColonyData`](interfaces/ColonyData.md) \| [`DecisionData`](interfaces/DecisionData.md) \| [`DomainData`](interfaces/DomainData.md) \| [`MiscData`](interfaces/MiscData.md)

___

### Domain

Ƭ **Domain**: `ColonyDataTypes10.DomainStructOutput` \| `ColonyDataTypes11.DomainStructOutput` \| `ColonyDataTypes12.DomainStructOutput`
Expand All @@ -85,7 +99,7 @@ ___

### Metadata

Ƭ **Metadata**: `AnnotationMetadata` \| `ColonyMetadata` \| `DecisionMetadata` \| `DomainMetadata` \| `MiscMetadata`
Ƭ **Metadata**: [`AnnotationMetadata`](interfaces/AnnotationMetadata.md) \| [`ColonyMetadata`](interfaces/ColonyMetadata.md) \| [`DecisionMetadata`](interfaces/DecisionMetadata.md) \| [`DomainMetadata`](interfaces/DomainMetadata.md) \| [`MiscMetadata`](interfaces/MiscMetadata.md)

___

Expand Down Expand Up @@ -182,6 +196,14 @@ ___
| `domain` | ``"DomainMetadata(address,uint256,string)"`` |
| `misc` | ``""`` |

___

### METADATA\_VERSION

`Const` **METADATA\_VERSION**: ``2``

Current Colony Event Metadata version

## Functions

### addressesAreEqual
Expand All @@ -208,6 +230,71 @@ Whether a and b are the same address

___

### createMetadataFor

**createMetadataFor**<`T`\>(`type`, `data`): [`MetadataTypeMap`](interfaces/MetadataTypeMap.md)[`T`]

Create a valid Metadata object.

Validates the input.

**`Example`**

```typescript
import { createMetadataFor, MetadataType } from '@colony/event-metadata';

const result = createMetadataFor(MetadataType.Domain, {
domainName: 'Cool team',
});

console.log(result.version); // 2
console.log(result.name); // 'domain'
console.log(result.data.domainName); // 'Cool team'
```

#### Type parameters

| Name | Type |
| :------ | :------ |
| `T` | extends [`MetadataType`](enums/MetadataType.md) |

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `type` | `T` | The metadata type |
| `data` | [`DataTypeMap`](interfaces/DataTypeMap.md)[`T`] | The actual data for the generated metadata object |

#### Returns

[`MetadataTypeMap`](interfaces/MetadataTypeMap.md)[`T`]

The version number of the metadata

___

### getEventMetadataVersion

**getEventMetadataVersion**(`input`): `number`

Get the version of a Metadata object

Defaults to 1.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `object` | JavaScript object (parsed, from IPFS) |

#### Returns

`number`

The version number of the metadata

___

### getToken

**getToken**(`colonyNetwork`, `address`): `Promise`<[`ERC20Token`](classes/ERC20Token.md)\>
Expand Down Expand Up @@ -254,6 +341,55 @@ indication whether extension in given version is compatible with colony at the g

___

### parseEventMetadata

**parseEventMetadata**<`T`\>(`input`, `type?`): [`MetadataTypeMap`](interfaces/MetadataTypeMap.md)[`T`]

Parses and validates event metadata

This will check the validity of an event metadata object.
You can pass in an optional type if you know what to expect.
It will also do a data version check.

If you don't know what the output will be you can use TypeScript's
Discriminated Unions to guard the correct types (see example).

**`Example`**

```typescript
import { parseEventMetadata, MetadataType } from '@colony/event-metadata';

// Get `input` from IPFS or other sources.

const result = parseEventMetadata(input);

if (result.type === MetadataType.Domain) {
// Type is DomainMetadata
console.log(result.data.domainName);
}
```

#### Type parameters

| Name | Type |
| :------ | :------ |
| `T` | extends [`MetadataType`](enums/MetadataType.md) = [`DEFAULT`](enums/MetadataType.md#default) |

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `object` | JavaScript object (parsed, from IPFS) |
| `type?` | `T` | Optional MetadataType to check against |

#### Returns

[`MetadataTypeMap`](interfaces/MetadataTypeMap.md)[`T`]

The validated Metadata.

___

### parseLogs

**parseLogs**(`logs`, `iface`): `LogDescription`[]
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/docs/api/classes/CloudflareReadonlyAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This is the default IpfsAdapter used in Colony SDK. So in order to use this, you

### name

**name**: `string` = `'CLOUDFLARE'`
**name**: `string`

Name for the IpfsAdapter. All uppercase please

Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/docs/api/classes/ColonyEventManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const colonyEventSource = manager.createEventSource(ColonyEventsFactory);

| Name | Type |
| :------ | :------ |
| `T` | extends `BaseContract`<`T`\> |
| `T` | extends `BaseContract` |

#### Parameters

Expand Down Expand Up @@ -115,7 +115,7 @@ Filter for all `DomainAdded` events between block 21830000 and 21840000 (across

| Name | Type | Description |
| :------ | :------ | :------ |
| `T` | extends `BaseContract`<`T`\> & { `filters`: { [P in string \| number \| symbol]: Function } } | Needs to be a valid [EventSource](../README.md#eventsource) (i.e. from `colonyEvents.eventSources`) |
| `T` | extends `BaseContract` & { `filters`: { [P in string \| number \| symbol]: Function } } | Needs to be a valid [EventSource](../README.md#eventsource) (i.e. from `colonyEvents.eventSources`) |
| `N` | extends `string` \| `number` \| `symbol` | An event signature as defined in the _ethers_ contract's [`filters`](https://docs.ethers.io/v5/api/contract/contract/#Contract--filters) object. See the [ColonyJS documentation](https://colony.gitbook.io/colony/colonyjs) for a list of all available contracts and events |

#### Parameters
Expand Down Expand Up @@ -166,7 +166,7 @@ const domainAdded = colonyEvents.createFilter(

| Name | Type | Description |
| :------ | :------ | :------ |
| `T` | extends `BaseContract`<`T`\> & { `filters`: { [P in string \| number \| symbol]: Function } } | Needs to be a valid [EventSource](../README.md#eventsource) (i.e. from `colonyEvents.eventSources`) |
| `T` | extends `BaseContract` & { `filters`: { [P in string \| number \| symbol]: Function } } | Needs to be a valid [EventSource](../README.md#eventsource) (i.e. from `colonyEvents.eventSources`) |
| `N` | extends `string` \| `number` \| `symbol` | An event signature as defined in the _ethers_ contract's [`filters`](https://docs.ethers.io/v5/api/contract/contract/#Contract--filters) object. See the [ColonyJS documentation](https://colony.gitbook.io/colony/colonyjs) for a list of all available contracts and events |

#### Parameters
Expand Down Expand Up @@ -275,7 +275,7 @@ const domainMetadata = colonyEvents.createMultiFilter(
| Name | Type | Description |
| :------ | :------ | :------ |
| `filters` | [`ColonyMultiFilter`](../interfaces/ColonyMultiFilter.md) \| [`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 (default for both is `latest`) |
| `options?` | `Object` | You can define `fromBlock` and `toBlock` only once for all the filters given (default for both is `latest`) |
| `options.fromBlock?` | `BlockTag` | - |
| `options.toBlock?` | `BlockTag` | - |

Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/docs/api/classes/IpfsMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can find an instance of this under `colonyNetwork.ipfs` or `eventManager.ipf

### getMetadata

**getMetadata**<`K`\>(`cid`, `type?`): `Promise`<`MetadataTypeMap`[`K`]\>
**getMetadata**<`K`\>(`cid`, `type?`): `Promise`<[`MetadataTypeMap`](../interfaces/MetadataTypeMap.md)[`K`]\>

#### Type parameters

Expand All @@ -38,13 +38,13 @@ You can find an instance of this under `colonyNetwork.ipfs` or `eventManager.ipf

#### Returns

`Promise`<`MetadataTypeMap`[`K`]\>
`Promise`<[`MetadataTypeMap`](../interfaces/MetadataTypeMap.md)[`K`]\>

___

### getMetadataForEvent

**getMetadataForEvent**<`T`, `E`\>(`eventName`, `cid`): `Promise`<`MetadataTypeMap`[`T`]\>
**getMetadataForEvent**<`T`, `E`\>(`eventName`, `cid`): `Promise`<[`MetadataTypeMap`](../interfaces/MetadataTypeMap.md)[`T`]\>

#### Type parameters

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

#### Returns

`Promise`<`MetadataTypeMap`[`T`]\>
`Promise`<[`MetadataTypeMap`](../interfaces/MetadataTypeMap.md)[`T`]\>

___

Expand Down Expand Up @@ -97,7 +97,7 @@ ___
| Name | Type |
| :------ | :------ |
| `type` | `T` |
| `input` | `DataTypeMap`[`T`] |
| `input` | [`DataTypeMap`](../interfaces/DataTypeMap.md)[`T`] |

#### Returns

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/docs/api/classes/PinataAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const pinataAdapter = new PinataAdapter('[YOUR_PINANTA_JWT_TOKEN]');

### name

**name**: `string` = `'PINATA'`
**name**: `string`

Name for the IpfsAdapter. All uppercase please

Expand Down
24 changes: 24 additions & 0 deletions packages/sdk/docs/api/classes/VotingReputation.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,30 @@ A Motion object

___

### getMotionResult

**getMotionResult**(`motionId`): `Promise`<``null`` \| [`Vote`](../enums/Vote.md)\>

Get the result of a motion (if it is finalizeable or finalized)

**`Remarks`**

Will return null if the motion is not finalizeable yet

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `motionId` | `BigNumberish` | The motionId to get the result for |

#### Returns

`Promise`<``null`` \| [`Vote`](../enums/Vote.md)\>

The result of the motion (0 = Nay, 1 = Yay)

___

### getMotionState

**getMotionState**(`motionId`): `Promise`<`number`\>
Expand Down
33 changes: 33 additions & 0 deletions packages/sdk/docs/api/interfaces/AnnotationMetadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Interface: AnnotationMetadata

## Hierarchy

- `BaseMetadata`

**`AnnotationMetadata`**

## Properties

### data

**data**: [`AnnotationData`](AnnotationData.md)

___

### name

**name**: [`Annotation`](../enums/MetadataType.md#annotation)

#### Overrides

BaseMetadata.name

___

### version

**version**: `number`

#### Inherited from

BaseMetadata.version
6 changes: 3 additions & 3 deletions packages/sdk/docs/api/interfaces/ColonyEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ ___

### getMetadata

`Optional` **getMetadata**: () => `Promise`<`MetadataTypeMap`[`M`]\>
`Optional` **getMetadata**: () => `Promise`<[`MetadataTypeMap`](MetadataTypeMap.md)[`M`]\>

#### Type declaration

▸ (): `Promise`<`MetadataTypeMap`[`M`]\>
▸ (): `Promise`<[`MetadataTypeMap`](MetadataTypeMap.md)[`M`]\>

##### Returns

`Promise`<`MetadataTypeMap`[`M`]\>
`Promise`<[`MetadataTypeMap`](MetadataTypeMap.md)[`M`]\>

___

Expand Down
Loading

0 comments on commit f0fbbb7

Please sign in to comment.