From 210716b5d35423ba22aa080bfea00df8e725d7ce Mon Sep 17 00:00:00 2001 From: Malone Hedges Date: Tue, 13 Sep 2022 17:24:20 -0700 Subject: [PATCH] example: misc fixes (#77) --- example/src/api.ts | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/example/src/api.ts b/example/src/api.ts index 533f034..026db6e 100644 --- a/example/src/api.ts +++ b/example/src/api.ts @@ -1,7 +1,7 @@ import { utils } from 'ethers' import { MerkleTree } from 'merkletreejs' -const baseUrl = 'http://localhost:8080' +const baseUrl = process.env.API_URL ?? 'http://localhost:8080' const createTree = async ( unhashedLeaves: string[], @@ -82,7 +82,7 @@ const getProofForIndexedAddress = async ( const getRootFromProof = async (proof: string[]): Promise => { const rootRes = await fetch(`${baseUrl}/api/v1/root?proof=${proof.join(',')}`) - const resp = await rootRes.json() + const resp: { root: string } = await rootRes.json() return resp.root } @@ -111,19 +111,6 @@ const checkProofEquality = (remote: string[], local: string[]) => { } } -// health check - -const healthRes = await fetch(`${baseUrl}/health`, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'Accept-Encoding': 'gzip', - }, -}) - -const version = await healthRes.text() -console.log('api version', version) - // basic merkle tree const unhashedLeaves = [