From 4bd161343867efc31f1011155735d5df68df1dd3 Mon Sep 17 00:00:00 2001 From: Morgan Brown Date: Fri, 6 Dec 2024 20:54:12 +0800 Subject: [PATCH] Code cleanup --- .../steps/add-ethereum-address/add-ethereum-address.svelte | 2 -- .../steps/add-ethereum-address/drips-json-template.ts | 4 +++- src/lib/utils/github/GitHub.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte index a9c807cd5..efdd62c8b 100644 --- a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte +++ b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte @@ -55,8 +55,6 @@ const { ownerName, repoName } = $context.project?.source ?? unreachable(); fundingJson = (await github.fetchFundingJson(ownerName, repoName)) || {}; [code, highlight] = getChangedTemplate(fundingJson, address, network); - // eslint-disable-next-line no-console - console.log(fundingJson); } onMount(() => { diff --git a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts index 9e5ad59b5..cbcc12007 100644 --- a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts +++ b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts @@ -1,3 +1,5 @@ +import type { FundingJson } from '$lib/utils/github/GitHub'; + const NUM_SPACES = 2; export const getChangedTemplate = ( @@ -26,7 +28,7 @@ export const getChangedTemplate = ( return [asJSON, [start, end]]; }; -export const objectTemplate = (address: string, network = 'ethereum') => { +export const objectTemplate = (address: string, network = 'ethereum'): FundingJson => { return { drips: { [network]: { diff --git a/src/lib/utils/github/GitHub.ts b/src/lib/utils/github/GitHub.ts index 89210d6c5..f0cf5ecaa 100644 --- a/src/lib/utils/github/GitHub.ts +++ b/src/lib/utils/github/GitHub.ts @@ -2,7 +2,7 @@ import network from '$lib/stores/wallet/network'; import type { Octokit } from '@octokit/rest'; import { Buffer } from 'buffer'; -type DripsJson = { +export type FundingJson = { drips?: { [key: string]: { ownedBy: string; @@ -70,7 +70,7 @@ export default class GitHub { } } - public async fetchFundingJson(owner: string, repo: string): Promise { + public async fetchFundingJson(owner: string, repo: string): Promise { try { const { data } = await this.octokit.repos.getContent({ owner,