Run linter on more files

This commit is contained in:
Alexis Sellier
2021-06-10 11:01:22 +02:00
parent 0b6d60c69a
commit eb664f3bea
5 changed files with 35 additions and 35 deletions
+7 -7
View File
@@ -77,9 +77,9 @@ export class Org {
async getProjects(config: Config): Promise<Array<Project>> {
const result = await utils.querySubgraph(GetProjects, { org: this.address }, config);
let projects: Project[] = [];
const projects: Project[] = [];
for (let p of result.projects) {
for (const p of result.projects) {
try {
p.id = utils.formatRadicleId(ethers.utils.arrayify(p.id));
p.anchor.stateHash = utils.formatProjectHash(
@@ -96,9 +96,9 @@ export class Org {
static async getAll(config: Config): Promise<Array<Org>> {
const result = await utils.querySubgraph(GetOrgs, {}, config);
let orgs: Org[] = [];
const orgs: Org[] = [];
for (let o of result.orgs) {
for (const o of result.orgs) {
try {
orgs.push(new Org(o.id, o.owner));
} catch (e) {
@@ -109,11 +109,11 @@ export class Org {
}
static fromReceipt(receipt: ContractReceipt): Org | null {
let event = receipt.events?.find(e => e.event === 'OrgCreated');
const event = receipt.events?.find(e => e.event === 'OrgCreated');
if (event && event.args) {
let address = event.args[0];
let owner = event.args[1];
const address = event.args[0];
const owner = event.args[1];
return new Org(address, owner);
}
+17 -17
View File
@@ -11,14 +11,14 @@ import { unixTime } from '@app/utils';
import { assert } from '@app/error';
export interface Registration {
name: string
owner: string
address: string | null
url: string | null
avatar: string | null
twitter: string | null
github: string | null
resolver: EnsResolver
name: string;
owner: string;
address: string | null;
url: string | null;
avatar: string | null;
twitter: string | null;
github: string | null;
resolver: EnsResolver;
}
export enum State {
@@ -80,8 +80,8 @@ export async function registerName(name: string, owner: string, config: Config)
if (! name) return;
let commitmentJson = window.localStorage.getItem('commitment');
let commitment = commitmentJson && JSON.parse(commitmentJson);
const commitmentJson = window.localStorage.getItem('commitment');
const commitment = commitmentJson && JSON.parse(commitmentJson);
try {
// Try to recover an existing commitment.
@@ -96,9 +96,9 @@ export async function registerName(name: string, owner: string, config: Config)
}
async function commitAndRegister(name: string, owner: string, config: Config) {
let salt = ethers.utils.randomBytes(32);
let minAge = (await registrar(config).minCommitmentAge()).toNumber();
let fee = await registrationFee(config);
const salt = ethers.utils.randomBytes(32);
const minAge = (await registrar(config).minCommitmentAge()).toNumber();
const fee = await registrationFee(config);
// Avoids gas spent by the owner, trying to commit to a name and not having
// enough RAD balance
if ((await radToken(config).balanceOf(owner)).lt(fee)) {
@@ -202,7 +202,7 @@ async function register(name: string, owner: string, salt: Uint8Array, config: C
}
function makeCommitment(name: string, owner: string, salt: Uint8Array): string {
let bytes = ethers.utils.concat([
const bytes = ethers.utils.concat([
ethers.utils.toUtf8Bytes(name),
ethers.utils.getAddress(owner),
ethers.BigNumber.from(salt).toHexString(),
@@ -211,13 +211,13 @@ function makeCommitment(name: string, owner: string, salt: Uint8Array): string {
}
async function getOwner(name: string, config: Config): Promise<string> {
let ensAddr = config.provider.network.ensAddress;
const ensAddr = config.provider.network.ensAddress;
if (! ensAddr) {
throw new Error("ENS address is not defined");
}
let registry = new ethers.Contract(ensAddr, config.abi.ens, config.provider);
let owner = await registry.owner(ethers.utils.namehash(name));
const registry = new ethers.Contract(ensAddr, config.abi.ens, config.provider);
const owner = await registry.owner(ethers.utils.namehash(name));
return owner;
}
+3 -3
View File
@@ -4,7 +4,7 @@ import { ethers } from 'ethers';
import type { Config } from '@app/config';
import { assert } from '@app/error';
export type EnsRecord = { name: string, value: string };
export type EnsRecord = { name: string; value: string };
export async function setRecords(name: string, records: EnsRecord[], resolver: EnsResolver, config: Config): Promise<TransactionResponse> {
assert(config.signer);
@@ -12,10 +12,10 @@ export async function setRecords(name: string, records: EnsRecord[], resolver: E
const resolverContract = new ethers.Contract(resolver.address, config.abi.resolver, config.signer);
const node = ethers.utils.namehash(`${name}.${config.registrar.domain}`);
let calls = [];
const calls = [];
const iface = new ethers.utils.Interface(config.abi.resolver);
for (let r of records) {
for (const r of records) {
switch (r.name) {
case "address":
calls.push(
+1 -1
View File
@@ -9,7 +9,7 @@ export enum State {
WithdrawingSign = 4,
Withdrawing = 5,
Withdrawn = 6,
};
}
export const state = writable(State.Idle);
+7 -7
View File
@@ -6,12 +6,12 @@ import type { Config } from "@app/config";
export interface VestingInfo {
token: string,
symbol: string,
beneficiary: string,
totalVesting: string,
withdrawableBalance: string,
withdrawn: string
token: string;
symbol: string;
beneficiary: string;
totalVesting: string;
withdrawableBalance: string;
withdrawn: string;
}
export async function withdrawVested(address: string, config: Config) {
@@ -20,7 +20,7 @@ export async function withdrawVested(address: string, config: Config) {
state.set(State.WithdrawingSign);
let tx = await contract.connect(signer).withdrawVested();
const tx = await contract.connect(signer).withdrawVested();
state.set(State.Withdrawing);
await tx.wait();