Function encodeBase58Address

  • Encode a hash as a Base58Address.

    Note, this method does not enforce error handling via the type system. The returned string will not be a valid Base58Address if hash is not exactly 20 bytes. If needed, validate the length of hash before calling this method.

    For other standards that use the Base58Address format but have other version or length requirements, use encodeCashAddressFormat.

    Parameters

    • type: "p2pkh" | "p2pkhCopayBCH" | "p2pkhTestnet" | "p2sh20" | "p2sh20CopayBCH" | "p2sh20Testnet"

      the type of address to encode: p2pkh, p2sh20, p2pkh-testnet, or p2sh20-testnet

    • payload: Uint8Array
    • sha256: {
          hash: ((input: Uint8Array) => Uint8Array);
      } = internalSha256

      an implementation of sha256 (defaults to the internal WASM implementation)

      • hash: ((input: Uint8Array) => Uint8Array)
          • (input: Uint8Array): Uint8Array
          • Returns the sha256 hash of the provided input.

            To incrementally construct a sha256 hash (e.g. for streaming), use init, update, and final.

            Parameters

            • input: Uint8Array

              a Uint8Array to be hashed using sha256

            Returns Uint8Array

    Returns string

Generated using TypeDoc