From 273260fe1bedbcc42cb15b02d9c16cb966a13239 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:42:57 +0100 Subject: [PATCH 01/13] feat: define the common domain and the current used exceptions and add getter function for dao ens and plugin ens --- configs/src/deployments/osx-ens-domains.ts | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 configs/src/deployments/osx-ens-domains.ts diff --git a/configs/src/deployments/osx-ens-domains.ts b/configs/src/deployments/osx-ens-domains.ts new file mode 100644 index 00000000..fc128ddd --- /dev/null +++ b/configs/src/deployments/osx-ens-domains.ts @@ -0,0 +1,30 @@ +import {SupportedNetworks} from '../networks'; +import {NetworkDomains, NetworkDomain} from './types'; + +export const commonDomain: NetworkDomain = { + daoEns: 'dao.eth', + pluginEns: 'plugin.dao.eth', +}; + +export const exceptionalDomains: NetworkDomains = { + [SupportedNetworks.SEPOLIA]: { + daoEns: 'aragon-dao.eth', + pluginEns: 'plugin.aragon-dao.eth', + }, +}; + +export function getDaoEnsDomain(networkName: string): string { + if (exceptionalDomains[networkName]) { + return exceptionalDomains[networkName].daoEns; + } else { + return commonDomain.daoEns; + } +} + +export function getPluginEnsDomain(networkName: string): string { + if (exceptionalDomains[networkName]) { + return exceptionalDomains[networkName].pluginEns; + } else { + return commonDomain.pluginEns; + } +} From 52314797162e13df2f9047c83a0ae758315cde41 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:43:59 +0100 Subject: [PATCH 02/13] feat: define Network domain type --- configs/src/deployments/types.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configs/src/deployments/types.ts b/configs/src/deployments/types.ts index fae16a3d..75b83e3b 100644 --- a/configs/src/deployments/types.ts +++ b/configs/src/deployments/types.ts @@ -64,3 +64,12 @@ export enum ContractNames { TOKEN_VOTING_REPO_IMPLEMENTATION = 'TokenVotingRepoImplementation', ENS_REGISTRY = 'ENSRegistry', } + +export type NetworkDomain = { + daoEns: string; + pluginEns: string; +}; + +export type NetworkDomains = { + [network: string]: NetworkDomain; +}; From 038b9a6c415b2e47aeff910d5837cfae95af2658 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:44:31 +0100 Subject: [PATCH 03/13] ci: move the getters to the getter file --- configs/src/deployments/getters.ts | 18 ++++++++++++++++++ configs/src/deployments/index.ts | 1 + configs/src/deployments/osx-ens-domains.ts | 16 ---------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/configs/src/deployments/getters.ts b/configs/src/deployments/getters.ts index 30432b52..962accff 100644 --- a/configs/src/deployments/getters.ts +++ b/configs/src/deployments/getters.ts @@ -1,5 +1,6 @@ import {SupportedNetworks} from '../networks'; import {contracts} from './contracts'; +import {exceptionalDomains, commonDomain} from './osx-ens-domains'; import { NetworkDeployment, NetworkDeployments, @@ -50,3 +51,20 @@ export function getLatestNetworkDeployment( } return null; } + +export function getDaoEnsDomain(networkName: string): string { + console.log('=======> pluggin', exceptionalDomains[networkName]); + if (exceptionalDomains[networkName]) { + return exceptionalDomains[networkName].daoEns; + } else { + return commonDomain.daoEns; + } +} + +export function getPluginEnsDomain(networkName: string): string { + if (exceptionalDomains[networkName]) { + return exceptionalDomains[networkName].pluginEns; + } else { + return commonDomain.pluginEns; + } +} diff --git a/configs/src/deployments/index.ts b/configs/src/deployments/index.ts index 98551508..532ede49 100644 --- a/configs/src/deployments/index.ts +++ b/configs/src/deployments/index.ts @@ -1,3 +1,4 @@ export * from './types'; export * from './getters'; export * from './contracts'; +export * from './osx-ens-domains'; diff --git a/configs/src/deployments/osx-ens-domains.ts b/configs/src/deployments/osx-ens-domains.ts index fc128ddd..a6e23b9e 100644 --- a/configs/src/deployments/osx-ens-domains.ts +++ b/configs/src/deployments/osx-ens-domains.ts @@ -12,19 +12,3 @@ export const exceptionalDomains: NetworkDomains = { pluginEns: 'plugin.aragon-dao.eth', }, }; - -export function getDaoEnsDomain(networkName: string): string { - if (exceptionalDomains[networkName]) { - return exceptionalDomains[networkName].daoEns; - } else { - return commonDomain.daoEns; - } -} - -export function getPluginEnsDomain(networkName: string): string { - if (exceptionalDomains[networkName]) { - return exceptionalDomains[networkName].pluginEns; - } else { - return commonDomain.pluginEns; - } -} From 0a3f9cd21ff4220b5e97f299b134e565b7a2740e Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:45:15 +0100 Subject: [PATCH 04/13] ci: create a folder for the deployment tests --- configs/src/test/unit/{ => deployments}/deployments.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename configs/src/test/unit/{ => deployments}/deployments.test.ts (95%) diff --git a/configs/src/test/unit/deployments.test.ts b/configs/src/test/unit/deployments/deployments.test.ts similarity index 95% rename from configs/src/test/unit/deployments.test.ts rename to configs/src/test/unit/deployments/deployments.test.ts index 1faaa86b..6d9ad118 100644 --- a/configs/src/test/unit/deployments.test.ts +++ b/configs/src/test/unit/deployments/deployments.test.ts @@ -4,8 +4,8 @@ import { getLatestNetworkDeployment, getNetworkDeploymentForVersion, getNetworkDeployments, -} from '../../deployments'; -import {SupportedNetworks} from '../../networks'; +} from '../../../deployments'; +import {SupportedNetworks} from '../../../networks'; describe('Deployments', () => { describe('getNetworkDeployments', () => { From 766494969a63c9858f624c18e9e2cadbdcba04b9 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:45:40 +0100 Subject: [PATCH 05/13] feat: add tests for the get dao and plugin functions --- configs/src/test/unit/deployments/ens.test.ts | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 configs/src/test/unit/deployments/ens.test.ts diff --git a/configs/src/test/unit/deployments/ens.test.ts b/configs/src/test/unit/deployments/ens.test.ts new file mode 100644 index 00000000..b83988cf --- /dev/null +++ b/configs/src/test/unit/deployments/ens.test.ts @@ -0,0 +1,54 @@ +import { + getDaoEnsDomain, + getPluginEnsDomain, + commonDomain, + exceptionalDomains, +} from '../../../deployments'; +import {SupportedNetworks} from '../../../networks'; + +describe('Domains', () => { + describe('getDaoEnsDomain', () => { + it('should return the correct dao ens', () => { + for (const network of Object.values(SupportedNetworks)) { + if (exceptionalDomains[network]) { + expect(getDaoEnsDomain(network)).toMatch( + exceptionalDomains[network].daoEns + ); + } else { + expect(getDaoEnsDomain(network)).toMatch(commonDomain.daoEns); + } + } + }); + }); + describe('getPluginEnsDomain', () => { + it('should return the correct plugin ens', () => { + for (const network of Object.values(SupportedNetworks)) { + if (exceptionalDomains[network]) { + expect(getPluginEnsDomain(network)).toMatch( + exceptionalDomains[network].pluginEns + ); + } else { + expect(getPluginEnsDomain(network)).toMatch(commonDomain.pluginEns); + } + } + }); + }); + describe('add new network to exceptional domains', () => { + beforeEach(() => { + exceptionalDomains[SupportedNetworks.LOCAL] = { + daoEns: 'new-dao.eth', + pluginEns: 'plugin.new-dao.eth', + }; + }); + it('should return the new exceptional dao ens', () => { + expect(getDaoEnsDomain(SupportedNetworks.LOCAL)).toMatch( + exceptionalDomains[SupportedNetworks.LOCAL].daoEns + ); + }); + it('should return the new exceptional plugin ens', () => { + expect(getPluginEnsDomain(SupportedNetworks.LOCAL)).toMatch( + exceptionalDomains[SupportedNetworks.LOCAL].pluginEns + ); + }); + }); +}); From 70f1d8a5e21456bd0c678e3d13763e210a72f61b Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:46:21 +0100 Subject: [PATCH 06/13] feat: add new deployment test folder to avoid being ignored in the prettierignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index 900a74c2..6c05a035 100644 --- a/.prettierignore +++ b/.prettierignore @@ -15,6 +15,7 @@ imported generated */sdk/test/integration/*.test.ts !configs/src/deployments/ +!configs/src/test/unit/deployments/ # files *.env From 846215cf886065b51b4c532d24a265269f636dac Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:53:30 +0100 Subject: [PATCH 07/13] ci: remove log --- configs/src/deployments/getters.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/src/deployments/getters.ts b/configs/src/deployments/getters.ts index 962accff..a355549b 100644 --- a/configs/src/deployments/getters.ts +++ b/configs/src/deployments/getters.ts @@ -53,7 +53,6 @@ export function getLatestNetworkDeployment( } export function getDaoEnsDomain(networkName: string): string { - console.log('=======> pluggin', exceptionalDomains[networkName]); if (exceptionalDomains[networkName]) { return exceptionalDomains[networkName].daoEns; } else { From 9bd28669e4ef6b7516876d8bcb4d03a0b94d4bd2 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 13:54:32 +0100 Subject: [PATCH 08/13] featL update the changelog --- configs/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configs/CHANGELOG.md b/configs/CHANGELOG.md index 7110ab29..ade3a413 100644 --- a/configs/CHANGELOG.md +++ b/configs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## v0.2.1 + +### Added + +- `getDaoEnsDomain` and `getPluginEnsDomain` functions. + ## v0.2.0 ### Added From cf36808d783e8fbee7b6608b7a95892de9a55344 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 4 Mar 2024 17:17:02 +0100 Subject: [PATCH 09/13] ci: rename types commented in the PR review --- configs/src/deployments/osx-ens-domains.ts | 6 +++--- configs/src/deployments/types.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configs/src/deployments/osx-ens-domains.ts b/configs/src/deployments/osx-ens-domains.ts index a6e23b9e..fa7b6dfa 100644 --- a/configs/src/deployments/osx-ens-domains.ts +++ b/configs/src/deployments/osx-ens-domains.ts @@ -1,12 +1,12 @@ import {SupportedNetworks} from '../networks'; -import {NetworkDomains, NetworkDomain} from './types'; +import {ENSNetworkDomain, ENSNetworkDomainsMap} from './types'; -export const commonDomain: NetworkDomain = { +export const commonDomain: ENSNetworkDomain = { daoEns: 'dao.eth', pluginEns: 'plugin.dao.eth', }; -export const exceptionalDomains: NetworkDomains = { +export const exceptionalDomains: ENSNetworkDomainsMap = { [SupportedNetworks.SEPOLIA]: { daoEns: 'aragon-dao.eth', pluginEns: 'plugin.aragon-dao.eth', diff --git a/configs/src/deployments/types.ts b/configs/src/deployments/types.ts index 75b83e3b..a8293d11 100644 --- a/configs/src/deployments/types.ts +++ b/configs/src/deployments/types.ts @@ -65,11 +65,11 @@ export enum ContractNames { ENS_REGISTRY = 'ENSRegistry', } -export type NetworkDomain = { +export type ENSNetworkDomain = { daoEns: string; pluginEns: string; }; -export type NetworkDomains = { - [network: string]: NetworkDomain; +export type ENSNetworkDomainsMap = { + [network: string]: ENSNetworkDomain; }; From 7f583eb7b25e5863d3d2e46a5670fa72202604a8 Mon Sep 17 00:00:00 2001 From: Claudia Barcelo Date: Tue, 5 Mar 2024 13:32:11 +0100 Subject: [PATCH 10/13] Update configs/src/deployments/types.ts Co-authored-by: josemarinas <36479864+josemarinas@users.noreply.github.com> --- configs/src/deployments/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/src/deployments/types.ts b/configs/src/deployments/types.ts index a8293d11..d8329278 100644 --- a/configs/src/deployments/types.ts +++ b/configs/src/deployments/types.ts @@ -71,5 +71,5 @@ export type ENSNetworkDomain = { }; export type ENSNetworkDomainsMap = { - [network: string]: ENSNetworkDomain; + [index in SupportedNetworks]?: ENSNetworkDomain; }; From 7a9dd3b3b6083ca2eae7bd496320a03f9303557a Mon Sep 17 00:00:00 2001 From: Claudia Date: Tue, 5 Mar 2024 13:39:09 +0100 Subject: [PATCH 11/13] feat: fix types issues after using the supported network type --- configs/src/deployments/getters.ts | 12 ++++++++---- configs/src/deployments/types.ts | 4 +++- configs/src/test/unit/deployments/ens.test.ts | 8 ++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/configs/src/deployments/getters.ts b/configs/src/deployments/getters.ts index a355549b..bb1e8808 100644 --- a/configs/src/deployments/getters.ts +++ b/configs/src/deployments/getters.ts @@ -52,17 +52,21 @@ export function getLatestNetworkDeployment( return null; } -export function getDaoEnsDomain(networkName: string): string { +export function getDaoEnsDomain( + networkName: SupportedNetworks +): string | undefined { if (exceptionalDomains[networkName]) { - return exceptionalDomains[networkName].daoEns; + return exceptionalDomains[networkName]?.daoEns; } else { return commonDomain.daoEns; } } -export function getPluginEnsDomain(networkName: string): string { +export function getPluginEnsDomain( + networkName: SupportedNetworks +): string | undefined { if (exceptionalDomains[networkName]) { - return exceptionalDomains[networkName].pluginEns; + return exceptionalDomains[networkName]?.pluginEns; } else { return commonDomain.pluginEns; } diff --git a/configs/src/deployments/types.ts b/configs/src/deployments/types.ts index d8329278..4033916f 100644 --- a/configs/src/deployments/types.ts +++ b/configs/src/deployments/types.ts @@ -1,3 +1,5 @@ +import {SupportedNetworks} from '../networks/types'; + // the entries in this enum has to be in order from // oldest to newest so that getLatestNetworkVersion() works as expected export enum SupportedVersions { @@ -71,5 +73,5 @@ export type ENSNetworkDomain = { }; export type ENSNetworkDomainsMap = { - [index in SupportedNetworks]?: ENSNetworkDomain; + [network in SupportedNetworks]?: ENSNetworkDomain; }; diff --git a/configs/src/test/unit/deployments/ens.test.ts b/configs/src/test/unit/deployments/ens.test.ts index b83988cf..ed1aacc0 100644 --- a/configs/src/test/unit/deployments/ens.test.ts +++ b/configs/src/test/unit/deployments/ens.test.ts @@ -12,7 +12,7 @@ describe('Domains', () => { for (const network of Object.values(SupportedNetworks)) { if (exceptionalDomains[network]) { expect(getDaoEnsDomain(network)).toMatch( - exceptionalDomains[network].daoEns + exceptionalDomains[network]?.daoEns ?? '' ); } else { expect(getDaoEnsDomain(network)).toMatch(commonDomain.daoEns); @@ -25,7 +25,7 @@ describe('Domains', () => { for (const network of Object.values(SupportedNetworks)) { if (exceptionalDomains[network]) { expect(getPluginEnsDomain(network)).toMatch( - exceptionalDomains[network].pluginEns + exceptionalDomains[network]?.daoEns ?? '' ); } else { expect(getPluginEnsDomain(network)).toMatch(commonDomain.pluginEns); @@ -42,12 +42,12 @@ describe('Domains', () => { }); it('should return the new exceptional dao ens', () => { expect(getDaoEnsDomain(SupportedNetworks.LOCAL)).toMatch( - exceptionalDomains[SupportedNetworks.LOCAL].daoEns + exceptionalDomains[SupportedNetworks.LOCAL]?.daoEns ?? '' ); }); it('should return the new exceptional plugin ens', () => { expect(getPluginEnsDomain(SupportedNetworks.LOCAL)).toMatch( - exceptionalDomains[SupportedNetworks.LOCAL].pluginEns + exceptionalDomains[SupportedNetworks.LOCAL]?.pluginEns ?? '' ); }); }); From 706b19a433c7b51d8d514fcdca653b4fa9c1ff92 Mon Sep 17 00:00:00 2001 From: Claudia Date: Wed, 6 Mar 2024 11:51:30 +0100 Subject: [PATCH 12/13] ci: rename the osx ens domains file --- configs/src/deployments/{osx-ens-domains.ts => ens.ts} | 0 configs/src/deployments/getters.ts | 2 +- configs/src/deployments/index.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename configs/src/deployments/{osx-ens-domains.ts => ens.ts} (100%) diff --git a/configs/src/deployments/osx-ens-domains.ts b/configs/src/deployments/ens.ts similarity index 100% rename from configs/src/deployments/osx-ens-domains.ts rename to configs/src/deployments/ens.ts diff --git a/configs/src/deployments/getters.ts b/configs/src/deployments/getters.ts index bb1e8808..998aaa0c 100644 --- a/configs/src/deployments/getters.ts +++ b/configs/src/deployments/getters.ts @@ -1,6 +1,6 @@ import {SupportedNetworks} from '../networks'; import {contracts} from './contracts'; -import {exceptionalDomains, commonDomain} from './osx-ens-domains'; +import {exceptionalDomains, commonDomain} from './ens'; import { NetworkDeployment, NetworkDeployments, diff --git a/configs/src/deployments/index.ts b/configs/src/deployments/index.ts index 532ede49..d785305e 100644 --- a/configs/src/deployments/index.ts +++ b/configs/src/deployments/index.ts @@ -1,4 +1,4 @@ export * from './types'; export * from './getters'; export * from './contracts'; -export * from './osx-ens-domains'; +export * from './ens'; From a9e1f2252beddc042199b5e6da361709d629b1d6 Mon Sep 17 00:00:00 2001 From: Claudia Date: Wed, 6 Mar 2024 12:14:10 +0100 Subject: [PATCH 13/13] feat: update the package version --- configs/CHANGELOG.md | 2 +- configs/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/CHANGELOG.md b/configs/CHANGELOG.md index ade3a413..111a8864 100644 --- a/configs/CHANGELOG.md +++ b/configs/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## v0.2.1 +## v0.3.0 ### Added diff --git a/configs/package.json b/configs/package.json index 4ebf8e8a..fa92ad1b 100644 --- a/configs/package.json +++ b/configs/package.json @@ -1,7 +1,7 @@ { "name": "@aragon/osx-commons-configs", "author": "Aragon Association", - "version": "0.2.0", + "version": "0.3.0", "license": "AGPL-3.0-or-later", "typings": "dist/index.d.ts", "main": "dist/index.js",