diff --git a/src/config.json b/src/config.json new file mode 100644 index 000000000..38d47f9e7 --- /dev/null +++ b/src/config.json @@ -0,0 +1,24 @@ +{ + "homestead": { + "registrar": { + "address": "0x37723287Ae6F34866d82EE623401f92Ec9013154" + }, + "radToken": { + "address": "0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3" + }, + "orgFactory": { + "address": "0x0000000000000000000000000000000000000000" + } + }, + "ropsten": { + "registrar": { + "address": "0xb31441c140E92Ca20A0141D68b13b10ca051e40a" + }, + "radToken": { + "address": "0x59b5eee36f5fa52400A136Fd4630Ee2bF126a4C0" + }, + "orgFactory": { + "address": "0xF3D04e874D07d680e8b26332eEae5b9B1c263121" + } + } +} diff --git a/src/config.ts b/src/config.ts index 2ae404b3b..d21501bb9 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,4 +1,5 @@ import { ethers } from "ethers"; +import config from "@app/config.json"; declare global { interface Window { @@ -16,32 +17,6 @@ export type Config = { signer: ethers.Signer, }; -// TODO: Move to JSON. -const addresses = { - homestead: { - registrar: { - address: "0x37723287Ae6F34866d82EE623401f92Ec9013154", - }, - radToken: { - address: "0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3", - }, - orgFactory: { - address: "0x0000000000000000000000000000000000000000", - }, - }, - ropsten: { - registrar: { - address: "0xb31441c140E92Ca20A0141D68b13b10ca051e40a", - }, - radToken: { - address: "0x59b5eee36f5fa52400A136Fd4630Ee2bF126a4C0", - }, - orgFactory: { - address: "0xF3D04e874D07d680e8b26332eEae5b9B1c263121", - }, - } -}; - /// Gas limits for various transactions. const gasLimits = { createOrg: 1_000_000, @@ -57,7 +32,7 @@ export async function getConfig(): Promise { const provider = new ethers.providers.Web3Provider(window.ethereum); let network = await provider.ready; - let cfg = addresses[network.name]; + let cfg = (> config)[network.name]; if (cfg) { return { diff --git a/src/session.ts b/src/session.ts index f2849ebc0..aeccb94f7 100644 --- a/src/session.ts +++ b/src/session.ts @@ -1,3 +1,4 @@ +// TODO: Handle wallet account change. import { get, writable, derived, Writable } from "svelte/store"; import { ethers } from "ethers"; import type { TransactionReceipt, TransactionResponse } from '@ethersproject/providers'; diff --git a/tsconfig.json b/tsconfig.json index 7c89660d9..d3aa4bd06 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,15 +13,15 @@ "svelte" ], "moduleResolution": "node", + "strict": true, + "resolveJsonModule": true, + "useDefineForClassFields": true, + "allowSyntheticDefaultImports": true, + "importsNotUsedAsValues": "error", + "skipLibCheck": true, "paths": { "@app/*": ["./src/*"] } }, - "noEmit": true, - "resolveJsonModule": true, - "useDefineForClassFields": true, - "strict": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "importsNotUsedAsValues": "error" + "noEmit": true }