Function lockingBytecodeToBase58Address

  • Encode a locking bytecode as a Base58Address for a given network.

    If bytecode matches a standard pattern, it is encoded using the proper address type and returned as a valid Base58Address (string).

    If bytecode cannot be encoded as an address (i.e. because the pattern is not standard), the resulting AddressContents is returned.

    Note, Base58Addresses cannot accept tokens; to accept tokens, use lockingBytecodeToCashAddress with options.tokenSupport set to true.


    • bytecode: Uint8Array

      the locking bytecode to encode

    • network: Base58AddressNetwork = 'mainnet'

      the network for which to encode the address (mainnet, testnet, or 'copayBCH'), defaults to mainnet

    • 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.


            • input: Uint8Array

              a Uint8Array to be hashed using sha256

            Returns Uint8Array

    Returns string | AddressContents

Generated using TypeDoc