@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
): ScriptRequest
<TData
, TResult
>
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. |
ScriptRequest
<TData
, TResult
>
packages/program/src/script-request.ts:209
• bytes: Uint8Array
The bytes of the script.
packages/program/src/script-request.ts:190
• scriptDataEncoder: (data
: TData
) => EncodedScriptCall
▸ (data
): EncodedScriptCall
A function to encode the script data.
Name | Type |
---|---|
data | TData |
EncodedScriptCall
packages/program/src/script-request.ts:195
• scriptResultDecoder: (scriptResult
: ScriptResult
) => TResult
▸ (scriptResult
): TResult
A function to decode the script result.
Name | Type |
---|---|
scriptResult | ScriptResult |
TResult
packages/program/src/script-request.ts:200
▸ 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:266
▸ 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:247
▸ getScriptDataOffset(maxInputs
): number
Gets the script data offset.
Name | Type | Description |
---|---|---|
maxInputs | number | The maxInputs value from the chain's consensus params. |
number
The script data offset.
packages/program/src/script-request.ts:237
▸ getScriptDataOffsetWithScriptBytes(byteLength
, maxInputs
): number
Gets the script data offset for the given bytes.
Name | Type | Description |
---|---|---|
byteLength | number | The byte length of the script. |
maxInputs | number | The maxInputs value from the chain's consensus params. |
number
The script data offset.