From 07a7b4125864f3e01a53754eea1d9df7495f28b6 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 11 Apr 2019 18:39:39 +0200 Subject: [PATCH 1/3] adapt to new faucet server response format, pass through success message --- client/src/routes/Faucet.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/routes/Faucet.tsx b/client/src/routes/Faucet.tsx index 05fa6c8..8452cc0 100644 --- a/client/src/routes/Faucet.tsx +++ b/client/src/routes/Faucet.tsx @@ -25,18 +25,17 @@ export default class Faucet extends PureComponent<{}, FaucetState> { try { const response = await requestFromFaucet() - if (response.error) { + if (!response.success) { this.setState({ isLoading: false, - error: response.error + error: response.message }) - return } this.setState({ isLoading: false, - success: 'Successfully added ETH to your account.' + success: response.message }) } catch (error) { this.setState({ isLoading: false, error }) From bdf7670b3d891066f5221fb3780abf312725757d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 11 Apr 2019 19:41:42 +0200 Subject: [PATCH 2/3] add faucet version to library.json --- library.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library.json b/library.json index 41cfa19..f360e86 100644 --- a/library.json +++ b/library.json @@ -20,6 +20,10 @@ { "name": "squid-js", "version": "~0.5.3" + }, + { + "name": "faucet", + "version": "~0.2.0" } ] } From 4a6053ec825f1839ea12db2502166872ad82e553 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 11 Apr 2019 20:01:15 +0200 Subject: [PATCH 3/3] output transaction hash --- client/src/routes/Faucet.module.scss | 13 +++++++++++++ client/src/routes/Faucet.tsx | 17 ++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/client/src/routes/Faucet.module.scss b/client/src/routes/Faucet.module.scss index f5733fb..d407fdb 100644 --- a/client/src/routes/Faucet.module.scss +++ b/client/src/routes/Faucet.module.scss @@ -12,6 +12,19 @@ .success { color: $green; + + p { + margin-top: $spacer / 2; + } + + strong { + display: block; + } + + code { + overflow-wrap: break-word; + display: inline; + } } .error { diff --git a/client/src/routes/Faucet.tsx b/client/src/routes/Faucet.tsx index 8452cc0..275350c 100644 --- a/client/src/routes/Faucet.tsx +++ b/client/src/routes/Faucet.tsx @@ -10,13 +10,15 @@ interface FaucetState { isLoading: boolean success?: string error?: string + trxHash?: string } export default class Faucet extends PureComponent<{}, FaucetState> { public state = { isLoading: false, success: undefined, - error: undefined + error: undefined, + trxHash: undefined } private getTokens = async (requestFromFaucet: () => any) => { @@ -33,9 +35,12 @@ export default class Faucet extends PureComponent<{}, FaucetState> { return } + const { trxHash } = response + this.setState({ isLoading: false, - success: response.message + success: response.message, + trxHash }) } catch (error) { this.setState({ isLoading: false, error }) @@ -51,7 +56,13 @@ export default class Faucet extends PureComponent<{}, FaucetState> { } private Success = () => ( -
{this.state.success}
+
+ {this.state.success} +

+ Your Transaction Hash + {this.state.trxHash} +

+
) private Error = () => (