Icon LinkClass: ScriptRequest<TData, TResult>

@fuel-ts/program.ScriptRequest

ScriptRequest provides functionality to encode and decode script data and results.

Icon LinkType parameters

NameTypeDescription
TDatavoidType of the script data.
TResultvoidType of the script result.

Icon LinkConstructors

Icon Linkconstructor

new ScriptRequest<TData, TResult>(bytes, scriptDataEncoder, scriptResultDecoder)

Creates an instance of the ScriptRequest class.

Icon LinkType parameters

NameType
TDatavoid
TResultvoid

Icon LinkParameters

NameTypeDescription
bytesBytesLikeThe bytes of the script.
scriptDataEncoder(data: TData) => EncodedScriptCallThe script data encoder function.
scriptResultDecoder(scriptResult: ScriptResult) => TResultThe script result decoder function.

Icon LinkDefined in

packages/program/src/script-request.ts:206 Icon Link

Icon LinkProperties

Icon Linkbytes

bytes: Uint8Array

The bytes of the script.

Icon LinkDefined in

packages/program/src/script-request.ts:187 Icon Link


Icon LinkscriptDataEncoder

scriptDataEncoder: (data: TData) => EncodedScriptCall

Icon LinkType declaration

▸ (data): EncodedScriptCall

A function to encode the script data.

Icon LinkParameters
NameType
dataTData
Icon LinkReturns

EncodedScriptCall

Icon LinkDefined in

packages/program/src/script-request.ts:192 Icon Link


Icon LinkscriptResultDecoder

scriptResultDecoder: (scriptResult: ScriptResult) => TResult

Icon LinkType declaration

▸ (scriptResult): TResult

A function to decode the script result.

Icon LinkParameters
NameType
scriptResultScriptResult
Icon LinkReturns

TResult

Icon LinkDefined in

packages/program/src/script-request.ts:197 Icon Link

Icon LinkMethods

Icon LinkdecodeCallResult

decodeCallResult(callResult, logs?): TResult

Decodes the result of a script call.

Icon LinkParameters

NameTypeDefault valueDescription
callResultCallResultundefinedThe CallResult from the script call.
logsany[][]Optional logs associated with the decoding.

Icon LinkReturns

TResult

The decoded result.

Icon LinkDefined in

packages/program/src/script-request.ts:260 Icon Link


Icon LinkencodeScriptData

encodeScriptData(data): Uint8Array

Encodes the data for a script call.

Icon LinkParameters

NameTypeDescription
dataTDataThe script data.

Icon LinkReturns

Uint8Array

The encoded data.

Icon LinkDefined in

packages/program/src/script-request.ts:241 Icon Link


Icon LinkgetScriptDataOffset

getScriptDataOffset(): number

Gets the script data offset.

Icon LinkReturns

number

The script data offset.

Icon LinkDefined in

packages/program/src/script-request.ts:231 Icon Link


Icon LinkgetScriptDataOffsetWithScriptBytes

Static getScriptDataOffsetWithScriptBytes(byteLength): number

Gets the script data offset for the given bytes.

Icon LinkParameters

NameType
byteLengthnumber

Icon LinkReturns

number

The script data offset.

Icon LinkDefined in

packages/program/src/script-request.ts:222 Icon Link