function bitcoinEncode(buffer, type, compressed = false) {
        let bufferCheck;
        let prefixBuffer;
        let offsetChecksum;
        if (type === "public") {
          bufferCheck = new Uint8Array(25);
          prefixBuffer = new Uint8Array(21);
          bufferCheck[0] = 0;
          prefixBuffer[0] = 0;
          offsetChecksum = 21;
        } else {
          if (compressed) {
            bufferCheck = new Uint8Array(38);
            prefixBuffer = new Uint8Array(34);
            offsetChecksum = 34;
            bufferCheck[33] = 1;
            prefixBuffer[33] = 1;
          } else {
            bufferCheck = new Uint8Array(37);
            prefixBuffer = new Uint8Array(33);
            offsetChecksum = 33;
          }
          bufferCheck[0] = 128;
          prefixBuffer[0] = 128;
        }
        prefixBuffer.set(buffer, 1);
        const firstHash = sha256_1.sha256(prefixBuffer);
        const doubleHash = sha256_1.sha256(firstHash);
        const checksum = new Uint8Array(4);
        checksum.set(doubleHash.slice(0, 4));
        bufferCheck.set(buffer, 1);
        bufferCheck.set(checksum, offsetChecksum);
        return encodeBase58(bufferCheck);
      }
/**
       * Encodes a public or private key in base58 using
       * the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
       * and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
       *
       * For private keys this encode is also known as
       * wallet import format (WIF).
       */
Encodes a public or private key in base58 using
the bitcoin format
and [Bitcoin WIF]).

For private keys this encode is also known as
wallet import format (WIF).
Encodes a public or private key in base58 using the bitcoin format and [ Bitcoin WIF ] ) . For private keys this encode is also known as wallet import format ( WIF ) .
function bitcoinEncode(buffer, type, compressed = false) {
        let bufferCheck;
        let prefixBuffer;
        let offsetChecksum;
        if (type === "public") {
          bufferCheck = new Uint8Array(25);
          prefixBuffer = new Uint8Array(21);
          bufferCheck[0] = 0;
          prefixBuffer[0] = 0;
          offsetChecksum = 21;
        } else {
          if (compressed) {
            bufferCheck = new Uint8Array(38);
            prefixBuffer = new Uint8Array(34);
            offsetChecksum = 34;
            bufferCheck[33] = 1;
            prefixBuffer[33] = 1;
          } else {
            bufferCheck = new Uint8Array(37);
            prefixBuffer = new Uint8Array(33);
            offsetChecksum = 33;
          }
          bufferCheck[0] = 128;
          prefixBuffer[0] = 128;
        }
        prefixBuffer.set(buffer, 1);
        const firstHash = sha256_1.sha256(prefixBuffer);
        const doubleHash = sha256_1.sha256(firstHash);
        const checksum = new Uint8Array(4);
        checksum.set(doubleHash.slice(0, 4));
        bufferCheck.set(buffer, 1);
        bufferCheck.set(checksum, offsetChecksum);
        return encodeBase58(bufferCheck);
      }
function bitcoinEncode ( buffer , type , compressed = false ) { let bufferCheck ; let prefixBuffer ; let offsetChecksum ; if ( type === "public" ) { bufferCheck = new Uint8Array ( 25 ) ; prefixBuffer = new Uint8Array ( 21 ) ; bufferCheck [ 0 ] = 0 ; prefixBuffer [ 0 ] = 0 ; offsetChecksum = 21 ; } else { if ( compressed ) { bufferCheck = new Uint8Array ( 38 ) ; prefixBuffer = new Uint8Array ( 34 ) ; offsetChecksum = 34 ; bufferCheck [ 33 ] = 1 ; prefixBuffer [ 33 ] = 1 ; } else { bufferCheck = new Uint8Array ( 37 ) ; prefixBuffer = new Uint8Array ( 33 ) ; offsetChecksum = 33 ; } bufferCheck [ 0 ] = 128 ; prefixBuffer [ 0 ] = 128 ; } prefixBuffer . set ( buffer , 1 ) ; const firstHash = sha256_1 . sha256 ( prefixBuffer ) ; const doubleHash = sha256_1 . sha256 ( firstHash ) ; const checksum = new Uint8Array ( 4 ) ; checksum . set ( doubleHash . slice ( 0 , 4 ) ) ; bufferCheck . set ( buffer , 1 ) ; bufferCheck . set ( checksum , offsetChecksum ) ; return encodeBase58 ( bufferCheck ) ; }
Encodes a public or private key in base58 using
 the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
 and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
Encodes a public or private key in base58 using the bitcoin format ( see [ Bitcoin Base58Check encoding ] ( https : // en . bitcoin . it / wiki / Base58Check_encoding ) and [ Bitcoin WIF ] ( https : // en . bitcoin . it / wiki / Wallet_import_format )) .