From 92967df864ffd9cab3ab91518d77a4024e5e57e5 Mon Sep 17 00:00:00 2001 From: Mathias Scherer Date: Thu, 4 Jan 2024 11:20:21 +0100 Subject: [PATCH] feat(configs): exports networks properly typed with generics (#38) --- configs/package.json | 2 +- configs/src/index.ts | 7 ++++++- configs/src/types.ts | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 configs/src/types.ts diff --git a/configs/package.json b/configs/package.json index 1e0b3108..840485e8 100644 --- a/configs/package.json +++ b/configs/package.json @@ -1,7 +1,7 @@ { "name": "@aragon/osx-commons-configs", "author": "Aragon Association", - "version": "0.0.1", + "version": "0.0.2", "license": "AGPL-3.0-or-later", "typings": "dist/index.d.ts", "main": "dist/index.js", diff --git a/configs/src/index.ts b/configs/src/index.ts index 35eb8814..18675232 100644 --- a/configs/src/index.ts +++ b/configs/src/index.ts @@ -9,9 +9,14 @@ import * as mumbai from './deployments/mumbai.json'; import * as polygon from './deployments/polygon.json'; import * as sepolia from './deployments/sepolia.json'; import * as networks from './networks.json'; +import {NetworkConfigs} from './types'; + +export * from './types'; + +const networksTyped: NetworkConfigs = networks; export { - networks, + networksTyped as networks, arbitrum, arbitrumSepolia, baseGoerli, diff --git a/configs/src/types.ts b/configs/src/types.ts new file mode 100644 index 00000000..6812ad6a --- /dev/null +++ b/configs/src/types.ts @@ -0,0 +1,16 @@ +export type NetworkConfig = { + url: string; + isTestnet: boolean; + chainId: number; + aliases: NetworkAliases; +}; + +export type NetworkAliases = { + ethers5?: string; + ethers6?: string; + alchemySubgraphs?: string; +}; + +export type NetworkConfigs = { + [network: string]: T; +};