Function publicKeyToP2pkhCashAddress

  • Derive the P2PKH address of the provided public key.

    Note that this function defaults to throwing an error if provided with an invalid public key. To handle errors in a type-safe way, set throwErrors to false.

    To derive only the locking bytecode, use publicKeyToP2pkhLockingBytecode. For HD public keys, use hdPublicKeyToP2pkhCashAddress. For the private key equivalent, see privateKeyToP2pkhCashAddress.

    Type Parameters

    • ThrowErrors extends boolean = true

    Parameters

    • __namedParameters: {
          prefix?: "bitcoincash" | "bchtest" | "bchreg";
          publicKey: Uint8Array;
          throwErrors?: ThrowErrors;
          tokenSupport?: boolean;
      }
      • Optional prefix?: "bitcoincash" | "bchtest" | "bchreg"

        The CashAddressNetworkPrefix to use when encoding the address. (Default: bitcoincash)

      • publicKey: Uint8Array

        The public key from which to derive the P2PKH address.

      • Optional throwErrors?: ThrowErrors

        If true, this function will throw an Error if the provided publicKey is invalid rather than returning the error as a string (defaults to true).

      • Optional tokenSupport?: boolean

        If true, the address will indicate that the receiver accepts CashTokens; defaults to false.

    Returns ThrowErrors extends true
        ? CashAddressResult
        : string | CashAddressResult

Generated using TypeDoc