|
|
|
|
@@ -25,9 +25,6 @@ export interface IUser {
|
|
|
|
|
ogRank: number | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Todo - move to config.json
|
|
|
|
|
const SERVICES_API_PREFIX = `/api/v1/services`;
|
|
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
|
providedIn: 'root'
|
|
|
|
|
})
|
|
|
|
|
@@ -98,7 +95,7 @@ export class ServicesApiServices {
|
|
|
|
|
return of(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this.httpClient.get<any>(`${SERVICES_API_PREFIX}/account`);
|
|
|
|
|
return this.httpClient.get<any>(`${this.stateService.env.SERVICES_API}/account`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getUserMenuGroups$(): Observable<MenuGroup[]> {
|
|
|
|
|
@@ -107,7 +104,7 @@ export class ServicesApiServices {
|
|
|
|
|
return of(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this.httpClient.get<MenuGroup[]>(`${SERVICES_API_PREFIX}/account/menu`);
|
|
|
|
|
return this.httpClient.get<MenuGroup[]>(`${this.stateService.env.SERVICES_API}/account/menu`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logout$(): Observable<any> {
|
|
|
|
|
@@ -117,59 +114,59 @@ export class ServicesApiServices {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
localStorage.removeItem('auth');
|
|
|
|
|
return this.httpClient.post(`${SERVICES_API_PREFIX}/auth/logout`, {});
|
|
|
|
|
return this.httpClient.post(`${this.stateService.env.SERVICES_API}/auth/logout`, {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getJWT$() {
|
|
|
|
|
return this.httpClient.get<any>(`${SERVICES_API_PREFIX}/auth/getJWT`);
|
|
|
|
|
return this.httpClient.get<any>(`${this.stateService.env.SERVICES_API}/auth/getJWT`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getServicesBackendInfo$(): Observable<IBackendInfo> {
|
|
|
|
|
return this.httpClient.get<IBackendInfo>(`${SERVICES_API_PREFIX}/version`);
|
|
|
|
|
return this.httpClient.get<IBackendInfo>(`${this.stateService.env.SERVICES_API}/version`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
estimate$(txInput: string) {
|
|
|
|
|
return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' });
|
|
|
|
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
accelerate$(txInput: string, userBid: number, accelerationUUID: string) {
|
|
|
|
|
return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/accelerate`, { txInput: txInput, userBid: userBid, accelerationUUID: accelerationUUID });
|
|
|
|
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate`, { txInput: txInput, userBid: userBid, accelerationUUID: accelerationUUID });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
accelerateWithCashApp$(txInput: string, token: string, cashtag: string, referenceId: string, accelerationUUID: string) {
|
|
|
|
|
return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/accelerate/cashapp`, { txInput: txInput, token: token, cashtag: cashtag, referenceId: referenceId, accelerationUUID: accelerationUUID });
|
|
|
|
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate/cashapp`, { txInput: txInput, token: token, cashtag: cashtag, referenceId: referenceId, accelerationUUID: accelerationUUID });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAccelerations$(): Observable<Acceleration[]> {
|
|
|
|
|
return this.httpClient.get<Acceleration[]>(`${SERVICES_API_PREFIX}/accelerator/accelerations`);
|
|
|
|
|
return this.httpClient.get<Acceleration[]>(`${this.stateService.env.SERVICES_API}/accelerator/accelerations`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAggregatedAccelerationHistory$(params: AccelerationHistoryParams): Observable<any> {
|
|
|
|
|
return this.httpClient.get<any>(`${SERVICES_API_PREFIX}/accelerator/accelerations/history/aggregated`, { params: { ...params }, observe: 'response' });
|
|
|
|
|
return this.httpClient.get<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerations/history/aggregated`, { params: { ...params }, observe: 'response' });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAccelerationHistory$(params: AccelerationHistoryParams): Observable<Acceleration[]> {
|
|
|
|
|
return this.httpClient.get<Acceleration[]>(`${SERVICES_API_PREFIX}/accelerator/accelerations/history`, { params: { ...params } });
|
|
|
|
|
return this.httpClient.get<Acceleration[]>(`${this.stateService.env.SERVICES_API}/accelerator/accelerations/history`, { params: { ...params } });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAccelerationHistoryObserveResponse$(params: AccelerationHistoryParams): Observable<any> {
|
|
|
|
|
return this.httpClient.get<any>(`${SERVICES_API_PREFIX}/accelerator/accelerations/history`, { params: { ...params }, observe: 'response'});
|
|
|
|
|
return this.httpClient.get<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerations/history`, { params: { ...params }, observe: 'response'});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAccelerationStats$(params: AccelerationHistoryParams): Observable<AccelerationStats> {
|
|
|
|
|
return this.httpClient.get<AccelerationStats>(`${SERVICES_API_PREFIX}/accelerator/accelerations/stats`, { params: { ...params } });
|
|
|
|
|
return this.httpClient.get<AccelerationStats>(`${this.stateService.env.SERVICES_API}/accelerator/accelerations/stats`, { params: { ...params } });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setupSquare$(): Observable<{squareAppId: string, squareLocationId: string}> {
|
|
|
|
|
return this.httpClient.get<{squareAppId: string, squareLocationId: string}>(`${SERVICES_API_PREFIX}/square/setup`);
|
|
|
|
|
return this.httpClient.get<{squareAppId: string, squareLocationId: string}>(`${this.stateService.env.SERVICES_API}/square/setup`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getFaucetStatus$() {
|
|
|
|
|
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' });
|
|
|
|
|
return this.httpClient.get<{ address?: string, min: number, max: number, code: 'ok' | 'faucet_not_available' | 'faucet_maximum_reached' | 'faucet_too_soon'}>(`${this.stateService.env.SERVICES_API}/testnet4/faucet/status`, { responseType: 'json' });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
requestTestnet4Coins$(address: string, sats: number) {
|
|
|
|
|
return this.httpClient.get<{txid: string}>(`${SERVICES_API_PREFIX}/testnet4/faucet/request?address=${address}&sats=${sats}`, { responseType: 'json' });
|
|
|
|
|
return this.httpClient.get<{txid: string}>(`${this.stateService.env.SERVICES_API}/testnet4/faucet/request?address=${address}&sats=${sats}`, { responseType: 'json' });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generateBTCPayAcceleratorInvoice$(txid: string, sats: number): Observable<any> {
|
|
|
|
|
@@ -177,14 +174,14 @@ export class ServicesApiServices {
|
|
|
|
|
product: txid,
|
|
|
|
|
amount: sats,
|
|
|
|
|
};
|
|
|
|
|
return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/payments/bitcoin`, params);
|
|
|
|
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/payments/bitcoin`, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
retreiveInvoice$(invoiceId: string): Observable<any[]> {
|
|
|
|
|
return this.httpClient.get<any[]>(`${SERVICES_API_PREFIX}/payments/bitcoin/invoice?id=${invoiceId}`);
|
|
|
|
|
return this.httpClient.get<any[]>(`${this.stateService.env.SERVICES_API}/payments/bitcoin/invoice?id=${invoiceId}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPaymentStatus$(orderId: string): Observable<any[]> {
|
|
|
|
|
return this.httpClient.get<any[]>(`${SERVICES_API_PREFIX}/payments/bitcoin/check?order_id=${orderId}`);
|
|
|
|
|
return this.httpClient.get<any[]>(`${this.stateService.env.SERVICES_API}/payments/bitcoin/check?order_id=${orderId}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|