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

Commit

Permalink
Update to glwss and [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie committed Oct 27, 2022
1 parent 3a0eccb commit 7442def
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 30 deletions.
4 changes: 2 additions & 2 deletions docs/api/classes/Colony.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ___

### SupportedVersions

`Static` **SupportedVersions**: (``8`` \| ``9``)[]
`Static` **SupportedVersions**: ``10``[]

The currently supported Colony version. If a Colony is not on this version it has to be upgraded.
If this is not an option, Colony SDK might throw errors at certain points. Usage of ColonyJS is advised in these cases
Expand Down Expand Up @@ -215,7 +215,7 @@ Will throw if teamId does not exist

| Name | Type | Description |
| :------ | :------ | :------ |
| `teamId` | `BigNumberish` | The teamId to get the team information for FIXME: get the type somehow |
| `teamId` | `BigNumberish` | The teamId to get the team information for |

#### Returns

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/MotionCreator.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can find an instance of this under `colony.ext.motions.create`
| Name | Type |
| :------ | :------ |
| `colony` | [`Colony`](Colony.md) |
| `votingReputationClient` | `VotingReputationClientV4` |
| `votingReputationClient` | `VotingReputationClientV7` |

## Methods

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/VotingReputation.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ You can - at any point in the lifecycle inspect the current state of a Motion. U
| Name | Type |
| :------ | :------ |
| `colony` | [`Colony`](Colony.md) |
| `votingReputationClient` | `VotingReputationClientV4` |
| `votingReputationClient` | `VotingReputationClientV7` |

## Properties

Expand Down
30 changes: 30 additions & 0 deletions docs/api/enums/Extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,42 @@ Extension contract names

___

### EvaluatedExpenditure

**EvaluatedExpenditure** = ``"EvaluatedExpenditure"``

___

### IVotingReputation

**IVotingReputation** = ``"IVotingReputation"``

___

### OneTxPayment

**OneTxPayment** = ``"OneTxPayment"``

___

### StakedExpenditure

**StakedExpenditure** = ``"StakedExpenditure"``

___

### StreamingPayments

**StreamingPayments** = ``"StreamingPayments"``

___

### TokenSupplier

**TokenSupplier** = ``"TokenSupplier"``

___

### VotingReputation

**VotingReputation** = ``"VotingReputation"``
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.6.2",
"license": "GPL-3.0-only",
"dependencies": {
"@colony/colony-js": "^5.1.7",
"@colony/colony-js": "^5.3.0-beta.1",
"@urql/core": "^2.5.0",
"cross-fetch": "^3.1.5",
"fetch-retry": "^5.0.2",
Expand Down
14 changes: 8 additions & 6 deletions src/ColonyNetwork/Colony.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
ColonyClientV8,
ColonyClientV9,
ColonyClientV10,
SignerOrProvider,
Id,
Extension,
} from '@colony/colony-js';

import {
ColonyDataTypes,
ColonyFundsClaimed_address_uint256_uint256_EventObject,
// eslint-disable-next-line max-len
ColonyFundsMovedBetweenFundingPots_address_uint256_uint256_uint256_address_EventObject,
Expand All @@ -28,7 +28,7 @@ import { ColonyToken } from './ColonyToken';
import { ColonyNetwork } from './ColonyNetwork';
import { VotingReputation } from './VotingReputation';

export type SupportedColonyClient = ColonyClientV8 | ColonyClientV9;
export type SupportedColonyClient = ColonyClientV10;
export type SupportedColonyMethods = SupportedColonyClient['functions'];
export interface SupportedExtensions {
motions?: VotingReputation;
Expand All @@ -38,7 +38,7 @@ export class Colony {
/** The currently supported Colony version. If a Colony is not on this version it has to be upgraded.
* If this is not an option, Colony SDK might throw errors at certain points. Usage of ColonyJS is advised in these cases
*/
static SupportedVersions: (8 | 9)[] = [8, 9];
static SupportedVersions: 10[] = [10];

private colonyClient: SupportedColonyClient;

Expand Down Expand Up @@ -219,10 +219,12 @@ export class Colony {
* @remarks Will throw if teamId does not exist
*
* @param teamId The teamId to get the team information for
* FIXME: get the type somehow
*
* @returns A Team object
*/
async getTeam(teamId: BigNumberish) {
async getTeam(
teamId: BigNumberish,
): Promise<ColonyDataTypes.DomainStructOutput> {
const teamCount = await this.colonyClient.getDomainCount();
if (teamCount.lt(teamId)) {
throw new Error(`Team with id ${teamId} does not exist`);
Expand Down
5 changes: 1 addition & 4 deletions src/ColonyNetwork/ColonyNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ export class ColonyNetwork {
async getColony(address: string): Promise<Colony> {
const colonyClient = await this.networkClient.getColonyClient(address);

if (
colonyClient.clientVersion !== Colony.SupportedVersions[0] &&
colonyClient.clientVersion !== Colony.SupportedVersions[1]
) {
if (colonyClient.clientVersion !== Colony.SupportedVersions[0]) {
throw new Error(
`The version of this Colony ${colonyClient.clientVersion} is not supported by Colony SDK. Please update your Colony`,
);
Expand Down
8 changes: 5 additions & 3 deletions src/ColonyNetwork/MotionCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Extension,
ColonyRole,
getPermissionProofs,
getExtensionPermissionProofs,
getMultiPermissionProofs,
getChildIndex,
} from '@colony/colony-js';

Expand Down Expand Up @@ -166,14 +166,16 @@ export class MotionCreator {
Extension.OneTxPayment,
);

const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs(
const [extensionPDID, extensionCSI] = await getMultiPermissionProofs(
colonyClient,
setTeamId,
[ColonyRole.Funding, ColonyRole.Administration],
oneTxClient.address,
);
const [userPDID, userCSI] = await getExtensionPermissionProofs(
const [userPDID, userCSI] = await getMultiPermissionProofs(
colonyClient,
setTeamId,
[ColonyRole.Funding, ColonyRole.Administration],
);

const encodedAction = oneTxClient.interface.encodeFunctionData(
Expand Down
13 changes: 8 additions & 5 deletions src/ColonyNetwork/VotingReputation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {
Extension,
Id,
MotionState,
Motion,
VotingReputationClientV4,
VotingReputationClientV7,
} from '@colony/colony-js';

import {
VotingReputationDataTypes,
MotionEventSetEventObject,
MotionFinalizedEventObject,
MotionStakedEventObject,
Expand All @@ -25,8 +25,8 @@ export enum Vote {
Yay,
}

export type SupportedVotingReputationClient = VotingReputationClientV4;
export const SUPPORTED_VOTING_REPUTATION_VERSION = 4;
export type SupportedVotingReputationClient = VotingReputationClientV7;
export const SUPPORTED_VOTING_REPUTATION_VERSION = 7;

type ReputationData = Awaited<
ReturnType<SupportedColonyClient['getReputation']>
Expand Down Expand Up @@ -285,7 +285,10 @@ export class VotingReputation {
*
* @returns The minimum stake amount
*/
async getMinStake(motion: Motion, vote: Vote) {
async getMinStake(
motion: VotingReputationDataTypes.MotionStructOutput,
vote: Vote,
) {
// skillRep is the amount of reputation in the domain the motion was created in
// at the time the motion was created
const {
Expand Down

0 comments on commit 7442def

Please sign in to comment.