Script provides a typed interface for interacting with the script program type.

Type Parameters

  • TInput extends any[]
  • TOutput

Hierarchy

  • AbstractScript
    • Script

Constructors

  • Create a new instance of the Script class.

    Type Parameters

    • TInput extends any[]
    • TOutput

    Parameters

    • bytecode: BytesLike

      The compiled bytecode of the script.

    • abi: JsonAbi

      The ABI interface for the script.

    • account: Account

      The account associated with the script.

    Returns Script<TInput, TOutput>

Properties

account: Account

The account associated with the script.

bytes: Uint8Array

The compiled bytecode of the script.

functions: {
    main: InvokeMain<TInput, TOutput>;
}

Functions that can be invoked within the script.

interface: Interface

The ABI interface for the script.

provider: Provider

The provider used for interacting with the network.

script: ScriptRequest<InputValue<void>[], Result<TOutput>>

The script request object.

Methods

  • Type Parameters

    Parameters

    • account: Account

      The account used to pay the deployment costs.

    Returns Promise<{
        blobId: string;
        waitForResult: (() => Promise<T>);
    }>

    The blobId and a waitForResult callback that returns the deployed predicate once the blob deployment transaction finishes.

    The returned loader script will have the same configurable constants as the original script which was used to generate the loader script.

  • Set the configurable constants of the script.

    Parameters

    • configurables: {
          [name: string]: unknown;
      }

      An object containing the configurable constants and their values.

      • [name: string]: unknown

    Returns Script<TInput, TOutput>

    This instance of the Script.

    Will throw an error if the script has no configurable constants to be set or if an invalid constant is provided.