From 8761700b5b738f462c821ae17f211d7468a3e265 Mon Sep 17 00:00:00 2001 From: Jakub Zajac Date: Wed, 5 Jun 2024 11:07:33 +0100 Subject: [PATCH] Add new version 5 of streaming payments --- ...ntsClientV4.ts => StreamingPaymentsClientV5.ts} | 14 +++++++------- .../Extensions/StreamingPayments/contracts.ts | 6 ++++-- .../Extensions/StreamingPayments/exports.ts | 14 ++++++++------ packages/contractor/package.json | 2 +- packages/core/src/versions/StreamingPayments.ts | 3 ++- pnpm-lock.yaml | 8 ++++---- 6 files changed, 26 insertions(+), 21 deletions(-) rename packages/colony-js/src/clients/Extensions/StreamingPayments/{StreamingPaymentsClientV4.ts => StreamingPaymentsClientV5.ts} (76%) diff --git a/packages/colony-js/src/clients/Extensions/StreamingPayments/StreamingPaymentsClientV4.ts b/packages/colony-js/src/clients/Extensions/StreamingPayments/StreamingPaymentsClientV5.ts similarity index 76% rename from packages/colony-js/src/clients/Extensions/StreamingPayments/StreamingPaymentsClientV4.ts rename to packages/colony-js/src/clients/Extensions/StreamingPayments/StreamingPaymentsClientV5.ts index 3ca21b503..cbf1db8bd 100644 --- a/packages/colony-js/src/clients/Extensions/StreamingPayments/StreamingPaymentsClientV4.ts +++ b/packages/colony-js/src/clients/Extensions/StreamingPayments/StreamingPaymentsClientV5.ts @@ -1,7 +1,7 @@ import type { AugmentedIColony } from '../../Core/augments/commonAugments.js'; -import type { StreamingPayments } from '../../../contracts/StreamingPayments/4/StreamingPayments.js'; +import type { StreamingPayments } from '../../../contracts/StreamingPayments/5/StreamingPayments.js'; -import { StreamingPayments__factory as StreamingPaymentsFactory } from '../../../contracts/StreamingPayments/4/factories/StreamingPayments__factory.js'; +import { StreamingPayments__factory as StreamingPaymentsFactory } from '../../../contracts/StreamingPayments/5/factories/StreamingPayments__factory.js'; import { ClientType } from '../../../constants.js'; import { addAugments, @@ -9,22 +9,22 @@ import { ValidColony, } from './augments/commonAugments.js'; -export interface StreamingPaymentsClientV4 +export interface StreamingPaymentsClientV5 extends AugmentedStreamingPayments { - clientVersion: 4; + clientVersion: 5; } export default function getStreamingPaymentsClient( colonyClient: AugmentedIColony, address: string, -): StreamingPaymentsClientV4 { +): StreamingPaymentsClientV5 { const streamingPaymentsClient = StreamingPaymentsFactory.connect( address, colonyClient.signer || colonyClient.provider, - ) as StreamingPaymentsClientV4; + ) as StreamingPaymentsClientV5; streamingPaymentsClient.clientType = ClientType.StreamingPaymentsClient; - streamingPaymentsClient.clientVersion = 4; + streamingPaymentsClient.clientVersion = 5; addAugments(streamingPaymentsClient, colonyClient); return streamingPaymentsClient; diff --git a/packages/colony-js/src/clients/Extensions/StreamingPayments/contracts.ts b/packages/colony-js/src/clients/Extensions/StreamingPayments/contracts.ts index 8374dbaba..5aad24201 100644 --- a/packages/colony-js/src/clients/Extensions/StreamingPayments/contracts.ts +++ b/packages/colony-js/src/clients/Extensions/StreamingPayments/contracts.ts @@ -3,6 +3,7 @@ import type { StreamingPayments as StreamingPayments1 } from '../../../contracts import type { StreamingPayments as StreamingPayments2 } from '../../../contracts/StreamingPayments/2/index.js'; import type { StreamingPayments as StreamingPayments3 } from '../../../contracts/StreamingPayments/3/index.js'; import type { StreamingPayments as StreamingPayments4 } from '../../../contracts/StreamingPayments/4/index.js'; +import type { StreamingPayments as StreamingPayments5 } from '../../../contracts/StreamingPayments/5/index.js'; // Always adjust to the latest factory export { StreamingPayments__factory as StreamingPaymentsFactory } from '../../../contracts/StreamingPayments/4/factories/StreamingPayments__factory.js'; @@ -11,6 +12,7 @@ export type StreamingPaymentsV1 = StreamingPayments1; export type StreamingPaymentsV2 = StreamingPayments2; export type StreamingPaymentsV3 = StreamingPayments3; export type StreamingPaymentsV4 = StreamingPayments4; +export type StreamingPaymentsV5 = StreamingPayments5; -// No one is using StreamingPaymentsV1 through V3, so we can safely ignore them for now -export type AnyStreamingPayments = StreamingPayments4; +// No one is using StreamingPaymentsV1 through V4, so we can safely ignore them for now +export type AnyStreamingPayments = StreamingPaymentsV5; diff --git a/packages/colony-js/src/clients/Extensions/StreamingPayments/exports.ts b/packages/colony-js/src/clients/Extensions/StreamingPayments/exports.ts index 262cfba24..71cfc8cad 100644 --- a/packages/colony-js/src/clients/Extensions/StreamingPayments/exports.ts +++ b/packages/colony-js/src/clients/Extensions/StreamingPayments/exports.ts @@ -5,13 +5,13 @@ import { assertExhaustiveSwitch } from '@colony/core/utils'; import { AugmentedIColony } from '../../Core/augments/commonAugments.js'; import { ValidColony } from './augments/commonAugments.js'; -import getStreamingPaymentsClientV4, { - StreamingPaymentsClientV4, -} from './StreamingPaymentsClientV4.js'; +import getStreamingPaymentsClientV5, { + StreamingPaymentsClientV5, +} from './StreamingPaymentsClientV5.js'; -export { StreamingPaymentsClientV4 } from './StreamingPaymentsClientV4.js'; +export { StreamingPaymentsClientV5 } from './StreamingPaymentsClientV5.js'; -export type AnyStreamingPaymentsClient = StreamingPaymentsClientV4; +export type AnyStreamingPaymentsClient = StreamingPaymentsClientV5; /** @internal */ export const getStreamingPaymentsClient = ( @@ -27,7 +27,9 @@ export const getStreamingPaymentsClient = ( case 3: throw new Error('StreamingPayments version 3 is not supported'); case 4: - return getStreamingPaymentsClientV4( + throw new Error('StreamingPayments version 4 is not supported'); + case 5: + return getStreamingPaymentsClientV5( colonyClient as AugmentedIColony, address, ); diff --git a/packages/contractor/package.json b/packages/contractor/package.json index 70d2a15a3..7c5fea69a 100644 --- a/packages/contractor/package.json +++ b/packages/contractor/package.json @@ -30,7 +30,7 @@ }, "homepage": "https://docs.colony.io/develop", "dependencies": { - "@colony/abis": "0.0.0-snapshot-next-78ab0ee9", + "@colony/abis": "0.0.0-snapshot-next-78ab0ee9-08d6", "@typechain/ethers-v5": "^11.1.0", "@typechain/ethers-v6": "^0.4.2", "@types/mkdirp": "^1.0.2", diff --git a/packages/core/src/versions/StreamingPayments.ts b/packages/core/src/versions/StreamingPayments.ts index 31960b572..80ece3017 100644 --- a/packages/core/src/versions/StreamingPayments.ts +++ b/packages/core/src/versions/StreamingPayments.ts @@ -2,7 +2,7 @@ import type { ColonyVersion } from './IColony.js'; import { createContractVersionArray } from './utils.js'; -const STREAMING_PAYMENTS_VERSION_NEXT = 5; +const STREAMING_PAYMENTS_VERSION_NEXT = 6; /** @internal */ export const STREAMING_PAYMENTS_VERSIONS = createContractVersionArray( @@ -21,6 +21,7 @@ export const streamingPaymentsIncompatibilityMap: Record< 2: [1, 2, 3], 3: [1, 2, 3], 4: [1, 2, 3], + 5: [1, 2, 3], }; /** @internal */ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6217a17af..515ea4f02 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -115,8 +115,8 @@ importers: packages/contractor: dependencies: '@colony/abis': - specifier: 0.0.0-snapshot-next-78ab0ee9 - version: 0.0.0-snapshot-next-78ab0ee9 + specifier: 0.0.0-snapshot-next-78ab0ee9-08d6 + version: 0.0.0-snapshot-next-78ab0ee9-08d6 '@typechain/ethers-v5': specifier: ^11.1.0 version: 11.1.0(@ethersproject/abi@5.7.0)(@ethersproject/providers@5.7.2)(typechain@8.3.0)(typescript@5.1.6) @@ -828,8 +828,8 @@ packages: prettier: 2.8.8 dev: false - /@colony/abis@0.0.0-snapshot-next-78ab0ee9: - resolution: {integrity: sha512-xilU4frRE9+wxaHHIyw1MuBwCtDDDMLyiQwW7G/3wCt0TRA/2YI6Bc1K9lekjOpideBRwMQxeYRlyN1CVVjnWg==} + /@colony/abis@0.0.0-snapshot-next-78ab0ee9-08d6: + resolution: {integrity: sha512-sD6yC8mpavKqQZV05wFyBf3X5kimkSMXGoHe0lssBJSVxa6u0Cs7l9u+pI9K1cgsfYeeOS2ojKoMQwb7HcnyFA==} engines: {node: ^16 || ^18 || ^20, npm: ^8 || ^9 || ^10} dev: false