mirror of
https://github.com/mempool/mempool.git
synced 2025-04-07 19:38:32 +02:00
[faucet] handle new faucet status codes
This commit is contained in:
parent
83f3d07538
commit
38971d33a6
@ -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();
|
||||
},
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user