@fuel-ts/program .FunctionInvocationScope
Represents a scope for invoking a function.
Name | Type | Description |
---|---|---|
TArgs | extends any [] = any [] | The type of the function arguments. |
TReturn | any | The type of the return value. |
BaseInvocationScope
<TReturn
>
↳ FunctionInvocationScope
• new FunctionInvocationScope<TArgs
, TReturn
>(program
, func
, args
)
Constructs an instance of FunctionInvocationScope.
Name | Type |
---|---|
TArgs | extends any [] = any [] |
TReturn | any |
Name | Type | Description |
---|---|---|
program | AbstractProgram | The program. |
func | FunctionFragment <JsonAbi , string > | The function fragment. |
args | TArgs | The arguments. |
BaseInvocationScope<TReturn>.constructor
packages/program/src/functions/invocation-scope.ts:33
• Private
#scriptDataOffset: number
= 0
BaseInvocationScope.#scriptDataOffset
packages/program/src/functions/base-invocation-scope.ts:54
• Protected
args: TArgs
packages/program/src/functions/invocation-scope.ts:24
• Private
Optional
callParameters: Partial
<{ forward
: CoinQuantityLike
; gasLimit
: BigNumberish
}>
packages/program/src/functions/invocation-scope.ts:22
• Private
Optional
forward: CoinQuantity
packages/program/src/functions/invocation-scope.ts:23
• Protected
func: FunctionFragment
<JsonAbi
, string
>
packages/program/src/functions/invocation-scope.ts:21
• Protected
functionInvocationScopes: InvocationScopeLike
[] = []
BaseInvocationScope.functionInvocationScopes
packages/program/src/functions/base-invocation-scope.ts:50
• Protected
isMultiCall: boolean
= false
BaseInvocationScope.isMultiCall
packages/program/src/functions/base-invocation-scope.ts:53
• Protected
program: AbstractProgram
BaseInvocationScope.program
packages/program/src/functions/base-invocation-scope.ts:49
• Protected
requiredCoins: CoinQuantity
[] = []
BaseInvocationScope.requiredCoins
packages/program/src/functions/base-invocation-scope.ts:52
• transactionRequest: ScriptTransactionRequest
BaseInvocationScope.transactionRequest
packages/program/src/functions/base-invocation-scope.ts:48
• Protected
Optional
txParameters: Partial
<{ gasLimit
: BigNumberish
; gasPrice
: BigNumberish
; variableOutputs
: number
}>
BaseInvocationScope.txParameters
packages/program/src/functions/base-invocation-scope.ts:51
• Protected
get
calls(): ContractCall
[]
Getter for the contract calls.
ContractCall
[]
An array of contract calls.
BaseInvocationScope.calls
packages/program/src/functions/base-invocation-scope.ts:75
▸ Protected
addCall(funcScope
): FunctionInvocationScope
<TArgs
, TReturn
>
Adds a single call to the invocation scope.
Name | Type | Description |
---|---|---|
funcScope | InvocationScopeLike | The function scope to add. |
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addCall
packages/program/src/functions/base-invocation-scope.ts:139
▸ Protected
addCalls(funcScopes
): FunctionInvocationScope
<TArgs
, TReturn
>
Adds multiple calls to the invocation scope.
Name | Type | Description |
---|---|---|
funcScopes | InvocationScopeLike [] | An array of function scopes to add. |
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addCalls
packages/program/src/functions/base-invocation-scope.ts:150
▸ addContracts(contracts
): FunctionInvocationScope
<TArgs
, TReturn
>
Adds contracts to the invocation scope.
Name | Type | Description |
---|---|---|
contracts | AbstractContract [] | An array of contracts to add. |
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addContracts
packages/program/src/functions/base-invocation-scope.ts:244
▸ call<T
>(): Promise
<FunctionInvocationResult
<T
, void
>>
Submits a transaction.
Name | Type |
---|---|
T | TReturn |
Promise
<FunctionInvocationResult
<T
, void
>>
The result of the function invocation.
BaseInvocationScope.call
packages/program/src/functions/base-invocation-scope.ts:267
▸ callParams(callParams
): FunctionInvocationScope
<TArgs
, TReturn
>
Sets the call parameters for the function invocation.
Throws
If the function is not payable and forward is set.
Name | Type | Description |
---|---|---|
callParams | Partial <{ forward : CoinQuantityLike ; gasLimit : BigNumberish }> | The call parameters. |
FunctionInvocationScope
<TArgs
, TReturn
>
The instance of FunctionInvocationScope.
packages/program/src/functions/invocation-scope.ts:76
▸ Protected
checkGasLimitTotal(): void
Checks if the total gas limit is within the acceptable range.
void
BaseInvocationScope.checkGasLimitTotal
packages/program/src/functions/base-invocation-scope.ts:179
▸ dryRun<T
>(): Promise
<InvocationCallResult
<T
>>
Executes a transaction in dry run mode.
Name | Type |
---|---|
T | TReturn |
Promise
<InvocationCallResult
<T
>>
The result of the invocation call.
BaseInvocationScope.dryRun
packages/program/src/functions/base-invocation-scope.ts:313
▸ fundWithRequiredCoins(): Promise
<FunctionInvocationScope
<TArgs
, TReturn
>>
Funds the transaction with the required coins.
Promise
<FunctionInvocationScope
<TArgs
, TReturn
>>
The current instance of the class.
BaseInvocationScope.fundWithRequiredCoins
packages/program/src/functions/base-invocation-scope.ts:211
▸ getCallConfig(): CallConfig
<TArgs
>
Gets the call configuration.
CallConfig
<TArgs
>
The call configuration.
packages/program/src/functions/invocation-scope.ts:46
▸ Protected
getRequiredCoins(): CoinQuantity
[]
Gets the required coins for the transaction.
CoinQuantity
[]
An array of required coin quantities.
BaseInvocationScope.getRequiredCoins
packages/program/src/functions/base-invocation-scope.ts:101
▸ getTransactionCost(options?
): Promise
<TransactionCost
>
Gets the transaction cost ny dry running the transaction.
Name | Type | Description |
---|---|---|
options? | Partial <{ fundTransaction : boolean ; gasPrice : BigNumberish ; tolerance : number }> | Optional transaction cost options. |
Promise
<TransactionCost
>
The transaction cost details.
BaseInvocationScope.getTransactionCost
packages/program/src/functions/base-invocation-scope.ts:194
▸ getTransactionRequest(): Promise
<TransactionRequest
>
Prepares and returns the transaction request object.
Promise
<TransactionRequest
>
The prepared transaction request.
BaseInvocationScope.getTransactionRequest
packages/program/src/functions/base-invocation-scope.ts:257
▸ Protected
prepareTransaction(): Promise
<void
>
Prepares the transaction by updating the script request, required coins, and checking the gas limit.
Promise
<void
>
BaseInvocationScope.prepareTransaction
packages/program/src/functions/base-invocation-scope.ts:160
▸ setArguments(...args
): FunctionInvocationScope
<TArgs
, TReturn
>
Sets the arguments for the function invocation.
Name | Type | Description |
---|---|---|
...args | TArgs | The arguments. |
FunctionInvocationScope
<TArgs
, TReturn
>
The instance of FunctionInvocationScope.
packages/program/src/functions/invocation-scope.ts:63
▸ simulate<T
>(): Promise
<InvocationCallResult
<T
>>
Simulates a transaction.
Name | Type |
---|---|
T | TReturn |
Promise
<InvocationCallResult
<T
>>
The result of the invocation call.
BaseInvocationScope.simulate
packages/program/src/functions/base-invocation-scope.ts:286
▸ txParams(txParams
): FunctionInvocationScope
<TArgs
, TReturn
>
Sets the transaction parameters.
Name | Type | Description |
---|---|---|
txParams | Partial <{ gasLimit : BigNumberish ; gasPrice : BigNumberish ; variableOutputs : number }> | The transaction parameters to set. |
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.txParams
packages/program/src/functions/base-invocation-scope.ts:227
▸ Protected
updateRequiredCoins(): void
Updates the required coins for the transaction.
void
BaseInvocationScope.updateRequiredCoins
packages/program/src/functions/base-invocation-scope.ts:115
▸ Protected
updateScriptRequest(): void
Updates the script request with the current contract calls.
void
BaseInvocationScope.updateScriptRequest
Was this page helpful?