Defines the interface for a program repository. It allows us to register and retrieve programs when needed.

Hierarchy

  • ProgramRepositoryInterface

Methods

  • Registers a new program in the repository.

    Parameters

    • program: Program

      The program to register.

    • Optional overrides: boolean

      Whether to register and prioritize the given program even if a program with the same public key already exists. Defaults to true.

    Returns void

  • Gets all programs from the repository matching the given cluster filter. Defaults to getting all programs from the current cluster.

    Parameters

    • Optional clusterFilter: ClusterFilter

      The cluster filter to apply. Defaults to "current".

    Returns Program[]

  • Creates a binding between a name and a program identifier. This can be used to create redirections or aliases when resolving programs.

    Parameters

    • abstract: string

      The name of the binding.

    • concrete: string | PublicKey<string>

      The identifier this binding should resolve to.

    Returns void

  • Creates a cloned instance of the repository.

    Returns

    A new repository instance with the same programs and bindings.

    Returns ProgramRepositoryInterface

  • Gets a program from the repository. Throws an error if the program is not found.

    Type Parameters

    • T extends Program = Program

      The type of the program to retrieve. Defaults to Program.

    Parameters

    • identifier: string | PublicKey<string>

      The name or public key of the program to retrieve.

    • Optional clusterFilter: ClusterFilter

      The cluster filter to apply. Defaults to "current".

    Returns T

  • Gets the public key of a program from the repository, with an optional fallback public key.

    Throws an error if the program is not found and no fallback is provided.

    Parameters

    • identifier: string | PublicKey<string>

      The name or public key of the program to retrieve.

    • Optional fallback: PublicKeyInput<string>

      The fallback public key to use if the program is not found. Defaults to not using a fallback public key.

    • Optional clusterFilter: ClusterFilter

      The cluster filter to apply. Defaults to "current".

    Returns PublicKey<string>

  • Whether a given program is registered in the repository.

    Parameters

    • identifier: string | PublicKey<string>

      The name or public key of the program to check.

    • Optional clusterFilter: ClusterFilter

      The cluster filter to apply. Defaults to "current".

    Returns boolean

  • Resolves a custom program error from a transaction error.

    Returns

    The resolved program error, or null if the error cannot be resolved.

    Parameters

    • error: ErrorWithLogs

      The raw error to resolve containing the program logs.

    • transaction: Transaction

      The transaction that caused the error.

    Returns null | ProgramError

  • Removes a binding using its name.

    Parameters

    • abstract: string

      The name of the binding to remove.

    Returns void

Generated using TypeDoc