Base58.decodeCheck
import { Base58 } from "https://raw.githubusercontent.com/marigold-dev/tzstamp/0.3.4/helpers/mod.ts";
const { decodeCheck } = Base58;
Decodes and validates a Base58 string with a checksum to a byte array.
Throws ChecksumError
if the checksum does not match.
Throws SyntaxError
if the input string contains
letters not included in the [Base58 Alphabet].
See the Bitcoin source code for the original C++ implementation.
Base58.decodeCheck("6sx8oP1Sgpe");
// Uint8Array(4) [ 35, 37, 31, 49 ]
Optionally, a prefix can be specified, which will be separated from the payload after decoding.
Throws PrefixError
if the prefix does not match
the leading decoded bytes.
Base58.decodeCheck(
"2dWKxb85CS1cWb5mm",
new Uint8Array([ 86, 88, 92, 84 ])
);
// Uint8Array(4) [ 35, 37, 31, 49 ]
function decodeCheck(string: string, prefix?);