mirror of
https://github.com/mempool/mempool.git
synced 2025-03-17 13:21:55 +01:00
Merge pull request #5664 from mempool/natsoni/decode-tx
Decode transaction from hex
This commit is contained in:
commit
2de5379be9
@ -55,6 +55,8 @@ class BitcoinRoutes {
|
|||||||
.post(config.MEMPOOL.API_URL_PREFIX + 'psbt/addparents', this.postPsbtCompletion)
|
.post(config.MEMPOOL.API_URL_PREFIX + 'psbt/addparents', this.postPsbtCompletion)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from', this.getBlocksByBulk.bind(this))
|
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from', this.getBlocksByBulk.bind(this))
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from/:to', this.getBlocksByBulk.bind(this))
|
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from/:to', this.getBlocksByBulk.bind(this))
|
||||||
|
.post(config.MEMPOOL.API_URL_PREFIX + 'prevouts', this.$getPrevouts)
|
||||||
|
.post(config.MEMPOOL.API_URL_PREFIX + 'cpfp', this.getCpfpLocalTxs)
|
||||||
// Temporarily add txs/package endpoint for all backends until esplora supports it
|
// Temporarily add txs/package endpoint for all backends until esplora supports it
|
||||||
.post(config.MEMPOOL.API_URL_PREFIX + 'txs/package', this.$submitPackage)
|
.post(config.MEMPOOL.API_URL_PREFIX + 'txs/package', this.$submitPackage)
|
||||||
// Internal routes
|
// Internal routes
|
||||||
@ -981,6 +983,92 @@ class BitcoinRoutes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async $getPrevouts(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const outpoints = req.body;
|
||||||
|
if (!Array.isArray(outpoints) || outpoints.some((item) => !/^[a-fA-F0-9]{64}$/.test(item.txid) || typeof item.vout !== 'number')) {
|
||||||
|
handleError(req, res, 400, 'Invalid outpoints format');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outpoints.length > 100) {
|
||||||
|
handleError(req, res, 400, 'Too many outpoints requested');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = Array(outpoints.length).fill(null);
|
||||||
|
const memPool = mempool.getMempool();
|
||||||
|
|
||||||
|
for (let i = 0; i < outpoints.length; i++) {
|
||||||
|
const outpoint = outpoints[i];
|
||||||
|
let prevout: IEsploraApi.Vout | null = null;
|
||||||
|
let unconfirmed: boolean | null = null;
|
||||||
|
|
||||||
|
const mempoolTx = memPool[outpoint.txid];
|
||||||
|
if (mempoolTx) {
|
||||||
|
if (outpoint.vout < mempoolTx.vout.length) {
|
||||||
|
prevout = mempoolTx.vout[outpoint.vout];
|
||||||
|
unconfirmed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
const rawPrevout = await bitcoinClient.getTxOut(outpoint.txid, outpoint.vout, false);
|
||||||
|
if (rawPrevout) {
|
||||||
|
prevout = {
|
||||||
|
value: Math.round(rawPrevout.value * 100000000),
|
||||||
|
scriptpubkey: rawPrevout.scriptPubKey.hex,
|
||||||
|
scriptpubkey_asm: rawPrevout.scriptPubKey.asm ? transactionUtils.convertScriptSigAsm(rawPrevout.scriptPubKey.hex) : '',
|
||||||
|
scriptpubkey_type: transactionUtils.translateScriptPubKeyType(rawPrevout.scriptPubKey.type),
|
||||||
|
scriptpubkey_address: rawPrevout.scriptPubKey && rawPrevout.scriptPubKey.address ? rawPrevout.scriptPubKey.address : '',
|
||||||
|
};
|
||||||
|
unconfirmed = false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore bitcoin client errors, just leave prevout as null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevout) {
|
||||||
|
result[i] = { prevout, unconfirmed };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res.json(result);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
handleError(req, res, 500, 'Failed to get prevouts');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getCpfpLocalTxs(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const transactions = req.body;
|
||||||
|
|
||||||
|
if (!Array.isArray(transactions) || transactions.some(tx =>
|
||||||
|
!tx || typeof tx !== 'object' ||
|
||||||
|
!/^[a-fA-F0-9]{64}$/.test(tx.txid) ||
|
||||||
|
typeof tx.weight !== 'number' ||
|
||||||
|
typeof tx.sigops !== 'number' ||
|
||||||
|
typeof tx.fee !== 'number' ||
|
||||||
|
!Array.isArray(tx.vin) ||
|
||||||
|
!Array.isArray(tx.vout)
|
||||||
|
)) {
|
||||||
|
handleError(req, res, 400, 'Invalid transactions format');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transactions.length > 1) {
|
||||||
|
handleError(req, res, 400, 'More than one transaction is not supported yet');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cpfpInfo = calculateMempoolTxCpfp(transactions[0], mempool.getMempool(), true);
|
||||||
|
res.json([cpfpInfo]);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
handleError(req, res, 500, 'Failed to calculate CPFP info');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new BitcoinRoutes();
|
export default new BitcoinRoutes();
|
||||||
|
@ -167,8 +167,10 @@ export function calculateGoodBlockCpfp(height: number, transactions: MempoolTran
|
|||||||
/**
|
/**
|
||||||
* Takes a mempool transaction and a copy of the current mempool, and calculates the CPFP data for
|
* Takes a mempool transaction and a copy of the current mempool, and calculates the CPFP data for
|
||||||
* that transaction (and all others in the same cluster)
|
* that transaction (and all others in the same cluster)
|
||||||
|
* If the passed transaction is not guaranteed to be in the mempool, set localTx to true: this will
|
||||||
|
* prevent updating the CPFP data of other transactions in the cluster
|
||||||
*/
|
*/
|
||||||
export function calculateMempoolTxCpfp(tx: MempoolTransactionExtended, mempool: { [txid: string]: MempoolTransactionExtended }): CpfpInfo {
|
export function calculateMempoolTxCpfp(tx: MempoolTransactionExtended, mempool: { [txid: string]: MempoolTransactionExtended }, localTx: boolean = false): CpfpInfo {
|
||||||
if (tx.cpfpUpdated && Date.now() < (tx.cpfpUpdated + CPFP_UPDATE_INTERVAL)) {
|
if (tx.cpfpUpdated && Date.now() < (tx.cpfpUpdated + CPFP_UPDATE_INTERVAL)) {
|
||||||
tx.cpfpDirty = false;
|
tx.cpfpDirty = false;
|
||||||
return {
|
return {
|
||||||
@ -198,17 +200,26 @@ export function calculateMempoolTxCpfp(tx: MempoolTransactionExtended, mempool:
|
|||||||
totalFee += tx.fees.base;
|
totalFee += tx.fees.base;
|
||||||
}
|
}
|
||||||
const effectiveFeePerVsize = totalFee / totalVsize;
|
const effectiveFeePerVsize = totalFee / totalVsize;
|
||||||
for (const tx of cluster.values()) {
|
|
||||||
mempool[tx.txid].effectiveFeePerVsize = effectiveFeePerVsize;
|
|
||||||
mempool[tx.txid].ancestors = Array.from(tx.ancestors.values()).map(tx => ({ txid: tx.txid, weight: tx.weight, fee: tx.fees.base }));
|
|
||||||
mempool[tx.txid].descendants = Array.from(cluster.values()).filter(entry => entry.txid !== tx.txid && !tx.ancestors.has(entry.txid)).map(tx => ({ txid: tx.txid, weight: tx.weight, fee: tx.fees.base }));
|
|
||||||
mempool[tx.txid].bestDescendant = null;
|
|
||||||
mempool[tx.txid].cpfpChecked = true;
|
|
||||||
mempool[tx.txid].cpfpDirty = true;
|
|
||||||
mempool[tx.txid].cpfpUpdated = Date.now();
|
|
||||||
}
|
|
||||||
|
|
||||||
tx = mempool[tx.txid];
|
if (localTx) {
|
||||||
|
tx.effectiveFeePerVsize = effectiveFeePerVsize;
|
||||||
|
tx.ancestors = Array.from(cluster.get(tx.txid)?.ancestors.values() || []).map(ancestor => ({ txid: ancestor.txid, weight: ancestor.weight, fee: ancestor.fees.base }));
|
||||||
|
tx.descendants = Array.from(cluster.values()).filter(entry => entry.txid !== tx.txid && !cluster.get(tx.txid)?.ancestors.has(entry.txid)).map(tx => ({ txid: tx.txid, weight: tx.weight, fee: tx.fees.base }));
|
||||||
|
tx.bestDescendant = null;
|
||||||
|
} else {
|
||||||
|
for (const tx of cluster.values()) {
|
||||||
|
mempool[tx.txid].effectiveFeePerVsize = effectiveFeePerVsize;
|
||||||
|
mempool[tx.txid].ancestors = Array.from(tx.ancestors.values()).map(tx => ({ txid: tx.txid, weight: tx.weight, fee: tx.fees.base }));
|
||||||
|
mempool[tx.txid].descendants = Array.from(cluster.values()).filter(entry => entry.txid !== tx.txid && !tx.ancestors.has(entry.txid)).map(tx => ({ txid: tx.txid, weight: tx.weight, fee: tx.fees.base }));
|
||||||
|
mempool[tx.txid].bestDescendant = null;
|
||||||
|
mempool[tx.txid].cpfpChecked = true;
|
||||||
|
mempool[tx.txid].cpfpDirty = true;
|
||||||
|
mempool[tx.txid].cpfpUpdated = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
tx = mempool[tx.txid];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ancestors: tx.ancestors || [],
|
ancestors: tx.ancestors || [],
|
||||||
|
@ -420,6 +420,29 @@ class TransactionUtils {
|
|||||||
|
|
||||||
return { prioritized, deprioritized };
|
return { prioritized, deprioritized };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copied from https://github.com/mempool/mempool/blob/14e49126c3ca8416a8d7ad134a95c5e090324d69/backend/src/api/bitcoin/bitcoin-api.ts#L324
|
||||||
|
public translateScriptPubKeyType(outputType: string): string {
|
||||||
|
const map = {
|
||||||
|
'pubkey': 'p2pk',
|
||||||
|
'pubkeyhash': 'p2pkh',
|
||||||
|
'scripthash': 'p2sh',
|
||||||
|
'witness_v0_keyhash': 'v0_p2wpkh',
|
||||||
|
'witness_v0_scripthash': 'v0_p2wsh',
|
||||||
|
'witness_v1_taproot': 'v1_p2tr',
|
||||||
|
'nonstandard': 'nonstandard',
|
||||||
|
'multisig': 'multisig',
|
||||||
|
'anchor': 'anchor',
|
||||||
|
'nulldata': 'op_return'
|
||||||
|
};
|
||||||
|
|
||||||
|
if (map[outputType]) {
|
||||||
|
return map[outputType];
|
||||||
|
} else {
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new TransactionUtils();
|
export default new TransactionUtils();
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
<br>
|
||||||
|
<div class="title">
|
||||||
|
<h2 class="text-left" i18n="transaction.related-transactions|CPFP List">Related Transactions</h2>
|
||||||
|
</div>
|
||||||
|
<div class="box cpfp-details">
|
||||||
|
<table class="table table-fixed table-borderless table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th i18n="transactions-list.vout.scriptpubkey-type">Type</th>
|
||||||
|
<th class="txids" i18n="dashboard.latest-transactions.txid">TXID</th>
|
||||||
|
<th *only-vsize class="d-none d-lg-table-cell" i18n="transaction.vsize|Transaction Virtual Size">Virtual size</th>
|
||||||
|
<th *only-weight class="d-none d-lg-table-cell" i18n="transaction.weight|Transaction Weight">Weight</th>
|
||||||
|
<th i18n="transaction.fee-rate|Transaction fee rate">Fee rate</th>
|
||||||
|
<th class="d-none d-lg-table-cell"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<ng-template [ngIf]="cpfpInfo?.descendants?.length">
|
||||||
|
<tr *ngFor="let cpfpTx of cpfpInfo.descendants">
|
||||||
|
<td><span class="badge badge-primary" i18n="transaction.descendant|Descendant">Descendant</span></td>
|
||||||
|
<td>
|
||||||
|
<app-truncate [text]="cpfpTx.txid" [link]="['/tx' | relativeUrl, cpfpTx.txid]"></app-truncate>
|
||||||
|
</td>
|
||||||
|
<td *only-vsize class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight / 4 | vbytes: 2"></td>
|
||||||
|
<td *only-weight class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight | wuBytes: 2"></td>
|
||||||
|
<td><app-fee-rate [fee]="cpfpTx.fee" [weight]="cpfpTx.weight"></app-fee-rate></td>
|
||||||
|
<td class="d-none d-lg-table-cell"><fa-icon *ngIf="roundToOneDecimal(cpfpTx) > roundToOneDecimal(tx)" class="arrow-green" [icon]="['fas', 'angle-double-up']" [fixedWidth]="true"></fa-icon></td>
|
||||||
|
</tr>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template [ngIf]="cpfpInfo?.bestDescendant">
|
||||||
|
<tr>
|
||||||
|
<td><span class="badge badge-success" i18n="transaction.descendant|Descendant">Descendant</span></td>
|
||||||
|
<td class="txids">
|
||||||
|
<app-truncate [text]="cpfpInfo.bestDescendant.txid" [link]="['/tx' | relativeUrl, cpfpInfo.bestDescendant.txid]"></app-truncate>
|
||||||
|
</td>
|
||||||
|
<td *only-vsize class="d-none d-lg-table-cell" [innerHTML]="cpfpInfo.bestDescendant.weight / 4 | vbytes: 2"></td>
|
||||||
|
<td *only-weight class="d-none d-lg-table-cell" [innerHTML]="cpfpInfo.bestDescendant.weight | wuBytes: 2"></td>
|
||||||
|
<td><app-fee-rate [fee]="cpfpInfo.bestDescendant.fee" [weight]="cpfpInfo.bestDescendant.weight"></app-fee-rate></td>
|
||||||
|
<td class="d-none d-lg-table-cell"><fa-icon class="arrow-green" [icon]="['fas', 'angle-double-up']" [fixedWidth]="true"></fa-icon></td>
|
||||||
|
</tr>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template [ngIf]="cpfpInfo?.ancestors?.length">
|
||||||
|
<tr *ngFor="let cpfpTx of cpfpInfo.ancestors">
|
||||||
|
<td><span class="badge badge-primary" i18n="transaction.ancestor|Transaction Ancestor">Ancestor</span></td>
|
||||||
|
<td class="txids">
|
||||||
|
<app-truncate [text]="cpfpTx.txid" [link]="['/tx' | relativeUrl, cpfpTx.txid]"></app-truncate>
|
||||||
|
</td>
|
||||||
|
<td *only-vsize class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight / 4 | vbytes: 2"></td>
|
||||||
|
<td *only-weight class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight | wuBytes: 2"></td>
|
||||||
|
<td><app-fee-rate [fee]="cpfpTx.fee" [weight]="cpfpTx.weight"></app-fee-rate></td>
|
||||||
|
<td class="d-none d-lg-table-cell"><fa-icon *ngIf="roundToOneDecimal(cpfpTx) < roundToOneDecimal(tx)" class="arrow-red" [icon]="['fas', 'angle-double-down']" [fixedWidth]="true"></fa-icon></td>
|
||||||
|
</tr>
|
||||||
|
</ng-template>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -0,0 +1,32 @@
|
|||||||
|
.title {
|
||||||
|
h2 {
|
||||||
|
line-height: 1;
|
||||||
|
margin: 0;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cpfp-details {
|
||||||
|
.txids {
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
.txids {
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow-green {
|
||||||
|
color: var(--success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow-red {
|
||||||
|
color: var(--red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
position: relative;
|
||||||
|
top: -1px;
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
import { Component, OnInit, Input, ChangeDetectionStrategy } from '@angular/core';
|
||||||
|
import { CpfpInfo } from '@interfaces/node-api.interface';
|
||||||
|
import { Transaction } from '@interfaces/electrs.interface';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-cpfp-info',
|
||||||
|
templateUrl: './cpfp-info.component.html',
|
||||||
|
styleUrls: ['./cpfp-info.component.scss'],
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
|
})
|
||||||
|
export class CpfpInfoComponent implements OnInit {
|
||||||
|
@Input() cpfpInfo: CpfpInfo;
|
||||||
|
@Input() tx: Transaction;
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
ngOnInit(): void {}
|
||||||
|
|
||||||
|
roundToOneDecimal(cpfpTx: any): number {
|
||||||
|
return +(cpfpTx.fee / (cpfpTx.weight / 4)).toFixed(1);
|
||||||
|
}
|
||||||
|
}
|
@ -153,7 +153,7 @@
|
|||||||
|
|
||||||
<ng-template #etaRow>
|
<ng-template #etaRow>
|
||||||
@if (!isLoadingTx) {
|
@if (!isLoadingTx) {
|
||||||
@if (!replaced && !isCached) {
|
@if (!replaced && !isCached && !unbroadcasted) {
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td-width align-items-center align-middle" i18n="transaction.eta|Transaction ETA">ETA</td>
|
<td class="td-width align-items-center align-middle" i18n="transaction.eta|Transaction ETA">ETA</td>
|
||||||
<td>
|
<td>
|
||||||
@ -184,7 +184,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
} @else {
|
} @else if (!unbroadcasted){
|
||||||
<ng-container *ngTemplateOutlet="skeletonDetailsRow"></ng-container>
|
<ng-container *ngTemplateOutlet="skeletonDetailsRow"></ng-container>
|
||||||
}
|
}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
@ -213,11 +213,11 @@
|
|||||||
@if (!isLoadingTx) {
|
@if (!isLoadingTx) {
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td-width" i18n="transaction.fee|Transaction fee">Fee</td>
|
<td class="td-width" i18n="transaction.fee|Transaction fee">Fee</td>
|
||||||
<td class="text-wrap">{{ tx.fee | number }} <span class="symbol" i18n="shared.sats">sats</span>
|
<td class="text-wrap">{{ (tx.fee | number) ?? '-' }} <span class="symbol" i18n="shared.sats">sats</span>
|
||||||
@if (isAcceleration && accelerationInfo?.bidBoost ?? tx.feeDelta > 0) {
|
@if (isAcceleration && accelerationInfo?.bidBoost ?? tx.feeDelta > 0) {
|
||||||
<span class="oobFees" i18n-ngbTooltip="Acceleration Fees" ngbTooltip="Acceleration fees paid out-of-band"> +{{ accelerationInfo?.bidBoost ?? tx.feeDelta | number }} </span><span class="symbol" i18n="shared.sats">sats</span>
|
<span class="oobFees" i18n-ngbTooltip="Acceleration Fees" ngbTooltip="Acceleration fees paid out-of-band"> +{{ accelerationInfo?.bidBoost ?? tx.feeDelta | number }} </span><span class="symbol" i18n="shared.sats">sats</span>
|
||||||
}
|
}
|
||||||
<span class="fiat"><app-fiat [blockConversion]="tx.price" [value]="tx.fee + (isAcceleration ? ((accelerationInfo?.bidBoost ?? tx.feeDelta) || 0) : 0)"></app-fiat></span>
|
<span class="fiat"><app-fiat *ngIf="tx.fee >= 0" [blockConversion]="tx.price" [value]="tx.fee + (isAcceleration ? ((accelerationInfo?.bidBoost ?? tx.feeDelta) || 0) : 0)"></app-fiat></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
} @else {
|
} @else {
|
||||||
|
@ -38,6 +38,7 @@ export class TransactionDetailsComponent implements OnInit {
|
|||||||
@Input() replaced: boolean;
|
@Input() replaced: boolean;
|
||||||
@Input() isCached: boolean;
|
@Input() isCached: boolean;
|
||||||
@Input() ETA$: Observable<ETA>;
|
@Input() ETA$: Observable<ETA>;
|
||||||
|
@Input() unbroadcasted: boolean;
|
||||||
|
|
||||||
@Output() accelerateClicked = new EventEmitter<boolean>();
|
@Output() accelerateClicked = new EventEmitter<boolean>();
|
||||||
@Output() toggleCpfp$ = new EventEmitter<void>();
|
@Output() toggleCpfp$ = new EventEmitter<void>();
|
||||||
|
@ -0,0 +1,212 @@
|
|||||||
|
<div class="container-xl">
|
||||||
|
|
||||||
|
@if (!transaction) {
|
||||||
|
|
||||||
|
<h1 style="margin-top: 19px;" i18n="shared.preview-transaction|Preview Transaction">Preview Transaction</h1>
|
||||||
|
|
||||||
|
<form [formGroup]="pushTxForm" (submit)="decodeTransaction()" novalidate>
|
||||||
|
<div class="mb-3">
|
||||||
|
<textarea formControlName="txRaw" class="form-control" rows="5" i18n-placeholder="transaction.hex-and-psbt" placeholder="Transaction hex or base64 encoded PSBT"></textarea>
|
||||||
|
</div>
|
||||||
|
<button [disabled]="isLoading" type="submit" class="btn btn-primary mr-2" i18n="shared.preview|Preview">Preview</button>
|
||||||
|
<input type="checkbox" [checked]="!offlineMode" id="offline-mode" (change)="onOfflineModeChange($event)">
|
||||||
|
<label class="label" for="offline-mode">
|
||||||
|
<span i18n="transaction.fetch-prevout-data">Fetch missing prevouts</span>
|
||||||
|
</label>
|
||||||
|
<p *ngIf="error" class="red-color d-inline">Error decoding transaction, reason: {{ error }}</p>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (transaction && !error && !isLoading) {
|
||||||
|
<div class="title-block">
|
||||||
|
<h1 i18n="shared.preview-transaction|Preview Transaction">Preview Transaction</h1>
|
||||||
|
|
||||||
|
<span class="tx-link">
|
||||||
|
<span class="txid">
|
||||||
|
<app-truncate [text]="transaction.txid" [lastChars]="12" [link]="['/tx/' | relativeUrl, transaction.txid]" [disabled]="!successBroadcast">
|
||||||
|
<app-clipboard [text]="transaction.txid"></app-clipboard>
|
||||||
|
</app-truncate>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="container-buttons">
|
||||||
|
<button *ngIf="successBroadcast" type="button" class="btn btn-sm btn-success no-cursor" i18n="transaction.broadcasted|Broadcasted">Broadcasted</button>
|
||||||
|
<button class="btn btn-sm" style="margin-left: 10px; padding: 0;" (click)="resetForm()">✕</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="red-color d-inline">{{ errorBroadcast }}</p>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
<div *ngIf="!successBroadcast" class="alert alert-mempool" style="align-items: center;">
|
||||||
|
<span>
|
||||||
|
<fa-icon [icon]="['fas', 'info-circle']" [fixedWidth]="true"></fa-icon>
|
||||||
|
<ng-container i18n="transaction.local-tx|This transaction is stored locally in your browser.">
|
||||||
|
This transaction is stored locally in your browser. Broadcast it to add it to the mempool.
|
||||||
|
</ng-container>
|
||||||
|
</span>
|
||||||
|
<button [disabled]="isLoadingBroadcast" type="button" class="btn btn-sm btn-primary" i18n="transaction.broadcast|Broadcast" (click)="postTx()">Broadcast</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!hasPrevouts) {
|
||||||
|
<div class="alert alert-mempool">
|
||||||
|
@if (offlineMode) {
|
||||||
|
<span><strong>Missing prevouts are not loaded. Some fields like fee rate cannot be calculated.</strong></span>
|
||||||
|
} @else {
|
||||||
|
<span><strong>Error loading missing prevouts</strong>. {{ errorPrevouts ? 'Reason: ' + errorPrevouts : '' }}</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (errorCpfpInfo) {
|
||||||
|
<div class="alert alert-mempool">
|
||||||
|
<span><strong>Error loading CPFP data</strong>. Reason: {{ errorCpfpInfo }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<app-transaction-details
|
||||||
|
[unbroadcasted]="true"
|
||||||
|
[network]="stateService.network"
|
||||||
|
[tx]="transaction"
|
||||||
|
[isLoadingTx]="false"
|
||||||
|
[isMobile]="isMobile"
|
||||||
|
[isLoadingFirstSeen]="false"
|
||||||
|
[featuresEnabled]="true"
|
||||||
|
[filters]="filters"
|
||||||
|
[hasEffectiveFeeRate]="hasEffectiveFeeRate"
|
||||||
|
[cpfpInfo]="cpfpInfo"
|
||||||
|
[hasCpfp]="hasCpfp"
|
||||||
|
(toggleCpfp$)="this.showCpfpDetails = !this.showCpfpDetails"
|
||||||
|
></app-transaction-details>
|
||||||
|
|
||||||
|
<app-cpfp-info *ngIf="showCpfpDetails" [cpfpInfo]="cpfpInfo" [tx]="transaction"></app-cpfp-info>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<ng-container *ngIf="flowEnabled; else flowPlaceholder">
|
||||||
|
<div class="title float-left">
|
||||||
|
<h2 id="flow" i18n="transaction.flow|Transaction flow">Flow</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-outline-info flow-toggle btn-sm float-right" (click)="toggleGraph()" i18n="hide-diagram">Hide diagram</button>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<div class="graph-container" #graphContainer>
|
||||||
|
<tx-bowtie-graph
|
||||||
|
[tx]="transaction"
|
||||||
|
[cached]="true"
|
||||||
|
[width]="graphWidth"
|
||||||
|
[height]="graphHeight"
|
||||||
|
[lineLimit]="inOutLimit"
|
||||||
|
[maxStrands]="graphExpanded ? maxInOut : 24"
|
||||||
|
[network]="stateService.network"
|
||||||
|
[tooltip]="true"
|
||||||
|
[connectors]="true"
|
||||||
|
[inputIndex]="null" [outputIndex]="null"
|
||||||
|
>
|
||||||
|
</tx-bowtie-graph>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-wrapper" *ngIf="maxInOut > 24">
|
||||||
|
<button class="btn btn-sm btn-primary graph-toggle" (click)="expandGraph();" *ngIf="!graphExpanded; else collapseBtn"><span i18n="show-more">Show more</span></button>
|
||||||
|
<ng-template #collapseBtn>
|
||||||
|
<button class="btn btn-sm btn-primary graph-toggle" (click)="collapseGraph();"><span i18n="show-less">Show less</span></button>
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #flowPlaceholder>
|
||||||
|
<div class="box hidden">
|
||||||
|
<div class="graph-container" #graphContainer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<div class="subtitle-block">
|
||||||
|
<div class="title">
|
||||||
|
<h2 i18n="transaction.inputs-and-outputs|Transaction inputs and outputs">Inputs & Outputs</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title-buttons">
|
||||||
|
<button *ngIf="!flowEnabled" type="button" class="btn btn-outline-info flow-toggle btn-sm" (click)="toggleGraph()" i18n="show-diagram">Show diagram</button>
|
||||||
|
<button type="button" class="btn btn-outline-info btn-sm" (click)="txList.toggleDetails()" i18n="transaction.details|Transaction Details">Details</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<app-transactions-list #txList [transactions]="[transaction]" [transactionPage]="true" [txPreview]="true"></app-transactions-list>
|
||||||
|
|
||||||
|
<div class="title text-left">
|
||||||
|
<h2 i18n="transaction.details|Transaction Details">Details</h2>
|
||||||
|
</div>
|
||||||
|
<div class="box">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm">
|
||||||
|
<table class="table table-borderless table-striped">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td i18n="block.size">Size</td>
|
||||||
|
<td [innerHTML]="'‎' + (transaction.size | bytes: 2)"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td i18n="transaction.vsize|Transaction Virtual Size">Virtual size</td>
|
||||||
|
<td [innerHTML]="'‎' + (transaction.weight / 4 | vbytes: 2)"></td>
|
||||||
|
</tr>
|
||||||
|
<tr *ngIf="adjustedVsize">
|
||||||
|
<td><ng-container i18n="transaction.adjusted-vsize|Transaction Adjusted VSize">Adjusted vsize</ng-container>
|
||||||
|
<a class="info-link" [routerLink]="['/docs/faq/' | relativeUrl]" fragment="what-is-adjusted-vsize">
|
||||||
|
<fa-icon [icon]="['fas', 'info-circle']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td [innerHTML]="'‎' + (adjustedVsize | vbytes: 2)"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td i18n="block.weight">Weight</td>
|
||||||
|
<td [innerHTML]="'‎' + (transaction.weight | wuBytes: 2)"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm">
|
||||||
|
<table class="table table-borderless table-striped">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td i18n="transaction.version">Version</td>
|
||||||
|
<td [innerHTML]="'‎' + (transaction.version | number)"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td i18n="transaction.locktime">Locktime</td>
|
||||||
|
<td [innerHTML]="'‎' + (transaction.locktime | number)"></td>
|
||||||
|
</tr>
|
||||||
|
<tr *ngIf="transaction.sigops >= 0">
|
||||||
|
<td><ng-container i18n="transaction.sigops|Transaction Sigops">Sigops</ng-container>
|
||||||
|
<a class="info-link" [routerLink]="['/docs/faq/' | relativeUrl]" fragment="what-are-sigops">
|
||||||
|
<fa-icon [icon]="['fas', 'info-circle']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td [innerHTML]="'‎' + (transaction.sigops | number)"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td i18n="transaction.hex">Transaction hex</td>
|
||||||
|
<td><app-clipboard [text]="rawHexTransaction" [leftPadding]="false"></app-clipboard></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (isLoading) {
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="spinner-border text-light mt-2 mb-2"></div>
|
||||||
|
<h3 i18n="transaction.error.loading-prevouts">
|
||||||
|
Loading {{ isLoadingPrevouts ? 'transaction prevouts' : isLoadingCpfpInfo ? 'CPFP' : '' }}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
@ -0,0 +1,194 @@
|
|||||||
|
.label {
|
||||||
|
margin: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-buttons {
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-block {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: baseline;
|
||||||
|
@media (min-width: 650px) {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
margin: 0rem;
|
||||||
|
margin-right: 15px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tx-link {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: baseline;
|
||||||
|
width: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-top: 8px;
|
||||||
|
@media (min-width: 651px) {
|
||||||
|
flex-grow: 1;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-right: 1em;
|
||||||
|
top: 1px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
@media (max-width: 650px) {
|
||||||
|
width: 100%;
|
||||||
|
order: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.txid {
|
||||||
|
width: 200px;
|
||||||
|
min-width: 200px;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-xl {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
flex-direction: column;
|
||||||
|
@media (min-width: 850px) {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box.hidden {
|
||||||
|
visibility: hidden;
|
||||||
|
height: 0px;
|
||||||
|
padding-top: 0px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-container {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
background: var(--stat-box-bg);
|
||||||
|
padding: 10px 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
margin: 1.25em 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-toggle {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
tr td {
|
||||||
|
padding: 0.75rem 0.5rem;
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
padding: 0.75rem 0.75rem;
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
text-align: right;
|
||||||
|
@media (min-width: 850px) {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.wrap-cell {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.effective-fee-container {
|
||||||
|
display: block;
|
||||||
|
@media (min-width: 768px){
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
@media (max-width: 425px){
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.effective-fee-rating {
|
||||||
|
@media (max-width: 767px){
|
||||||
|
margin-right: 0px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
h2 {
|
||||||
|
line-height: 1;
|
||||||
|
margin: 0;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-outline-info {
|
||||||
|
margin-top: 5px;
|
||||||
|
@media (min-width: 768px){
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.flow-toggle {
|
||||||
|
margin-top: -5px;
|
||||||
|
margin-left: 10px;
|
||||||
|
@media (min-width: 768px){
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle-block {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-buttons {
|
||||||
|
flex-shrink: 1;
|
||||||
|
text-align: right;
|
||||||
|
.btn {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cpfp-details {
|
||||||
|
.txids {
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
.txids {
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-cursor {
|
||||||
|
cursor: default !important;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
@ -0,0 +1,313 @@
|
|||||||
|
import { Component, OnInit, HostListener, ViewChild, ElementRef, OnDestroy } from '@angular/core';
|
||||||
|
import { Transaction, Vout } from '@interfaces/electrs.interface';
|
||||||
|
import { StateService } from '../../services/state.service';
|
||||||
|
import { Filter, toFilters } from '../../shared/filters.utils';
|
||||||
|
import { decodeRawTransaction, getTransactionFlags, addInnerScriptsToVin, countSigops } from '../../shared/transaction.utils';
|
||||||
|
import { firstValueFrom, Subscription } from 'rxjs';
|
||||||
|
import { WebsocketService } from '../../services/websocket.service';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||||
|
import { ElectrsApiService } from '../../services/electrs-api.service';
|
||||||
|
import { SeoService } from '../../services/seo.service';
|
||||||
|
import { seoDescriptionNetwork } from '@app/shared/common.utils';
|
||||||
|
import { ApiService } from '../../services/api.service';
|
||||||
|
import { RelativeUrlPipe } from '@app/shared/pipes/relative-url/relative-url.pipe';
|
||||||
|
import { CpfpInfo } from '../../interfaces/node-api.interface';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-transaction-raw',
|
||||||
|
templateUrl: './transaction-raw.component.html',
|
||||||
|
styleUrls: ['./transaction-raw.component.scss'],
|
||||||
|
})
|
||||||
|
export class TransactionRawComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
pushTxForm: UntypedFormGroup;
|
||||||
|
rawHexTransaction: string;
|
||||||
|
isLoading: boolean;
|
||||||
|
isLoadingPrevouts: boolean;
|
||||||
|
isLoadingCpfpInfo: boolean;
|
||||||
|
offlineMode: boolean = false;
|
||||||
|
transaction: Transaction;
|
||||||
|
error: string;
|
||||||
|
errorPrevouts: string;
|
||||||
|
errorCpfpInfo: string;
|
||||||
|
hasPrevouts: boolean;
|
||||||
|
missingPrevouts: string[];
|
||||||
|
isLoadingBroadcast: boolean;
|
||||||
|
errorBroadcast: string;
|
||||||
|
successBroadcast: boolean;
|
||||||
|
|
||||||
|
isMobile: boolean;
|
||||||
|
@ViewChild('graphContainer')
|
||||||
|
graphContainer: ElementRef;
|
||||||
|
graphExpanded: boolean = false;
|
||||||
|
graphWidth: number = 1068;
|
||||||
|
graphHeight: number = 360;
|
||||||
|
inOutLimit: number = 150;
|
||||||
|
maxInOut: number = 0;
|
||||||
|
flowPrefSubscription: Subscription;
|
||||||
|
hideFlow: boolean = this.stateService.hideFlow.value;
|
||||||
|
flowEnabled: boolean;
|
||||||
|
adjustedVsize: number;
|
||||||
|
filters: Filter[] = [];
|
||||||
|
hasEffectiveFeeRate: boolean;
|
||||||
|
fetchCpfp: boolean;
|
||||||
|
cpfpInfo: CpfpInfo | null;
|
||||||
|
hasCpfp: boolean = false;
|
||||||
|
showCpfpDetails = false;
|
||||||
|
mempoolBlocksSubscription: Subscription;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public route: ActivatedRoute,
|
||||||
|
public router: Router,
|
||||||
|
public stateService: StateService,
|
||||||
|
public electrsApi: ElectrsApiService,
|
||||||
|
public websocketService: WebsocketService,
|
||||||
|
public formBuilder: UntypedFormBuilder,
|
||||||
|
public seoService: SeoService,
|
||||||
|
public apiService: ApiService,
|
||||||
|
public relativeUrlPipe: RelativeUrlPipe,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.seoService.setTitle($localize`:@@meta.title.preview-tx:Preview Transaction`);
|
||||||
|
this.seoService.setDescription($localize`:@@meta.description.preview-tx:Preview a transaction to the Bitcoin${seoDescriptionNetwork(this.stateService.network)} network using the transaction's raw hex data.`);
|
||||||
|
this.websocketService.want(['blocks', 'mempool-blocks']);
|
||||||
|
this.pushTxForm = this.formBuilder.group({
|
||||||
|
txRaw: ['', Validators.required],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async decodeTransaction(): Promise<void> {
|
||||||
|
this.resetState();
|
||||||
|
this.isLoading = true;
|
||||||
|
try {
|
||||||
|
const { tx, hex } = decodeRawTransaction(this.pushTxForm.get('txRaw').value, this.stateService.network);
|
||||||
|
await this.fetchPrevouts(tx);
|
||||||
|
await this.fetchCpfpInfo(tx);
|
||||||
|
this.processTransaction(tx, hex);
|
||||||
|
} catch (error) {
|
||||||
|
this.error = error.message;
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchPrevouts(transaction: Transaction): Promise<void> {
|
||||||
|
const prevoutsToFetch = transaction.vin.filter(input => !input.prevout).map((input) => ({ txid: input.txid, vout: input.vout }));
|
||||||
|
|
||||||
|
if (!prevoutsToFetch.length || transaction.vin[0].is_coinbase || this.offlineMode) {
|
||||||
|
this.hasPrevouts = !prevoutsToFetch.length || transaction.vin[0].is_coinbase;
|
||||||
|
this.fetchCpfp = this.hasPrevouts && !this.offlineMode;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
this.missingPrevouts = [];
|
||||||
|
this.isLoadingPrevouts = true;
|
||||||
|
|
||||||
|
const prevouts: { prevout: Vout, unconfirmed: boolean }[] = await firstValueFrom(this.apiService.getPrevouts$(prevoutsToFetch));
|
||||||
|
|
||||||
|
if (prevouts?.length !== prevoutsToFetch.length) {
|
||||||
|
throw new Error();
|
||||||
|
}
|
||||||
|
|
||||||
|
let fetchIndex = 0;
|
||||||
|
transaction.vin.forEach(input => {
|
||||||
|
if (!input.prevout) {
|
||||||
|
const fetched = prevouts[fetchIndex];
|
||||||
|
if (fetched) {
|
||||||
|
input.prevout = fetched.prevout;
|
||||||
|
} else {
|
||||||
|
this.missingPrevouts.push(`${input.txid}:${input.vout}`);
|
||||||
|
}
|
||||||
|
fetchIndex++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.missingPrevouts.length) {
|
||||||
|
throw new Error(`Some prevouts do not exist or are already spent (${this.missingPrevouts.length})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hasPrevouts = true;
|
||||||
|
this.isLoadingPrevouts = false;
|
||||||
|
this.fetchCpfp = prevouts.some(prevout => prevout?.unconfirmed);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
this.errorPrevouts = error?.error?.error || error?.message;
|
||||||
|
this.isLoadingPrevouts = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasPrevouts) {
|
||||||
|
transaction.fee = transaction.vin.some(input => input.is_coinbase)
|
||||||
|
? 0
|
||||||
|
: transaction.vin.reduce((fee, input) => {
|
||||||
|
return fee + (input.prevout?.value || 0);
|
||||||
|
}, 0) - transaction.vout.reduce((sum, output) => sum + output.value, 0);
|
||||||
|
transaction.feePerVsize = transaction.fee / (transaction.weight / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction.vin.forEach(addInnerScriptsToVin);
|
||||||
|
transaction.sigops = countSigops(transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchCpfpInfo(transaction: Transaction): Promise<void> {
|
||||||
|
// Fetch potential cpfp data if all prevouts were parsed successfully and at least one of them is unconfirmed
|
||||||
|
if (this.hasPrevouts && this.fetchCpfp) {
|
||||||
|
try {
|
||||||
|
this.isLoadingCpfpInfo = true;
|
||||||
|
const cpfpInfo: CpfpInfo[] = await firstValueFrom(this.apiService.getCpfpLocalTx$([{
|
||||||
|
txid: transaction.txid,
|
||||||
|
weight: transaction.weight,
|
||||||
|
sigops: transaction.sigops,
|
||||||
|
fee: transaction.fee,
|
||||||
|
vin: transaction.vin,
|
||||||
|
vout: transaction.vout
|
||||||
|
}]));
|
||||||
|
|
||||||
|
if (cpfpInfo?.[0]?.ancestors?.length) {
|
||||||
|
const { ancestors, effectiveFeePerVsize } = cpfpInfo[0];
|
||||||
|
transaction.effectiveFeePerVsize = effectiveFeePerVsize;
|
||||||
|
this.cpfpInfo = { ancestors, effectiveFeePerVsize };
|
||||||
|
this.hasCpfp = true;
|
||||||
|
this.hasEffectiveFeeRate = true;
|
||||||
|
}
|
||||||
|
this.isLoadingCpfpInfo = false;
|
||||||
|
} catch (error) {
|
||||||
|
this.errorCpfpInfo = error?.error?.error || error?.message;
|
||||||
|
this.isLoadingCpfpInfo = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processTransaction(tx: Transaction, hex: string): void {
|
||||||
|
this.transaction = tx;
|
||||||
|
this.rawHexTransaction = hex;
|
||||||
|
|
||||||
|
this.transaction.flags = getTransactionFlags(this.transaction, this.cpfpInfo, null, null, this.stateService.network);
|
||||||
|
this.filters = this.transaction.flags ? toFilters(this.transaction.flags).filter(f => f.txPage) : [];
|
||||||
|
if (this.transaction.sigops >= 0) {
|
||||||
|
this.adjustedVsize = Math.max(this.transaction.weight / 4, this.transaction.sigops * 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setupGraph();
|
||||||
|
this.setFlowEnabled();
|
||||||
|
this.flowPrefSubscription = this.stateService.hideFlow.subscribe((hide) => {
|
||||||
|
this.hideFlow = !!hide;
|
||||||
|
this.setFlowEnabled();
|
||||||
|
});
|
||||||
|
this.setGraphSize();
|
||||||
|
|
||||||
|
this.mempoolBlocksSubscription = this.stateService.mempoolBlocks$.subscribe(() => {
|
||||||
|
if (this.transaction) {
|
||||||
|
this.stateService.markBlock$.next({
|
||||||
|
txid: this.transaction.txid,
|
||||||
|
txFeePerVSize: this.transaction.effectiveFeePerVsize || this.transaction.feePerVsize,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async postTx(): Promise<string> {
|
||||||
|
this.isLoadingBroadcast = true;
|
||||||
|
this.errorBroadcast = null;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.apiService.postTransaction$(this.rawHexTransaction)
|
||||||
|
.subscribe((result) => {
|
||||||
|
this.isLoadingBroadcast = false;
|
||||||
|
this.successBroadcast = true;
|
||||||
|
this.transaction.txid = result;
|
||||||
|
resolve(result);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
if (typeof error.error === 'string') {
|
||||||
|
const matchText = error.error.replace(/\\/g, '').match('"message":"(.*?)"');
|
||||||
|
this.errorBroadcast = 'Failed to broadcast transaction, reason: ' + (matchText && matchText[1] || error.error);
|
||||||
|
} else if (error.message) {
|
||||||
|
this.errorBroadcast = 'Failed to broadcast transaction, reason: ' + error.message;
|
||||||
|
}
|
||||||
|
this.isLoadingBroadcast = false;
|
||||||
|
reject(this.error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
resetState() {
|
||||||
|
this.transaction = null;
|
||||||
|
this.rawHexTransaction = null;
|
||||||
|
this.error = null;
|
||||||
|
this.errorPrevouts = null;
|
||||||
|
this.errorBroadcast = null;
|
||||||
|
this.successBroadcast = false;
|
||||||
|
this.isLoading = false;
|
||||||
|
this.isLoadingPrevouts = false;
|
||||||
|
this.isLoadingCpfpInfo = false;
|
||||||
|
this.isLoadingBroadcast = false;
|
||||||
|
this.adjustedVsize = null;
|
||||||
|
this.showCpfpDetails = false;
|
||||||
|
this.hasCpfp = false;
|
||||||
|
this.fetchCpfp = false;
|
||||||
|
this.cpfpInfo = null;
|
||||||
|
this.hasEffectiveFeeRate = false;
|
||||||
|
this.filters = [];
|
||||||
|
this.hasPrevouts = false;
|
||||||
|
this.missingPrevouts = [];
|
||||||
|
this.stateService.markBlock$.next({});
|
||||||
|
this.mempoolBlocksSubscription?.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
resetForm() {
|
||||||
|
this.resetState();
|
||||||
|
this.pushTxForm.get('txRaw').setValue('');
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('window:resize', ['$event'])
|
||||||
|
setGraphSize(): void {
|
||||||
|
this.isMobile = window.innerWidth < 850;
|
||||||
|
if (this.graphContainer?.nativeElement && this.stateService.isBrowser) {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.graphContainer?.nativeElement?.clientWidth) {
|
||||||
|
this.graphWidth = this.graphContainer.nativeElement.clientWidth;
|
||||||
|
} else {
|
||||||
|
setTimeout(() => { this.setGraphSize(); }, 1);
|
||||||
|
}
|
||||||
|
}, 1);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => { this.setGraphSize(); }, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setupGraph() {
|
||||||
|
this.maxInOut = Math.min(this.inOutLimit, Math.max(this.transaction?.vin?.length || 1, this.transaction?.vout?.length + 1 || 1));
|
||||||
|
this.graphHeight = this.graphExpanded ? this.maxInOut * 15 : Math.min(360, this.maxInOut * 80);
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleGraph() {
|
||||||
|
const showFlow = !this.flowEnabled;
|
||||||
|
this.stateService.hideFlow.next(!showFlow);
|
||||||
|
}
|
||||||
|
|
||||||
|
setFlowEnabled() {
|
||||||
|
this.flowEnabled = !this.hideFlow;
|
||||||
|
}
|
||||||
|
|
||||||
|
expandGraph() {
|
||||||
|
this.graphExpanded = true;
|
||||||
|
this.graphHeight = this.maxInOut * 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
collapseGraph() {
|
||||||
|
this.graphExpanded = false;
|
||||||
|
this.graphHeight = Math.min(360, this.maxInOut * 80);
|
||||||
|
}
|
||||||
|
|
||||||
|
onOfflineModeChange(e): void {
|
||||||
|
this.offlineMode = !e.target.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.mempoolBlocksSubscription?.unsubscribe();
|
||||||
|
this.flowPrefSubscription?.unsubscribe();
|
||||||
|
this.stateService.markBlock$.next({});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -67,64 +67,7 @@
|
|||||||
<ng-template [ngIf]="!isLoadingTx && !error">
|
<ng-template [ngIf]="!isLoadingTx && !error">
|
||||||
|
|
||||||
<!-- CPFP Details -->
|
<!-- CPFP Details -->
|
||||||
<ng-template [ngIf]="showCpfpDetails">
|
<app-cpfp-info *ngIf="showCpfpDetails" [cpfpInfo]="cpfpInfo" [tx]="tx"></app-cpfp-info>
|
||||||
<br>
|
|
||||||
<div class="title">
|
|
||||||
<h2 class="text-left" i18n="transaction.related-transactions|CPFP List">Related Transactions</h2>
|
|
||||||
</div>
|
|
||||||
<div class="box cpfp-details">
|
|
||||||
<table class="table table-fixed table-borderless table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th i18n="transactions-list.vout.scriptpubkey-type">Type</th>
|
|
||||||
<th class="txids" i18n="dashboard.latest-transactions.txid">TXID</th>
|
|
||||||
<th *only-vsize class="d-none d-lg-table-cell" i18n="transaction.vsize|Transaction Virtual Size">Virtual size</th>
|
|
||||||
<th *only-weight class="d-none d-lg-table-cell" i18n="transaction.weight|Transaction Weight">Weight</th>
|
|
||||||
<th i18n="transaction.fee-rate|Transaction fee rate">Fee rate</th>
|
|
||||||
<th class="d-none d-lg-table-cell"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<ng-template [ngIf]="cpfpInfo?.descendants?.length">
|
|
||||||
<tr *ngFor="let cpfpTx of cpfpInfo.descendants">
|
|
||||||
<td><span class="badge badge-primary" i18n="transaction.descendant|Descendant">Descendant</span></td>
|
|
||||||
<td>
|
|
||||||
<app-truncate [text]="cpfpTx.txid" [link]="['/tx' | relativeUrl, cpfpTx.txid]"></app-truncate>
|
|
||||||
</td>
|
|
||||||
<td *only-vsize class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight / 4 | vbytes: 2"></td>
|
|
||||||
<td *only-weight class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight | wuBytes: 2"></td>
|
|
||||||
<td><app-fee-rate [fee]="cpfpTx.fee" [weight]="cpfpTx.weight"></app-fee-rate></td>
|
|
||||||
<td class="d-none d-lg-table-cell"><fa-icon *ngIf="roundToOneDecimal(cpfpTx) > roundToOneDecimal(tx)" class="arrow-green" [icon]="['fas', 'angle-double-up']" [fixedWidth]="true"></fa-icon></td>
|
|
||||||
</tr>
|
|
||||||
</ng-template>
|
|
||||||
<ng-template [ngIf]="cpfpInfo?.bestDescendant">
|
|
||||||
<tr>
|
|
||||||
<td><span class="badge badge-success" i18n="transaction.descendant|Descendant">Descendant</span></td>
|
|
||||||
<td class="txids">
|
|
||||||
<app-truncate [text]="cpfpInfo.bestDescendant.txid" [link]="['/tx' | relativeUrl, cpfpInfo.bestDescendant.txid]"></app-truncate>
|
|
||||||
</td>
|
|
||||||
<td *only-vsize class="d-none d-lg-table-cell" [innerHTML]="cpfpInfo.bestDescendant.weight / 4 | vbytes: 2"></td>
|
|
||||||
<td *only-weight class="d-none d-lg-table-cell" [innerHTML]="cpfpInfo.bestDescendant.weight | wuBytes: 2"></td>
|
|
||||||
<td><app-fee-rate [fee]="cpfpInfo.bestDescendant.fee" [weight]="cpfpInfo.bestDescendant.weight"></app-fee-rate></td>
|
|
||||||
<td class="d-none d-lg-table-cell"><fa-icon class="arrow-green" [icon]="['fas', 'angle-double-up']" [fixedWidth]="true"></fa-icon></td>
|
|
||||||
</tr>
|
|
||||||
</ng-template>
|
|
||||||
<ng-template [ngIf]="cpfpInfo?.ancestors?.length">
|
|
||||||
<tr *ngFor="let cpfpTx of cpfpInfo.ancestors">
|
|
||||||
<td><span class="badge badge-primary" i18n="transaction.ancestor|Transaction Ancestor">Ancestor</span></td>
|
|
||||||
<td class="txids">
|
|
||||||
<app-truncate [text]="cpfpTx.txid" [link]="['/tx' | relativeUrl, cpfpTx.txid]"></app-truncate>
|
|
||||||
</td>
|
|
||||||
<td *only-vsize class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight / 4 | vbytes: 2"></td>
|
|
||||||
<td *only-weight class="d-none d-lg-table-cell" [innerHTML]="cpfpTx.weight | wuBytes: 2"></td>
|
|
||||||
<td><app-fee-rate [fee]="cpfpTx.fee" [weight]="cpfpTx.weight"></app-fee-rate></td>
|
|
||||||
<td class="d-none d-lg-table-cell"><fa-icon *ngIf="roundToOneDecimal(cpfpTx) < roundToOneDecimal(tx)" class="arrow-red" [icon]="['fas', 'angle-double-down']" [fixedWidth]="true"></fa-icon></td>
|
|
||||||
</tr>
|
|
||||||
</ng-template>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</ng-template>
|
|
||||||
|
|
||||||
<!-- Accelerator -->
|
<!-- Accelerator -->
|
||||||
<ng-container *ngIf="!tx?.status?.confirmed && showAccelerationSummary && (ETA$ | async) as eta;">
|
<ng-container *ngIf="!tx?.status?.confirmed && showAccelerationSummary && (ETA$ | async) as eta;">
|
||||||
|
@ -227,18 +227,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cpfp-details {
|
|
||||||
.txids {
|
|
||||||
width: 60%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 500px) {
|
|
||||||
.txids {
|
|
||||||
width: 40%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tx-list {
|
.tx-list {
|
||||||
.alert-link {
|
.alert-link {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -1049,10 +1049,6 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.stateService.markBlock$.next({});
|
this.stateService.markBlock$.next({});
|
||||||
}
|
}
|
||||||
|
|
||||||
roundToOneDecimal(cpfpTx: any): number {
|
|
||||||
return +(cpfpTx.fee / (cpfpTx.weight / 4)).toFixed(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
setupGraph() {
|
setupGraph() {
|
||||||
this.maxInOut = Math.min(this.inOutLimit, Math.max(this.tx?.vin?.length || 1, this.tx?.vout?.length + 1 || 1));
|
this.maxInOut = Math.min(this.inOutLimit, Math.max(this.tx?.vin?.length || 1, this.tx?.vout?.length + 1 || 1));
|
||||||
this.graphHeight = this.graphExpanded ? this.maxInOut * 15 : Math.min(360, this.maxInOut * 80);
|
this.graphHeight = this.graphExpanded ? this.maxInOut * 15 : Math.min(360, this.maxInOut * 80);
|
||||||
|
@ -9,6 +9,8 @@ import { TransactionExtrasModule } from '@components/transaction/transaction-ext
|
|||||||
import { GraphsModule } from '@app/graphs/graphs.module';
|
import { GraphsModule } from '@app/graphs/graphs.module';
|
||||||
import { AccelerateCheckout } from '@components/accelerate-checkout/accelerate-checkout.component';
|
import { AccelerateCheckout } from '@components/accelerate-checkout/accelerate-checkout.component';
|
||||||
import { AccelerateFeeGraphComponent } from '@components/accelerate-checkout/accelerate-fee-graph.component';
|
import { AccelerateFeeGraphComponent } from '@components/accelerate-checkout/accelerate-fee-graph.component';
|
||||||
|
import { TransactionRawComponent } from '@components/transaction/transaction-raw.component';
|
||||||
|
import { CpfpInfoComponent } from '@components/transaction/cpfp-info.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
@ -16,6 +18,10 @@ const routes: Routes = [
|
|||||||
redirectTo: '/',
|
redirectTo: '/',
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'preview',
|
||||||
|
component: TransactionRawComponent,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
component: TransactionComponent,
|
component: TransactionComponent,
|
||||||
@ -49,12 +55,15 @@ export class TransactionRoutingModule { }
|
|||||||
TransactionDetailsComponent,
|
TransactionDetailsComponent,
|
||||||
AccelerateCheckout,
|
AccelerateCheckout,
|
||||||
AccelerateFeeGraphComponent,
|
AccelerateFeeGraphComponent,
|
||||||
|
TransactionRawComponent,
|
||||||
|
CpfpInfoComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
TransactionComponent,
|
TransactionComponent,
|
||||||
TransactionDetailsComponent,
|
TransactionDetailsComponent,
|
||||||
AccelerateCheckout,
|
AccelerateCheckout,
|
||||||
AccelerateFeeGraphComponent,
|
AccelerateFeeGraphComponent,
|
||||||
|
CpfpInfoComponent,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class TransactionModule { }
|
export class TransactionModule { }
|
||||||
|
@ -37,6 +37,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
|
|||||||
@Input() addresses: string[] = [];
|
@Input() addresses: string[] = [];
|
||||||
@Input() rowLimit = 12;
|
@Input() rowLimit = 12;
|
||||||
@Input() blockTime: number = 0; // Used for price calculation if all the transactions are in the same block
|
@Input() blockTime: number = 0; // Used for price calculation if all the transactions are in the same block
|
||||||
|
@Input() txPreview = false;
|
||||||
|
|
||||||
@Output() loadMore = new EventEmitter();
|
@Output() loadMore = new EventEmitter();
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
|
|||||||
this.refreshOutspends$
|
this.refreshOutspends$
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap((txIds) => {
|
switchMap((txIds) => {
|
||||||
if (!this.cached) {
|
if (!this.cached && !this.txPreview) {
|
||||||
// break list into batches of 50 (maximum supported by esplora)
|
// break list into batches of 50 (maximum supported by esplora)
|
||||||
const batches = [];
|
const batches = [];
|
||||||
for (let i = 0; i < txIds.length; i += 50) {
|
for (let i = 0; i < txIds.length; i += 50) {
|
||||||
@ -119,7 +120,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
|
|||||||
),
|
),
|
||||||
this.refreshChannels$
|
this.refreshChannels$
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(() => this.stateService.networkSupportsLightning()),
|
filter(() => this.stateService.networkSupportsLightning() && !this.txPreview),
|
||||||
switchMap((txIds) => this.apiService.getChannelByTxIds$(txIds)),
|
switchMap((txIds) => this.apiService.getChannelByTxIds$(txIds)),
|
||||||
catchError((error) => {
|
catchError((error) => {
|
||||||
// handle 404
|
// handle 404
|
||||||
@ -187,7 +188,10 @@ export class TransactionsListComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.transactionsLength = this.transactions.length;
|
this.transactionsLength = this.transactions.length;
|
||||||
this.cacheService.setTxCache(this.transactions);
|
|
||||||
|
if (!this.txPreview) {
|
||||||
|
this.cacheService.setTxCache(this.transactions);
|
||||||
|
}
|
||||||
|
|
||||||
const confirmedTxs = this.transactions.filter((tx) => tx.status.confirmed).length;
|
const confirmedTxs = this.transactions.filter((tx) => tx.status.confirmed).length;
|
||||||
this.transactions.forEach((tx) => {
|
this.transactions.forEach((tx) => {
|
||||||
@ -351,7 +355,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadMoreInputs(tx: Transaction): void {
|
loadMoreInputs(tx: Transaction): void {
|
||||||
if (!tx['@vinLoaded']) {
|
if (!tx['@vinLoaded'] && !this.txPreview) {
|
||||||
this.electrsApiService.getTransaction$(tx.txid)
|
this.electrsApiService.getTransaction$(tx.txid)
|
||||||
.subscribe((newTx) => {
|
.subscribe((newTx) => {
|
||||||
tx['@vinLoaded'] = true;
|
tx['@vinLoaded'] = true;
|
||||||
|
@ -14,7 +14,7 @@ class GuardService {
|
|||||||
trackerGuard(route: Route, segments: UrlSegment[]): boolean {
|
trackerGuard(route: Route, segments: UrlSegment[]): boolean {
|
||||||
const preferredRoute = this.router.getCurrentNavigation()?.extractedUrl.queryParams?.mode;
|
const preferredRoute = this.router.getCurrentNavigation()?.extractedUrl.queryParams?.mode;
|
||||||
const path = this.router.getCurrentNavigation()?.extractedUrl.root.children.primary.segments;
|
const path = this.router.getCurrentNavigation()?.extractedUrl.root.children.primary.segments;
|
||||||
return (preferredRoute === 'status' || (preferredRoute !== 'details' && this.navigationService.isInitialLoad())) && window.innerWidth <= 767.98 && !(path.length === 2 && ['push', 'test'].includes(path[1].path));
|
return (preferredRoute === 'status' || (preferredRoute !== 'details' && this.navigationService.isInitialLoad())) && window.innerWidth <= 767.98 && !(path.length === 2 && ['push', 'test', 'preview'].includes(path[1].path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,6 +565,14 @@ export class ApiService {
|
|||||||
return this.httpClient.post(this.apiBaseUrl + this.apiBasePath + '/api/v1/acceleration/request/' + txid, '');
|
return this.httpClient.post(this.apiBaseUrl + this.apiBasePath + '/api/v1/acceleration/request/' + txid, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPrevouts$(outpoints: {txid: string; vout: number}[]): Observable<any> {
|
||||||
|
return this.httpClient.post(this.apiBaseUrl + this.apiBasePath + '/api/v1/prevouts', outpoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCpfpLocalTx$(tx: any[]): Observable<CpfpInfo[]> {
|
||||||
|
return this.httpClient.post<CpfpInfo[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/cpfp', tx);
|
||||||
|
}
|
||||||
|
|
||||||
// Cache methods
|
// Cache methods
|
||||||
async setBlockAuditLoaded(hash: string) {
|
async setBlockAuditLoaded(hash: string) {
|
||||||
this.blockAuditLoaded[hash] = true;
|
this.blockAuditLoaded[hash] = true;
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
<p><a [routerLink]="['/blocks' | relativeUrl]" i18n="dashboard.recent-blocks">Recent Blocks</a></p>
|
<p><a [routerLink]="['/blocks' | relativeUrl]" i18n="dashboard.recent-blocks">Recent Blocks</a></p>
|
||||||
<p><a [routerLink]="['/tx/push' | relativeUrl]" i18n="shared.broadcast-transaction|Broadcast Transaction">Broadcast Transaction</a></p>
|
<p><a [routerLink]="['/tx/push' | relativeUrl]" i18n="shared.broadcast-transaction|Broadcast Transaction">Broadcast Transaction</a></p>
|
||||||
<p><a [routerLink]="['/tx/test' | relativeUrl]" i18n="shared.test-transaction|Test Transaction">Test Transaction</a></p>
|
<p><a [routerLink]="['/tx/test' | relativeUrl]" i18n="shared.test-transaction|Test Transaction">Test Transaction</a></p>
|
||||||
|
<p><a [routerLink]="['/tx/preview' | relativeUrl]" i18n="shared.preview-transaction|Preview Transaction">Preview Transaction</a></p>
|
||||||
<p *ngIf="officialMempoolSpace"><a [routerLink]="['/lightning/group/the-mempool-open-source-project' | relativeUrl]" i18n="footer.connect-to-our-nodes">Connect to our Nodes</a></p>
|
<p *ngIf="officialMempoolSpace"><a [routerLink]="['/lightning/group/the-mempool-open-source-project' | relativeUrl]" i18n="footer.connect-to-our-nodes">Connect to our Nodes</a></p>
|
||||||
<p><a [routerLink]="['/docs/api' | relativeUrl]" i18n="footer.api-documentation">API Documentation</a></p>
|
<p><a [routerLink]="['/docs/api' | relativeUrl]" i18n="footer.api-documentation">API Documentation</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<span class="truncate" [style.max-width]="maxWidth ? maxWidth + 'px' : null" [style.justify-content]="textAlign" [class.inline]="inline">
|
<span class="truncate" [style.max-width]="maxWidth ? maxWidth + 'px' : null" [style.justify-content]="textAlign" [class.inline]="inline">
|
||||||
<ng-container *ngIf="link">
|
<ng-container *ngIf="link">
|
||||||
<a [routerLink]="link" [queryParams]="queryParams" class="truncate-link" [target]="external ? '_blank' : '_self'">
|
<a [routerLink]="link" [queryParams]="queryParams" class="truncate-link" [target]="external ? '_blank' : '_self'" [class.disabled]="disabled">
|
||||||
<ng-container *ngIf="rtl; then rtlTruncated; else ltrTruncated;"></ng-container>
|
<ng-container *ngIf="rtl; then rtlTruncated; else ltrTruncated;"></ng-container>
|
||||||
</a>
|
</a>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -37,6 +37,12 @@
|
|||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.8;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 567px) {
|
@media (max-width: 567px) {
|
||||||
|
@ -15,6 +15,7 @@ export class TruncateComponent {
|
|||||||
@Input() maxWidth: number = null;
|
@Input() maxWidth: number = null;
|
||||||
@Input() inline: boolean = false;
|
@Input() inline: boolean = false;
|
||||||
@Input() textAlign: 'start' | 'end' = 'start';
|
@Input() textAlign: 'start' | 'end' = 'start';
|
||||||
|
@Input() disabled: boolean = false;
|
||||||
rtl: boolean;
|
rtl: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user