2023-08-26 09:52:55 +02:00
|
|
|
import { Component, Input, OnInit } from "@angular/core";
|
|
|
|
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
|
|
|
|
|
|
|
|
const MempoolErrors = {
|
2024-05-18 18:56:02 +02:00
|
|
|
'bad_request': `Your request was not valid. Please try again.`,
|
2023-11-28 17:13:52 +09:00
|
|
|
'internal_server_error': `Something went wrong, please try again later`,
|
2023-08-26 09:52:55 +02:00
|
|
|
'acceleration_duplicated': `This transaction has already been accelerated.`,
|
|
|
|
'acceleration_outbid': `Your fee delta is too low.`,
|
|
|
|
'cannot_accelerate_tx': `Cannot accelerate this transaction.`,
|
|
|
|
'cannot_decode_raw_tx': `Cannot decode this raw transaction.`,
|
|
|
|
'cannot_fetch_raw_tx': `Cannot find this transaction.`,
|
|
|
|
'high_sigop_tx': `This transaction cannot be accelerated.`,
|
|
|
|
'invalid_acceleration_request': `This acceleration request is not valid.`,
|
|
|
|
'invalid_tx_dependencies': `This transaction dependencies are not valid.`,
|
|
|
|
'mempool_rejected_raw_tx': `Our mempool rejected this transaction`,
|
|
|
|
'no_mining_pool_available': `No mining pool available at the moment`,
|
2023-11-19 17:16:05 +09:00
|
|
|
'not_available': `You current subscription does not allow you to access this feature.`,
|
2024-04-02 11:35:03 +08:00
|
|
|
'not_enough_balance': `Your balance is too low. Please <a style="color:#105fb0" href="/services/accelerator/overview">top up your account</a>.`,
|
2023-08-26 09:52:55 +02:00
|
|
|
'not_verified': `You must verify your account to use this feature.`,
|
|
|
|
'recommended_fees_not_available': `Recommended fees are not available right now.`,
|
|
|
|
'too_many_relatives': `This transaction has too many relatives.`,
|
|
|
|
'txid_not_in_mempool': `This transaction is not in the mempool.`,
|
|
|
|
'waitlisted': `You are currently on the wait list. You will get notified once you are granted access.`,
|
|
|
|
'not_whitelisted_by_any_pool': `You are not whitelisted by any mining pool`,
|
2024-04-09 14:33:18 +09:00
|
|
|
'unauthorized': `You are not authorized to do this`,
|
2024-05-17 20:32:43 +02:00
|
|
|
'faucet_too_soon': `You cannot request any more coins right now. Try again later.`,
|
|
|
|
'faucet_not_available': `The faucet is not available right now. Try again later.`,
|
|
|
|
'faucet_maximum_reached': `You are not allowed to request more coins`,
|
2024-05-18 16:13:58 +02:00
|
|
|
'faucet_address_not_allowed': `You cannot use this address`,
|
2024-05-18 18:56:02 +02:00
|
|
|
'faucet_below_minimum': `Requested amount is too small`,
|
|
|
|
'faucet_above_maximum': `Requested amount is too high`,
|
2024-06-27 18:49:37 +09:00
|
|
|
'payment_method_not_allowed': `You are not allowed to use this payment method`,
|
2024-07-01 18:30:40 +09:00
|
|
|
'payment_method_not_allowed_out_of_bound': `You are not allowed to use this payment method with this amount`,
|
2023-08-26 09:52:55 +02:00
|
|
|
} as { [error: string]: string };
|
|
|
|
|
|
|
|
export function isMempoolError(error: string) {
|
|
|
|
return Object.keys(MempoolErrors).includes(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-mempool-error',
|
|
|
|
templateUrl: './mempool-error.component.html'
|
|
|
|
})
|
|
|
|
export class MempoolErrorComponent implements OnInit {
|
|
|
|
@Input() error: string;
|
2023-11-23 17:00:57 +09:00
|
|
|
@Input() alertClass = 'alert-danger';
|
2023-08-26 09:52:55 +02:00
|
|
|
errorContent: SafeHtml;
|
|
|
|
|
|
|
|
constructor(private sanitizer: DomSanitizer) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
if (Object.keys(MempoolErrors).includes(this.error)) {
|
|
|
|
this.errorContent = this.sanitizer.bypassSecurityTrustHtml(MempoolErrors[this.error]);
|
|
|
|
} else {
|
|
|
|
this.errorContent = this.error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|