⌘K

Icon SunFilledIcon MoonStars
ScriptRequest

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): ScriptRequest <TData, TResult>

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 LinkReturns

ScriptRequest <TData, TResult>

Icon LinkDefined in

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

Icon LinkProperties

Icon Linkbytes

bytes: Uint8Array

The bytes of the script.

Icon LinkDefined in

packages/program/src/script-request.ts:190 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:195 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:200 Icon Link

Icon LinkMethods

Icon LinkdecodeCallResult

decodeCallResult(callResult, logs?): TResult

Decodes the result of a script call.

Icon LinkParameters

NameTypeDefault valueDescription
callResultCallResult undefinedThe 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:266 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:247 Icon Link


Icon LinkgetScriptDataOffset

getScriptDataOffset(maxInputs): number

Gets the script data offset.

Icon LinkParameters

NameTypeDescription
maxInputsnumberThe maxInputs value from the chain's consensus params.

Icon LinkReturns

number

The script data offset.

Icon LinkDefined in

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


Icon LinkgetScriptDataOffsetWithScriptBytes

getScriptDataOffsetWithScriptBytes(byteLength, maxInputs): number

Gets the script data offset for the given bytes.

Icon LinkParameters

NameTypeDescription
byteLengthnumberThe byte length of the script.
maxInputsnumberThe maxInputs value from the chain's consensus params.

Icon LinkReturns

number

The script data offset.

Icon LinkDefined in

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