All files / app/utils stacking.ts

87.5% Statements 7/8
0% Branches 0/2
66.66% Functions 2/3
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 191x 1x           1x 5x 4x       1x   1x      
import { NETWORK } from '@constants/index';
import { poxAddressToBtcAddress } from '@stacks/stacking';
 
interface ConvertToPoxAddressBtc {
  version: Uint8Array;
  hashbytes: Uint8Array;
}
export function convertPoxAddressToBtc(network: 'mainnet' | 'testnet') {
  return ({ version, hashbytes }: ConvertToPoxAddressBtc) => {
    return poxAddressToBtcAddress(version[0], hashbytes, network);
  };
}
 
export const formatPoxAddressToNetwork = convertPoxAddressToBtc(NETWORK);
 
export function formatCycles(cycles: number) {
  return `${cycles} cycle${cycles !== 1 ? 's' : ''}`;
}