diff --git a/frontend/src/app/components/faucet/faucet.component.ts b/frontend/src/app/components/faucet/faucet.component.ts index 729e9015c..0dfdb0780 100644 --- a/frontend/src/app/components/faucet/faucet.component.ts +++ b/frontend/src/app/components/faucet/faucet.component.ts @@ -25,6 +25,7 @@ export class FaucetComponent implements OnInit, OnDestroy { min: number; // minimum amount to request at once (in sats) max: number; // maximum amount to request at once address?: string; // faucet address + code: 'ok' | 'faucet_not_available' | 'faucet_maximum_reached' | 'faucet_too_soon'; } | null = null; faucetForm: FormGroup; @@ -78,6 +79,10 @@ export class FaucetComponent implements OnInit, OnDestroy { 'satoshis': [this.status.min, [Validators.required, Validators.min(this.status.min), Validators.max(this.status.max)]] }); + if (this.status.code !== 'ok') { + this.error = this.status.code; + } + this.loading = false; this.cd.markForCheck(); }, diff --git a/frontend/src/app/services/services-api.service.ts b/frontend/src/app/services/services-api.service.ts index f57aa8524..bdc6d18c2 100644 --- a/frontend/src/app/services/services-api.service.ts +++ b/frontend/src/app/services/services-api.service.ts @@ -161,7 +161,7 @@ export class ServicesApiServices { } getFaucetStatus$() { - return this.httpClient.get<{ address?: string, min: number, max: number }>(`${SERVICES_API_PREFIX}/testnet4/faucet/status`, { responseType: 'json' }); + return this.httpClient.get<{ address?: string, min: number, max: number, code: 'ok' | 'faucet_not_available' | 'faucet_maximum_reached' | 'faucet_too_soon'}>(`${SERVICES_API_PREFIX}/testnet4/faucet/status`, { responseType: 'json' }); } requestTestnet4Coins$(address: string, sats: number) {