CCC Docs
    Preparing search index...

    Function addressFromPayload

    • Converts an address payload into an address-like object.

      Parameters

      • prefix: string

        The address prefix.

      • format: AddressFormat

        The format of the address, as defined by the AddressFormat enum.

      • payload: number[]

        The payload array containing the address data.

      • client: Client

        The client instance used to fetch known scripts.

      Returns Promise<AddressLike>

      A promise that resolves to an AddressLike object.

      Will throw an error if the payload length is insufficient or if the script type is unknown.

      const address = await addressFromPayload("ckt", AddressFormat.Full, [/* payload data */], client);
      console.log(address.script); // Outputs the script object
      console.log(address.prefix); // Outputs the address prefix