From f1fb40733438304d080b34671bbffc9f26fd93e6 Mon Sep 17 00:00:00 2001 From: clearloop Date: Tue, 15 Sep 2020 18:15:43 +0800 Subject: [PATCH] fix(proxy): reset the proxy handler of axios (#83) --- package.json | 2 +- src/api/shadow.ts | 11 ++++++++++- src/index.ts | 2 +- src/util/static/types.json | 10 +++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2059049..ebf05ba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "@darwinia/dj", - "version": "0.2.3-beta.2", + "version": "0.2.4-alpha.2", "description": "Darwinia bridge relayer tool", "homepage": "https://github.com/darwinia-network/dj", "repository": { diff --git a/src/api/shadow.ts b/src/api/shadow.ts index d3f8113..6a7f166 100644 --- a/src/api/shadow.ts +++ b/src/api/shadow.ts @@ -7,6 +7,12 @@ import { IEthereumHeaderThingWithProof, } from "../types"; +/// Disable Proxy +process.env.HTTP_PROXY = "" +process.env.HTTPS_PROXY = "" +process.env.http_proxy = "" +process.env.https_proxy = "" + /** * Shadow APIs * @@ -16,7 +22,7 @@ import { export class ShadowAPI { constructor(api: string) { axios.defaults.baseURL = api; - axios.defaults.proxy = false; + // axios.defaults.proxy = false; } /** @@ -62,6 +68,9 @@ export class ShadowAPI { last_leaf: number, ): Promise { log.event(`Fetching proposal of ${target}`); + if (member === undefined) { + member = 0; + } const r: any = await axios.post("/eth/proposal", { member, target, diff --git a/src/index.ts b/src/index.ts index 7d8b008..4fbfaba 100755 --- a/src/index.ts +++ b/src/index.ts @@ -40,7 +40,7 @@ function check(arg: string): boolean { /// Run and exit async function cmdOnce(): Promise { if (check("--version")) { - console.log(whereisPj()); + console.log(whereisPj().version); return true; } else if (check("-h") || check("--help")) { console.log("dj: illegal option -- -"); diff --git a/src/util/static/types.json b/src/util/static/types.json index 1e675a2..d4d175d 100644 --- a/src/util/static/types.json +++ b/src/util/static/types.json @@ -185,7 +185,11 @@ "header_hash": "H256" }, "EthereumReceiptProofThing": "(EthereumHeader, EthereumReceiptProof, MMRProof)", - "MMRProof": "Vec", + "MMRProof": { + "member_leaf_index": "u64", + "last_leaf_index": "u64", + "proof": "Vec" + }, "__[pallet.claims]__": {}, "OtherSignature": { "_enum": { @@ -226,5 +230,9 @@ }, "StakingRuntimeDispatchInfo": { "power": "Power" + }, + "ConfirmedEthereumHeaderInfo": { + "header": "EthereumHeader", + "mmr_root": "H256" } } \ No newline at end of file