@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. |
•
new FunctionInvocationScope<
TArgs
,
TReturn
>(
program
,
func
,
args
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
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
Icon Linkargs
• Protected
args: TArgs
•
Private
Optional
callParameters:
Partial
<{
forward
:
CoinQuantityLike
;
gasLimit
:
BigNumberish
}>
• Protected
externalAbis: Record
<string
, JsonAbi
> = {}
BaseInvocationScope.externalAbis
•
Private
Optional
forward:
CoinQuantity
Icon Linkfunc
• Protected
func: FunctionFragment
<JsonAbi
, string
>
•
Protected
functionInvocationScopes:
InvocationScopeLike
[] =
[]
BaseInvocationScope.functionInvocationScopes
• Protected
hasCallParamsGasLimit: boolean
= false
BaseInvocationScope.hasCallParamsGasLimit
• Protected
isMultiCall: boolean
= false
BaseInvocationScope.isMultiCall
• Protected
program: AbstractProgram
BaseInvocationScope.program
•
Protected
requiredCoins:
CoinQuantity
[] =
[]
BaseInvocationScope.requiredCoins
•
Protected
transactionRequest:
ScriptTransactionRequest
BaseInvocationScope.transactionRequest
• Protected
Optional
txParameters: Partial
<{ gasLimit
: BigNumberish
; gasPrice
: BigNumberish
; maturity?
: number
; maxFee?
: BigNumberish
; variableOutputs
: number
; witnessLimit?
: BigNumberish
}>
BaseInvocationScope.txParameters
•
get
calls():
ContractCall
[]
Getter for the contract calls.
An array of contract calls.
BaseInvocationScope.calls
▸
addCall(
funcScope
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
Adds a single call to the invocation scope.
The current instance of the class.
BaseInvocationScope.addCall
▸
addCalls(
funcScopes
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
Adds multiple calls to the invocation scope.
The current instance of the class.
BaseInvocationScope.addCalls
▸
addContracts(
contracts
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
Adds contracts to the invocation scope.
The current instance of the class.
BaseInvocationScope.addContracts
▸
addSigners(
signers
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
BaseInvocationScope.addSigners
▸
addTransfer(
destination
,
amount
,
assetId
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
Adds an asset transfer to an Account on the contract call transaction request.
Name | Type | Description |
---|
destination | string | AbstractAddress | The address of the destination. |
amount | BigNumberish | The amount of coins to transfer. |
assetId | string | The asset ID of the coins to transfer. |
The current instance of the class.
BaseInvocationScope.addTransfer
Icon Linkcall
▸
call<
T
>():
Promise
<
FunctionInvocationResult
<
T
,
void
>>
Submits a transaction.
The result of the function invocation.
BaseInvocationScope.call
▸
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. |
The instance of FunctionInvocationScope.
▸ checkGasLimitTotal(): void
Checks if the total gas limit is within the acceptable range.
void
BaseInvocationScope.checkGasLimitTotal
▸
dryRun<
T
>():
Promise
<
InvocationCallResult
<
T
>>
Executes a transaction in dry run mode.
The result of the invocation call.
BaseInvocationScope.dryRun
▸
fundWithRequiredCoins():
Promise
<
FunctionInvocationScope
<
TArgs
,
TReturn
>>
Funds the transaction with the required coins.
Promise
<
FunctionInvocationScope
<
TArgs
,
TReturn
>>
The current instance of the class.
BaseInvocationScope.fundWithRequiredCoins
Icon Linkget
▸
get<
T
>():
Promise
<
InvocationCallResult
<
T
>>
BaseInvocationScope.get
▸
getCallConfig():
CallConfig
<
TArgs
>
Gets the call configuration.
The call configuration.
▸
getProvider():
Provider
BaseInvocationScope.getProvider
▸
getRequiredCoins():
CoinQuantity
[]
Gets the required coins for the transaction.
An array of required coin quantities.
BaseInvocationScope.getRequiredCoins
▸
getTransactionCost(
options?
):
Promise
<
TransactionCost
>
Gets the transaction cost ny dry running the transaction.
Name | Type | Description |
---|
options? | Partial <{ fundTransaction : boolean ; gasPrice : BigNumberish }> | Optional transaction cost options. |
The transaction cost details.
BaseInvocationScope.getTransactionCost
▸ getTransactionId(chainId?
): Promise
<string
>
Obtains the ID of a transaction.
Name | Type | Description |
---|
chainId? | number | the chainId to use to hash the transaction with |
Promise
<string
>
the ID of the transaction.
BaseInvocationScope.getTransactionId
▸
getTransactionRequest():
Promise
<
ScriptTransactionRequest
>
Prepares and returns the transaction request object.
The prepared transaction request.
BaseInvocationScope.getTransactionRequest
▸ prepareTransaction(): Promise
<void
>
Prepares the transaction by updating the script request, required coins, and checking the gas limit.
Promise
<void
>
BaseInvocationScope.prepareTransaction
▸
setArguments(
...args
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
Sets the arguments for the function invocation.
Name | Type | Description |
---|
...args | TArgs | The arguments. |
The instance of FunctionInvocationScope.
▸
simulate<
T
>():
Promise
<
InvocationCallResult
<
T
>>
Simulates a transaction.
The result of the invocation call.
BaseInvocationScope.simulate
▸
txParams(
txParams
):
FunctionInvocationScope
<
TArgs
,
TReturn
>
Sets the transaction parameters.
Name | Type | Description |
---|
txParams | Partial <{ gasLimit : BigNumberish ; gasPrice : BigNumberish ; maturity? : number ; maxFee? : BigNumberish ; variableOutputs : number ; witnessLimit? : BigNumberish }> | The transaction parameters to set. |
The current instance of the class.
BaseInvocationScope.txParams
▸ updateContractInputAndOutput(): void
Updates the transaction request with the current input/output.
void
BaseInvocationScope.updateContractInputAndOutput
▸ updateRequiredCoins(): void
Updates the required coins for the transaction.
void
BaseInvocationScope.updateRequiredCoins
▸ updateScriptRequest(): void
Updates the script request with the current contract calls.
void
BaseInvocationScope.updateScriptRequest