Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
ScriptRequest

@fuel-ts/program v0.94.2 Docs


Icon LinkClass: ScriptRequest<TData, TResult>

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

Icon LinkType Parameters

TData = void

Type of the script data.

TResult = void

Type of the script result.

Icon LinkConstructors

Icon Linknew ScriptRequest()

Icon InfoCircle

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

Creates an instance of the ScriptRequest class.

Icon LinkParameters

bytes: BytesLike

The bytes of the script.

scriptDataEncoder

The script data encoder function.

scriptResultDecoder

The script result decoder function.

Icon LinkReturns

ScriptRequest <TData, TResult>

Icon LinkDefined in

script-request.ts:205 Icon Link

Icon LinkProperties

Icon Linkbytes

Icon InfoCircle

bytes: Uint8Array

The bytes of the script.

Icon LinkDefined in

script-request.ts:186 Icon Link


Icon LinkscriptDataEncoder()

Icon InfoCircle

scriptDataEncoder: (data) => EncodedScriptCall

A function to encode the script data.

Icon LinkParameters

data: TData

Icon LinkReturns

EncodedScriptCall

Icon LinkDefined in

script-request.ts:191 Icon Link


Icon LinkscriptResultDecoder()

Icon InfoCircle

scriptResultDecoder: (scriptResult) => TResult

A function to decode the script result.

Icon LinkParameters

scriptResult: ScriptResult

Icon LinkReturns

TResult

Icon LinkDefined in

script-request.ts:196 Icon Link

Icon LinkMethods

Icon LinkdecodeCallResult()

Icon InfoCircle

decodeCallResult(callResult, logs): TResult

Decodes the result of a script call.

Icon LinkParameters

callResult: CallResult

The CallResult from the script call.

logs: any[] = []

Optional logs associated with the decoding.

Icon LinkReturns

TResult

The decoded result.

Icon LinkDefined in

script-request.ts:262 Icon Link


Icon LinkencodeScriptData()

Icon InfoCircle

encodeScriptData(data): Uint8Array

Encodes the data for a script call.

Icon LinkParameters

data: TData

The script data.

Icon LinkReturns

Uint8Array

The encoded data.

Icon LinkDefined in

script-request.ts:243 Icon Link


Icon LinkgetScriptDataOffset()

Icon InfoCircle

getScriptDataOffset(maxInputs): number

Gets the script data offset.

Icon LinkParameters

maxInputs: number

The maxInputs value from the chain's consensus params.

Icon LinkReturns

number

The script data offset.

Icon LinkDefined in

script-request.ts:233 Icon Link


Icon LinkgetScriptDataOffsetWithScriptBytes()

Icon InfoCircle

static getScriptDataOffsetWithScriptBytes(byteLength, maxInputs): number

Gets the script data offset for the given bytes.

Icon LinkParameters

byteLength: number

The byte length of the script.

maxInputs: number

The maxInputs value from the chain's consensus params.

Icon LinkReturns

number

The script data offset.

Icon LinkDefined in

script-request.ts:222 Icon Link