@fuel-ts/program v0.95.0 • Docs
ScriptRequest
provides functionality to encode and decode script data and results.
• TData = void
Type of the script data.
• TResult = void
Type of the script result.
new ScriptRequest<
TData
,TResult
>(bytes
,scriptDataEncoder
,scriptResultDecoder
):ScriptRequest
<TData
,TResult
>
Creates an instance of the ScriptRequest class.
• bytes: BytesLike
The bytes of the script.
• scriptDataEncoder
The script data encoder function.
• scriptResultDecoder
The script result decoder function.
ScriptRequest
<TData
, TResult
>
bytes:
Uint8Array
The bytes of the script.
scriptDataEncoder: (
data
) =>EncodedScriptCall
A function to encode the script data.
• data: TData
EncodedScriptCall
scriptResultDecoder: (
scriptResult
) =>TResult
A function to decode the script result.
• scriptResult: ScriptResult
TResult
decodeCallResult(
callResult
,logs
):TResult
Decodes the result of a script call.
• callResult: CallResult
The CallResult from the script call.
• logs: any
[] = []
Optional logs associated with the decoding.
TResult
The decoded result.
encodeScriptData(
data
):Uint8Array
Encodes the data for a script call.
• data: TData
The script data.
Uint8Array
The encoded data.
getScriptDataOffset(
maxInputs
):number
Gets the script data offset.
• maxInputs: number
The maxInputs value from the chain's consensus params.
number
The script data offset.
static
getScriptDataOffsetWithScriptBytes(byteLength
,maxInputs
):number
Gets the script data offset for the given bytes.
• byteLength: number
The byte length of the script.
• maxInputs: number
The maxInputs value from the chain's consensus params.
number
The script data offset.