Merge branch 'master' into nymkappa/mega-branch
This commit is contained in:
		
						commit
						e5709235f3
					
				@ -573,7 +573,9 @@ class BitcoinRoutes {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      const addressData = await bitcoinApi.$getScriptHash(req.params.scripthash);
 | 
			
		||||
      // electrum expects scripthashes in little-endian
 | 
			
		||||
      const electrumScripthash = req.params.scripthash.match(/../g)?.reverse().join('') ?? '';
 | 
			
		||||
      const addressData = await bitcoinApi.$getScriptHash(electrumScripthash);
 | 
			
		||||
      res.json(addressData);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      if (e instanceof Error && e.message && (e.message.indexOf('too long') > 0 || e.message.indexOf('confirmed status') > 0)) {
 | 
			
		||||
@ -590,11 +592,13 @@ class BitcoinRoutes {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      // electrum expects scripthashes in little-endian
 | 
			
		||||
      const electrumScripthash = req.params.scripthash.match(/../g)?.reverse().join('') ?? '';
 | 
			
		||||
      let lastTxId: string = '';
 | 
			
		||||
      if (req.query.after_txid && typeof req.query.after_txid === 'string') {
 | 
			
		||||
        lastTxId = req.query.after_txid;
 | 
			
		||||
      }
 | 
			
		||||
      const transactions = await bitcoinApi.$getScriptHashTransactions(req.params.scripthash, lastTxId);
 | 
			
		||||
      const transactions = await bitcoinApi.$getScriptHashTransactions(electrumScripthash, lastTxId);
 | 
			
		||||
      res.json(transactions);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      if (e instanceof Error && e.message && (e.message.indexOf('too long') > 0 || e.message.indexOf('confirmed status') > 0)) {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								contributors/ncois.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								contributors/ncois.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
I hereby accept the terms of the Contributor License Agreement in the CONTRIBUTING.md file of the mempool/mempool git repository as of November 16, 2023.
 | 
			
		||||
 | 
			
		||||
Signed: ncois
 | 
			
		||||
							
								
								
									
										3
									
								
								contributors/shubhamkmr04.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								contributors/shubhamkmr04.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
I hereby accept the terms of the Contributor License Agreement in the CONTRIBUTING.md file of the mempool/mempool git repository as of November 15, 2023.
 | 
			
		||||
 | 
			
		||||
Signed: shubhamkmr04
 | 
			
		||||
@ -299,9 +299,9 @@
 | 
			
		||||
        <img class="image" src="/resources/profile/blixt.png" />
 | 
			
		||||
        <span>Blixt</span>
 | 
			
		||||
      </a>
 | 
			
		||||
      <a href="https://github.com/ZeusLN/zeus" target="_blank" title="Zeus">
 | 
			
		||||
      <a href="https://github.com/ZeusLN/zeus" target="_blank" title="ZEUS">
 | 
			
		||||
        <img class="image" src="/resources/profile/zeus.png" />
 | 
			
		||||
        <span>Zeus</span>
 | 
			
		||||
        <span>ZEUS</span>
 | 
			
		||||
      </a>
 | 
			
		||||
      <a href="https://github.com/vulpemventures/marina" target="_blank" title="Marina Wallet">
 | 
			
		||||
        <img class="image" src="/resources/profile/marina.svg" />
 | 
			
		||||
 | 
			
		||||
@ -156,17 +156,45 @@ export class TransactionsListComponent implements OnInit, OnChanges {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this.address) {
 | 
			
		||||
          const addressIn = tx.vout
 | 
			
		||||
            .filter((v: Vout) => v.scriptpubkey_address === this.address)
 | 
			
		||||
            .map((v: Vout) => v.value || 0)
 | 
			
		||||
            .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
          const isP2PKUncompressed = this.address.length === 130;
 | 
			
		||||
          const isP2PKCompressed = this.address.length === 66;
 | 
			
		||||
          if (isP2PKCompressed) {
 | 
			
		||||
            const addressIn = tx.vout
 | 
			
		||||
              .filter((v: Vout) => v.scriptpubkey === '21' + this.address + 'ac')
 | 
			
		||||
              .map((v: Vout) => v.value || 0)
 | 
			
		||||
              .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
 | 
			
		||||
          const addressOut = tx.vin
 | 
			
		||||
            .filter((v: Vin) => v.prevout && v.prevout.scriptpubkey_address === this.address)
 | 
			
		||||
            .map((v: Vin) => v.prevout.value || 0)
 | 
			
		||||
            .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
            const addressOut = tx.vin
 | 
			
		||||
              .filter((v: Vin) => v.prevout && v.prevout.scriptpubkey === '21' + this.address + 'ac')
 | 
			
		||||
              .map((v: Vin) => v.prevout.value || 0)
 | 
			
		||||
              .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
 | 
			
		||||
          tx['addressValue'] = addressIn - addressOut;
 | 
			
		||||
            tx['addressValue'] = addressIn - addressOut;
 | 
			
		||||
          } else if (isP2PKUncompressed) {
 | 
			
		||||
            const addressIn = tx.vout
 | 
			
		||||
              .filter((v: Vout) => v.scriptpubkey === '41' + this.address + 'ac')
 | 
			
		||||
              .map((v: Vout) => v.value || 0)
 | 
			
		||||
              .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
 | 
			
		||||
            const addressOut = tx.vin
 | 
			
		||||
              .filter((v: Vin) => v.prevout && v.prevout.scriptpubkey === '41' + this.address + 'ac')
 | 
			
		||||
              .map((v: Vin) => v.prevout.value || 0)
 | 
			
		||||
              .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
 | 
			
		||||
            tx['addressValue'] = addressIn - addressOut;
 | 
			
		||||
          } else {
 | 
			
		||||
            const addressIn = tx.vout
 | 
			
		||||
              .filter((v: Vout) => v.scriptpubkey_address === this.address)
 | 
			
		||||
              .map((v: Vout) => v.value || 0)
 | 
			
		||||
              .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
 | 
			
		||||
            const addressOut = tx.vin
 | 
			
		||||
              .filter((v: Vin) => v.prevout && v.prevout.scriptpubkey_address === this.address)
 | 
			
		||||
              .map((v: Vin) => v.prevout.value || 0)
 | 
			
		||||
              .reduce((a: number, b: number) => a + b, 0);
 | 
			
		||||
 | 
			
		||||
            tx['addressValue'] = addressIn - addressOut;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.priceService.getBlockPrice$(tx.status.block_time).pipe(
 | 
			
		||||
 | 
			
		||||
@ -237,7 +237,7 @@
 | 
			
		||||
      <div class="card-text" *ngIf="(isLoadingWebSocket$ | async) === false && mempoolInfoData.value; else loadingbig">
 | 
			
		||||
        <div class="progress">
 | 
			
		||||
          <div class="progress-bar {{ mempoolInfoData.value.mempoolSizeProgress }}" role="progressbar" [ngStyle]="{'width': (mempoolInfoData.value.memPoolInfo.usage / mempoolInfoData.value.memPoolInfo.maxmempool * 100) + '%' }"> </div>
 | 
			
		||||
          <div class="progress-text">‎<span [innerHTML]="mempoolInfoData.value.memPoolInfo.usage | bytes"></span> / <span [innerHTML]="mempoolInfoData.value.memPoolInfo.maxmempool | bytes"></span></div>
 | 
			
		||||
          <div class="progress-text">‎<span [innerHTML]="mempoolInfoData.value.memPoolInfo.usage | bytes : 2 : 'B' : null : 3"></span> / <span [innerHTML]="mempoolInfoData.value.memPoolInfo.maxmempool | bytes"></span></div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
/* tslint:disable */
 | 
			
		||||
import { Pipe, PipeTransform } from '@angular/core';
 | 
			
		||||
import { isNumberFinite, isPositive, isInteger, toDecimal } from './utils';
 | 
			
		||||
import { isNumberFinite, isPositive, isInteger, toDecimal, toSigFigs } from './utils';
 | 
			
		||||
 | 
			
		||||
export type ByteUnit = 'B' | 'kB' | 'MB' | 'GB' | 'TB';
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@ export class BytesPipe implements PipeTransform {
 | 
			
		||||
        'TB': {max: Number.MAX_SAFE_INTEGER, prev: 'GB'}
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    transform(input: any, decimal: number = 0, from: ByteUnit = 'B', to?: ByteUnit): any {
 | 
			
		||||
    transform(input: any, decimal: number = 0, from: ByteUnit = 'B', to?: ByteUnit, sigfigs?: number): any {
 | 
			
		||||
 | 
			
		||||
        if (!(isNumberFinite(input) &&
 | 
			
		||||
                isNumberFinite(decimal) &&
 | 
			
		||||
@ -33,10 +33,14 @@ export class BytesPipe implements PipeTransform {
 | 
			
		||||
            unit = BytesPipe.formats[unit].prev!;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let numberFormat = sigfigs == null ?
 | 
			
		||||
            (number) => toDecimal(number, decimal).toString() :
 | 
			
		||||
            (number) => toSigFigs(number, sigfigs);
 | 
			
		||||
 | 
			
		||||
        if (to) {
 | 
			
		||||
            const format = BytesPipe.formats[to];
 | 
			
		||||
 | 
			
		||||
            const result = toDecimal(BytesPipe.calculateResult(format, bytes), decimal);
 | 
			
		||||
            const result = numberFormat(BytesPipe.calculateResult(format, bytes));
 | 
			
		||||
 | 
			
		||||
            return BytesPipe.formatResult(result, to);
 | 
			
		||||
        }
 | 
			
		||||
@ -45,14 +49,14 @@ export class BytesPipe implements PipeTransform {
 | 
			
		||||
            const format = BytesPipe.formats[key];
 | 
			
		||||
            if (bytes < format.max) {
 | 
			
		||||
 | 
			
		||||
                const result = toDecimal(BytesPipe.calculateResult(format, bytes), decimal);
 | 
			
		||||
                const result = numberFormat(BytesPipe.calculateResult(format, bytes));
 | 
			
		||||
 | 
			
		||||
                return BytesPipe.formatResult(result, key);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static formatResult(result: number, unit: string): string {
 | 
			
		||||
    static formatResult(result: string, unit: string): string {
 | 
			
		||||
        return `${result} <span class="symbol">${unit}</span>`;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -54,6 +54,10 @@ export function toDecimal(value: number, decimal: number): number {
 | 
			
		||||
  return Math.round(value * Math.pow(10, decimal)) / Math.pow(10, decimal);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function toSigFigs(value: number, sigFigs: number): string {
 | 
			
		||||
  return value >= Math.pow(10, sigFigs - 1) ? Math.round(value).toString() : value.toPrecision(sigFigs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function upperFirst(value: string): string {
 | 
			
		||||
  return value.slice(0, 1).toUpperCase() + value.slice(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 99 KiB  | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user