Fetch faucet address from services backend

This commit is contained in:
Mononaut 2024-05-16 18:36:33 +00:00
parent bbf8aed38f
commit f8144bd9a0
No known key found for this signature in database
GPG key ID: A3F058E41374C04E
4 changed files with 4 additions and 6 deletions

View file

@ -84,8 +84,8 @@
} }
} }
<br> <br>
<div> <div *ngIf="status?.address">
If you no longer need your testnet4 coins, please consider sending them back to <a [routerLink]="['/address/' | relativeUrl, recycleAddress]">{{ recycleAddress }}</a> to replenish the faucet. If you no longer need your testnet4 coins, please consider sending them back to <a [routerLink]="['/address/' | relativeUrl, status.address]">{{ status.address }}</a> to replenish the faucet.
</div> </div>
</div> </div>
</div> </div>

View file

@ -18,6 +18,7 @@ export class FaucetComponent implements OnInit, OnDestroy {
user: any; user: any;
loading: boolean = true; loading: boolean = true;
status: { status: {
address?: string,
access: boolean access: boolean
min: number, min: number,
user_max: number, user_max: number,
@ -26,7 +27,6 @@ export class FaucetComponent implements OnInit, OnDestroy {
error = ''; error = '';
faucetForm: FormGroup; faucetForm: FormGroup;
txid = ''; txid = '';
recycleAddress = this.stateService.env.TESTNET4_FAUCET_ADDRESS || 'tb1q548z58kqvwyjqwy8vc2ntmg33d7s2wyfv7ukq4';
mempoolPositionSubscription: Subscription; mempoolPositionSubscription: Subscription;
confirmationSubscription: Subscription; confirmationSubscription: Subscription;

View file

@ -161,7 +161,7 @@ export class ServicesApiServices {
} }
getFaucetStatus$() { getFaucetStatus$() {
return this.httpClient.get<{access: boolean, min: number, user_max: number, user_requests: number }>(`${SERVICES_API_PREFIX}/testnet4/faucet/status`, { responseType: 'json' }); return this.httpClient.get<{ address?: string, access: boolean, min: number, user_max: number, user_requests: number }>(`${SERVICES_API_PREFIX}/testnet4/faucet/status`, { responseType: 'json' });
} }
requestTestnet4Coins$(address: string, sats: number) { requestTestnet4Coins$(address: string, sats: number) {

View file

@ -72,7 +72,6 @@ export interface Env {
ADDITIONAL_CURRENCIES: boolean; ADDITIONAL_CURRENCIES: boolean;
GIT_COMMIT_HASH_MEMPOOL_SPACE?: string; GIT_COMMIT_HASH_MEMPOOL_SPACE?: string;
PACKAGE_JSON_VERSION_MEMPOOL_SPACE?: string; PACKAGE_JSON_VERSION_MEMPOOL_SPACE?: string;
TESTNET4_FAUCET_ADDRESS: string;
customize?: Customization; customize?: Customization;
} }
@ -105,7 +104,6 @@ const defaultEnv: Env = {
'ACCELERATOR': false, 'ACCELERATOR': false,
'PUBLIC_ACCELERATIONS': false, 'PUBLIC_ACCELERATIONS': false,
'ADDITIONAL_CURRENCIES': false, 'ADDITIONAL_CURRENCIES': false,
'TESTNET4_FAUCET_ADDRESS': '',
}; };
@Injectable({ @Injectable({