CCC Docs
    Preparing search index...

    Class SignerCkbPrivateKey

    An abstract class representing a generic signer. This class provides methods to connect, get addresses, and sign transactions.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    privateKey: `0x${string}`
    publicKey: `0x${string}`
    client_: Client

    Accessors

    Methods

    • Signs a message and returns signature only. This method is not implemented and should be overridden by subclasses.

      Parameters

      • message: BytesLike

        The message to sign, as a string or BytesLike object.

      Returns Promise<`0x${string}`>

      A promise that resolves to the signature as a string.

      Will throw an error if not implemented.

    • Prepares a transaction before signing. This method can be overridden by subclasses to perform any necessary steps, such as adding cell dependencies or witnesses, before the transaction is signed. The default implementation converts the TransactionLike object to a Transaction object without modification.

      Parameters

      Returns Promise<Transaction>

      A promise that resolves to the prepared Transaction object.

      Note that this default implementation does not add any cell dependencies or dummy witnesses. This may lead to an underestimation of transaction size and fees if used with methods like Transaction.completeFee. Subclasses for signers that are intended to sign transactions should override this method to perform necessary preparations.

    • Gets the recommended address for the signer as a string.

      Parameters

      • Optionalpreference: unknown

        Optional preference parameter.

      Returns Promise<string>

      A promise that resolves to the recommended address as a string.

    • Find cells of this signer

      Parameters

      • filter: ClientIndexerSearchKeyFilterLike

        The filter for the search key.

      • OptionalwithData: null | boolean

        Whether to include cell data in the response.

      • Optionalorder: "asc" | "desc"

        The order of the returned cells, can be "asc" or "desc".

      • Optionallimit: number

        The maximum number of cells for every querying chunk.

      Returns AsyncGenerator<Cell>

      A async generator that yields all matching cells

    • Find transactions of this signer

      Parameters

      Returns AsyncGenerator<
          {
              txHash: `0x${string}`;
              blockNumber: bigint;
              txIndex: bigint;
              isInput: boolean;
              cellIndex: bigint;
          },
      >

      A async generator that yields all matches transactions

    • Find transactions of this signer

      Parameters

      Returns AsyncGenerator<
          {
              txHash: `0x${string}`;
              blockNumber: bigint;
              txIndex: bigint;
              cells: { isInput: boolean; cellIndex: bigint }[];
          },
      >

      A async generator that yields all matches transactions

    • Find transactions of this signer

      Parameters

      Returns AsyncGenerator<
          | {
              txHash: `0x${string}`;
              blockNumber: bigint;
              txIndex: bigint;
              isInput: boolean;
              cellIndex: bigint;
          }
          | {
              txHash: `0x${string}`;
              blockNumber: bigint;
              txIndex: bigint;
              cells: { isInput: boolean; cellIndex: bigint }[];
          },
      >

      A async generator that yields all matches transactions