Represents a ckb address with associated script and prefix.

Constructors

  • Creates an instance of Address.

    Parameters

    • script: ccc.Script

      The script associated with the address.

    • prefix: string

      The address prefix.

    Returns Address

Properties

script: ccc.Script

The script associated with the address.

prefix: string

The address prefix.

Methods

  • Creates an Address instance from an AddressLike object.

    Parameters

    • address: AddressLike

      An AddressLike object or an instance of Address.

    Returns Address

    An Address instance.

  • Creates an Address instance from an address string.

    Parameters

    • address: string

      The address string to parse.

    • clients: Client | Record<string, Client>

      A Client instance or a record of Client instances keyed by prefix.

    Returns Promise<Address>

    A promise that resolves to an Address instance.

    Will throw an error if the address prefix is unknown or mismatched.

  • Creates an Address instance from a script and client.

    Parameters

    • script: ScriptLike

      The script-like object.

    • client: Client

      The client instance used to fetch the address prefix.

    Returns Address

    A promise that resolves to an Address instance.

  • Converts the Address instance to a string.

    Returns string

    The address as a string.