Move config to JSON, update tsconfig

This commit is contained in:
Alexis Sellier
2021-05-04 10:48:25 +02:00
parent 08ef4b6d6e
commit 4ab188b6ed
4 changed files with 34 additions and 34 deletions
+24
View File
@@ -0,0 +1,24 @@
{
"homestead": {
"registrar": {
"address": "0x37723287Ae6F34866d82EE623401f92Ec9013154"
},
"radToken": {
"address": "0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3"
},
"orgFactory": {
"address": "0x0000000000000000000000000000000000000000"
}
},
"ropsten": {
"registrar": {
"address": "0xb31441c140E92Ca20A0141D68b13b10ca051e40a"
},
"radToken": {
"address": "0x59b5eee36f5fa52400A136Fd4630Ee2bF126a4C0"
},
"orgFactory": {
"address": "0xF3D04e874D07d680e8b26332eEae5b9B1c263121"
}
}
}
+2 -27
View File
@@ -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<Config> {
const provider = new ethers.providers.Web3Provider(window.ethereum);
let network = await provider.ready;
let cfg = addresses[network.name];
let cfg = (<Record<string, any>> config)[network.name];
if (cfg) {
return {
+1
View File
@@ -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';
+7 -7
View File
@@ -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
}