@fuel-ts/program.ScriptRequest
ScriptRequest
provides functionality to encode and decode script data and results.
Name | Type | Description |
---|---|---|
TData | void | Type of the script data. |
TResult | void | Type of the script result. |
• new ScriptRequest<TData
, TResult
>(bytes
, scriptDataEncoder
, scriptResultDecoder
)
Creates an instance of the ScriptRequest class.
Name | Type |
---|---|
TData | void |
TResult | void |
Name | Type | Description |
---|---|---|
bytes | BytesLike | The bytes of the script. |
scriptDataEncoder | (data : TData ) => EncodedScriptCall | The script data encoder function. |
scriptResultDecoder | (scriptResult : ScriptResult ) => TResult | The script result decoder function. |
packages/program/src/script-request.ts:206
• bytes: Uint8Array
The bytes of the script.
packages/program/src/script-request.ts:187
• scriptDataEncoder: (data
: TData
) => EncodedScriptCall
▸ (data
): EncodedScriptCall
A function to encode the script data.
Name | Type |
---|---|
data | TData |
EncodedScriptCall
packages/program/src/script-request.ts:192
• scriptResultDecoder: (scriptResult
: ScriptResult
) => TResult
▸ (scriptResult
): TResult
A function to decode the script result.
Name | Type |
---|---|
scriptResult | ScriptResult |
TResult
packages/program/src/script-request.ts:197
▸ decodeCallResult(callResult
, logs?
): TResult
Decodes the result of a script call.
Name | Type | Default value | Description |
---|---|---|---|
callResult | CallResult | undefined | The CallResult from the script call. |
logs | any [] | [] | Optional logs associated with the decoding. |
TResult
The decoded result.
packages/program/src/script-request.ts:260
▸ encodeScriptData(data
): Uint8Array
Encodes the data for a script call.
Name | Type | Description |
---|---|---|
data | TData | The script data. |
Uint8Array
The encoded data.
packages/program/src/script-request.ts:241
▸ getScriptDataOffset(): number
Gets the script data offset.
number
The script data offset.
packages/program/src/script-request.ts:231
▸ Static
getScriptDataOffsetWithScriptBytes(byteLength
): number
Gets the script data offset for the given bytes.
Name | Type |
---|---|
byteLength | number |
number
The script data offset.