Skip to content

@fuel-ts/script v0.96.1Docs


Class: Script<TInput, TOutput>

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

Extends

  • AbstractScript

Type Parameters

TInput extends any[]

TOutput

Constructors

new Script()

new Script<TInput, TOutput>(bytecode, abi, account): Script<TInput, TOutput>

Create a new instance of the Script class.

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>

Overrides

AbstractScript.constructor

Defined in

script/src/script.ts:70

Properties

account

account: Account

The account associated with the script.

Overrides

AbstractScript.account

Defined in

script/src/script.ts:46


bytes

bytes: Uint8Array

The compiled bytecode of the script.

Overrides

AbstractScript.bytes

Defined in

script/src/script.ts:36


functions

functions: object

Functions that can be invoked within the script.

main

main: InvokeMain<TInput, TOutput>

Defined in

script/src/script.ts:61


interface

interface: Interface

The ABI interface for the script.

Overrides

AbstractScript.interface

Defined in

script/src/script.ts:41


provider

provider: Provider

The provider used for interacting with the network.

Overrides

AbstractScript.provider

Defined in

script/src/script.ts:56


script

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

The script request object.

Defined in

script/src/script.ts:51

Methods

deploy()

deploy<T>(account): Promise<object>

Type Parameters

T = Script<TInput, TOutput>

Parameters

account: Account

The account used to pay the deployment costs.

Returns

Promise<object>

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.

blobId

blobId: string

waitForResult()

waitForResult: () => Promise<T>

Returns

Promise<T>

Defined in

script/src/script.ts:133


setConfigurableConstants()

setConfigurableConstants(configurables): Script<TInput, TOutput>

Set the configurable constants of the script.

Parameters

configurables

An object containing the configurable constants and their values.

Returns

Script<TInput, TOutput>

This instance of the Script.

Throws

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

Defined in

script/src/script.ts:91