@fuel-ts/program v0.96.1 • Docs
Represents a scope for invoking a function.
BaseInvocationScope
<TReturn
> • 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.
• program: AbstractProgram
The program.
• func: FunctionFragment
The function fragment.
• args: TArgs
The arguments.
FunctionInvocationScope
<TArgs
, TReturn
>
BaseInvocationScope<TReturn>.constructor
functions/invocation-scope.ts:34
protected
args:TArgs
functions/invocation-scope.ts:25
protected
externalAbis:Record
<string
,JsonAbi
> ={}
BaseInvocationScope.externalAbis
functions/base-invocation-scope.ts:67
protected
func:FunctionFragment
functions/invocation-scope.ts:22
protected
functionInvocationScopes:InvocationScopeLike
[] =[]
BaseInvocationScope.functionInvocationScopes
functions/base-invocation-scope.ts:62
protected
hasCallParamsGasLimit:boolean
=false
BaseInvocationScope.hasCallParamsGasLimit
functions/base-invocation-scope.ts:66
protected
isMultiCall:boolean
=false
BaseInvocationScope.isMultiCall
functions/base-invocation-scope.ts:65
protected
program:AbstractProgram
BaseInvocationScope.program
functions/base-invocation-scope.ts:61
protected
requiredCoins:CoinQuantity
[] =[]
BaseInvocationScope.requiredCoins
functions/base-invocation-scope.ts:64
protected
transactionRequest:ScriptTransactionRequest
BaseInvocationScope.transactionRequest
functions/base-invocation-scope.ts:60
protected
optional
txParameters:Partial
<object
>
gasLimit:
BigNumberish
optional
maturity:number
optional
maxFee:BigNumberish
tip:
BigNumberish
variableOutputs:
number
optional
witnessLimit:BigNumberish
BaseInvocationScope.txParameters
functions/base-invocation-scope.ts:63
get
protected
calls():ContractCall
[]
Getter for the contract calls.
ContractCall
[]
An array of contract calls.
BaseInvocationScope.calls
functions/base-invocation-scope.ts:89
addBatchTransfer(
transferParams
):FunctionInvocationScope
<TArgs
,TReturn
>
Adds multiple transfers to the contract call transaction request.
• transferParams: TransferParams
[]
An array of TransferParams
objects representing the transfers to be made.
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addBatchTransfer
functions/base-invocation-scope.ts:337
protected
addCall(funcScope
):FunctionInvocationScope
<TArgs
,TReturn
>
Adds a single call to the invocation scope.
• funcScope: InvocationScopeLike
The function scope to add.
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addCall
functions/base-invocation-scope.ts:175
protected
addCalls(funcScopes
):FunctionInvocationScope
<TArgs
,TReturn
>
Adds multiple calls to the invocation scope.
• funcScopes: InvocationScopeLike
[]
An array of function scopes to add.
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addCalls
functions/base-invocation-scope.ts:186
addContracts(
contracts
):FunctionInvocationScope
<TArgs
,TReturn
>
Adds contracts to the invocation scope.
• contracts: AbstractContract
[]
An array of contracts to add.
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addContracts
functions/base-invocation-scope.ts:305
addSigners(
signers
):FunctionInvocationScope
<TArgs
,TReturn
>
• signers: Account
| Account
[]
FunctionInvocationScope
<TArgs
, TReturn
>
BaseInvocationScope.addSigners
functions/base-invocation-scope.ts:350
addTransfer(
transferParams
):FunctionInvocationScope
<TArgs
,TReturn
>
Adds an asset transfer to an Account on the contract call transaction request.
• transferParams: TransferParams
The object representing the transfer to be made.
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.addTransfer
functions/base-invocation-scope.ts:319
call<
T
>():Promise
<object
>
Submits the contract call transaction and returns a promise that resolves to an object containing the transaction ID and a function to wait for the result. The promise will resolve as soon as the transaction is submitted to the node.
• T = TReturn
The type of the return value.
Promise
<object
>
A promise that resolves to an object containing:
transactionId
: The ID of the submitted transaction. waitForResult
: A function that waits for the transaction result. transactionId:
string
waitForResult: () =>
Promise
<FunctionResult
<T
>>
Promise
<FunctionResult
<T
>>
BaseInvocationScope.call
functions/base-invocation-scope.ts:377
callParams(
callParams
):FunctionInvocationScope
<TArgs
,TReturn
>
Sets the call parameters for the function invocation.
• callParams: Partial
<object
>
The call parameters.
FunctionInvocationScope
<TArgs
, TReturn
>
The instance of FunctionInvocationScope.
If the function is not payable and forward is set.
functions/invocation-scope.ts:77
protected
checkGasLimitTotal():void
Checks if the total gas limit is within the acceptable range.
void
BaseInvocationScope.checkGasLimitTotal
functions/base-invocation-scope.ts:218
dryRun<
T
>():Promise
<DryRunResult
<T
>>
Executes a transaction in dry run mode.
• T = TReturn
Promise
<DryRunResult
<T
>>
The result of the invocation call.
BaseInvocationScope.dryRun
functions/base-invocation-scope.ts:435
fundWithRequiredCoins():
Promise
<ScriptTransactionRequest
>
Funds the transaction with the required coins.
Promise
<ScriptTransactionRequest
>
The current instance of the class.
BaseInvocationScope.fundWithRequiredCoins
functions/base-invocation-scope.ts:252
get<
T
>():Promise
<DryRunResult
<T
>>
• T = TReturn
Promise
<DryRunResult
<T
>>
BaseInvocationScope.get
functions/base-invocation-scope.ts:449
getCallConfig():
CallConfig
<TArgs
>
Gets the call configuration.
CallConfig
<TArgs
>
The call configuration.
functions/invocation-scope.ts:47
getProvider():
Provider
BaseInvocationScope.getProvider
functions/base-invocation-scope.ts:463
protected
getRequiredCoins():CoinQuantity
[]
Gets the required coins for the transaction.
CoinQuantity
[]
An array of required coin quantities.
BaseInvocationScope.getRequiredCoins
functions/base-invocation-scope.ts:138
getTransactionCost():
Promise
<TransactionCost
>
Gets the transaction cost for dry running the transaction.
Promise
<TransactionCost
>
The transaction cost details.
BaseInvocationScope.getTransactionCost
functions/base-invocation-scope.ts:237
getTransactionId(
chainId
?):Promise
<string
>
Obtains the ID of a transaction.
• chainId?: number
the chainId to use to hash the transaction with
Promise
<string
>
the ID of the transaction.
BaseInvocationScope.getTransactionId
functions/base-invocation-scope.ts:475
getTransactionRequest():
Promise
<ScriptTransactionRequest
>
Prepares and returns the transaction request object.
Promise
<ScriptTransactionRequest
>
The prepared transaction request.
BaseInvocationScope.getTransactionRequest
functions/base-invocation-scope.ts:362
protected
prepareTransaction():Promise
<void
>
Prepares the transaction by updating the script request, required coins, and checking the gas limit.
Promise
<void
>
BaseInvocationScope.prepareTransaction
functions/base-invocation-scope.ts:196
setArguments(...
args
):FunctionInvocationScope
<TArgs
,TReturn
>
Sets the arguments for the function invocation.
• ...args: TArgs
The arguments.
FunctionInvocationScope
<TArgs
, TReturn
>
The instance of FunctionInvocationScope.
functions/invocation-scope.ts:65
simulate<
T
>():Promise
<DryRunResult
<T
>>
Simulates a transaction.
• T = TReturn
Promise
<DryRunResult
<T
>>
The result of the invocation call.
BaseInvocationScope.simulate
functions/base-invocation-scope.ts:408
txParams(
txParams
):FunctionInvocationScope
<TArgs
,TReturn
>
Sets the transaction parameters.
• txParams: Partial
<object
>
The transaction parameters to set.
FunctionInvocationScope
<TArgs
, TReturn
>
The current instance of the class.
BaseInvocationScope.txParams
functions/base-invocation-scope.ts:284
protected
updateContractInputAndOutput():void
Updates the transaction request with the current input/output.
void
BaseInvocationScope.updateContractInputAndOutput
functions/base-invocation-scope.ts:119
protected
updateRequiredCoins():void
Updates the required coins for the transaction.
void
BaseInvocationScope.updateRequiredCoins
functions/base-invocation-scope.ts:151
protected
updateScriptRequest():void
Updates the script request with the current contract calls.
void
BaseInvocationScope.updateScriptRequest