Skip to content

Class: FunctionInvocationScope<TArgs, TReturn>

@fuel-ts/program.FunctionInvocationScope

Represents a scope for invoking a function.

Type parameters

NameTypeDescription
TArgsextends any[] = any[]The type of the function arguments.
TReturnanyThe type of the return value.

Hierarchy

  • BaseInvocationScope<TReturn>

    FunctionInvocationScope

Constructors

constructor

new FunctionInvocationScope<TArgs, TReturn>(program, func, args): FunctionInvocationScope<TArgs, TReturn>

Constructs an instance of FunctionInvocationScope.

Type parameters

NameType
TArgsextends any[] = any[]
TReturnany

Parameters

NameTypeDescription
programAbstractProgramThe program.
funcFunctionFragment<JsonAbi, string>The function fragment.
argsTArgsThe arguments.

Returns

FunctionInvocationScope<TArgs, TReturn>

Overrides

BaseInvocationScope<TReturn&gt;.constructor

Defined in

functions/invocation-scope.ts:34

Properties

args

Protected args: TArgs

Defined in

functions/invocation-scope.ts:25


callParameters

Private Optional callParameters: Partial<{ forward: CoinQuantityLike ; gasLimit: BigNumberish }>

Defined in

functions/invocation-scope.ts:23


externalAbis

Protected externalAbis: Record<string, JsonAbi> = {}

Inherited from

BaseInvocationScope.externalAbis

Defined in

functions/base-invocation-scope.ts:65


forward

Private Optional forward: CoinQuantity

Defined in

functions/invocation-scope.ts:24


func

Protected func: FunctionFragment<JsonAbi, string>

Defined in

functions/invocation-scope.ts:22


functionInvocationScopes

Protected functionInvocationScopes: InvocationScopeLike[] = []

Inherited from

BaseInvocationScope.functionInvocationScopes

Defined in

functions/base-invocation-scope.ts:60


hasCallParamsGasLimit

Protected hasCallParamsGasLimit: boolean = false

Inherited from

BaseInvocationScope.hasCallParamsGasLimit

Defined in

functions/base-invocation-scope.ts:64


isMultiCall

Protected isMultiCall: boolean = false

Inherited from

BaseInvocationScope.isMultiCall

Defined in

functions/base-invocation-scope.ts:63


program

Protected program: AbstractProgram

Inherited from

BaseInvocationScope.program

Defined in

functions/base-invocation-scope.ts:59


requiredCoins

Protected requiredCoins: CoinQuantity[] = []

Inherited from

BaseInvocationScope.requiredCoins

Defined in

functions/base-invocation-scope.ts:62


transactionRequest

Protected transactionRequest: ScriptTransactionRequest

Inherited from

BaseInvocationScope.transactionRequest

Defined in

functions/base-invocation-scope.ts:58


txParameters

Protected Optional txParameters: Partial<{ gasLimit: BigNumberish ; gasPrice: BigNumberish ; maturity?: number ; maxFee?: BigNumberish ; variableOutputs: number ; witnessLimit?: BigNumberish }>

Inherited from

BaseInvocationScope.txParameters

Defined in

functions/base-invocation-scope.ts:61

Accessors

calls

get calls(): ContractCall[]

Getter for the contract calls.

Returns

ContractCall[]

An array of contract calls.

Inherited from

BaseInvocationScope.calls

Defined in

functions/base-invocation-scope.ts:88

Methods

addCall

addCall(funcScope): FunctionInvocationScope<TArgs, TReturn>

Adds a single call to the invocation scope.

Parameters

NameTypeDescription
funcScopeInvocationScopeLikeThe function scope to add.

Returns

FunctionInvocationScope<TArgs, TReturn>

The current instance of the class.

Inherited from

BaseInvocationScope.addCall

Defined in

functions/base-invocation-scope.ts:167


addCalls

addCalls(funcScopes): FunctionInvocationScope<TArgs, TReturn>

Adds multiple calls to the invocation scope.

Parameters

NameTypeDescription
funcScopesInvocationScopeLike[]An array of function scopes to add.

Returns

FunctionInvocationScope<TArgs, TReturn>

The current instance of the class.

Inherited from

BaseInvocationScope.addCalls

Defined in

functions/base-invocation-scope.ts:178


addContracts

addContracts(contracts): FunctionInvocationScope<TArgs, TReturn>

Adds contracts to the invocation scope.

Parameters

NameTypeDescription
contractsAbstractContract[]An array of contracts to add.

Returns

FunctionInvocationScope<TArgs, TReturn>

The current instance of the class.

Inherited from

BaseInvocationScope.addContracts

Defined in

functions/base-invocation-scope.ts:315


addSigners

addSigners(signers): FunctionInvocationScope<TArgs, TReturn>

Parameters

NameType
signersAccount | Account[]

Returns

FunctionInvocationScope<TArgs, TReturn>

Inherited from

BaseInvocationScope.addSigners

Defined in

functions/base-invocation-scope.ts:341


addTransfer

addTransfer(destination, amount, assetId): FunctionInvocationScope<TArgs, TReturn>

Adds an asset transfer to an Account on the contract call transaction request.

Parameters

NameTypeDescription
destinationstring | AbstractAddressThe address of the destination.
amountBigNumberishThe amount of coins to transfer.
assetIdstringThe asset ID of the coins to transfer.

Returns

FunctionInvocationScope<TArgs, TReturn>

The current instance of the class.

Inherited from

BaseInvocationScope.addTransfer

Defined in

functions/base-invocation-scope.ts:331


call

call<T>(): Promise<FunctionInvocationResult<T, void>>

Submits a transaction.

Type parameters

NameType
TTReturn

Returns

Promise<FunctionInvocationResult<T, void>>

The result of the function invocation.

Inherited from

BaseInvocationScope.call

Defined in

functions/base-invocation-scope.ts:363


callParams

callParams(callParams): FunctionInvocationScope<TArgs, TReturn>

Sets the call parameters for the function invocation.

Throws

If the function is not payable and forward is set.

Parameters

NameTypeDescription
callParamsPartial<{ forward: CoinQuantityLike ; gasLimit: BigNumberish }>The call parameters.

Returns

FunctionInvocationScope<TArgs, TReturn>

The instance of FunctionInvocationScope.

Defined in

functions/invocation-scope.ts:77


checkGasLimitTotal

checkGasLimitTotal(): void

Checks if the total gas limit is within the acceptable range.

Returns

void

Inherited from

BaseInvocationScope.checkGasLimitTotal

Defined in

functions/base-invocation-scope.ts:210


dryRun

dryRun<T>(): Promise<InvocationCallResult<T>>

Executes a transaction in dry run mode.

Type parameters

NameType
TTReturn

Returns

Promise<InvocationCallResult<T>>

The result of the invocation call.

Inherited from

BaseInvocationScope.dryRun

Defined in

functions/base-invocation-scope.ts:416


fundWithRequiredCoins

fundWithRequiredCoins(): Promise<FunctionInvocationScope<TArgs, TReturn>>

Funds the transaction with the required coins.

Returns

Promise<FunctionInvocationScope<TArgs, TReturn>>

The current instance of the class.

Inherited from

BaseInvocationScope.fundWithRequiredCoins

Defined in

functions/base-invocation-scope.ts:247


get

get<T>(): Promise<InvocationCallResult<T>>

Type parameters

NameType
TTReturn

Returns

Promise<InvocationCallResult<T>>

Inherited from

BaseInvocationScope.get

Defined in

functions/base-invocation-scope.ts:430


getCallConfig

getCallConfig(): CallConfig<TArgs>

Gets the call configuration.

Returns

CallConfig<TArgs>

The call configuration.

Defined in

functions/invocation-scope.ts:47


getProvider

getProvider(): Provider

Returns

Provider

Inherited from

BaseInvocationScope.getProvider

Defined in

functions/base-invocation-scope.ts:444


getRequiredCoins

getRequiredCoins(): CoinQuantity[]

Gets the required coins for the transaction.

Returns

CoinQuantity[]

An array of required coin quantities.

Inherited from

BaseInvocationScope.getRequiredCoins

Defined in

functions/base-invocation-scope.ts:130


getTransactionCost

getTransactionCost(options?): Promise<TransactionCost>

Gets the transaction cost ny dry running the transaction.

Parameters

NameTypeDescription
options?Partial<{ fundTransaction: boolean ; gasPrice: BigNumberish }>Optional transaction cost options.

Returns

Promise<TransactionCost>

The transaction cost details.

Inherited from

BaseInvocationScope.getTransactionCost

Defined in

functions/base-invocation-scope.ts:229


getTransactionId

getTransactionId(chainId?): Promise<string>

Obtains the ID of a transaction.

Parameters

NameTypeDescription
chainId?numberthe chainId to use to hash the transaction with

Returns

Promise<string>

the ID of the transaction.

Inherited from

BaseInvocationScope.getTransactionId

Defined in

functions/base-invocation-scope.ts:456


getTransactionRequest

getTransactionRequest(): Promise<ScriptTransactionRequest>

Prepares and returns the transaction request object.

Returns

Promise<ScriptTransactionRequest>

The prepared transaction request.

Inherited from

BaseInvocationScope.getTransactionRequest

Defined in

functions/base-invocation-scope.ts:353


prepareTransaction

prepareTransaction(): Promise<void>

Prepares the transaction by updating the script request, required coins, and checking the gas limit.

Returns

Promise<void>

Inherited from

BaseInvocationScope.prepareTransaction

Defined in

functions/base-invocation-scope.ts:188


setArguments

setArguments(...args): FunctionInvocationScope<TArgs, TReturn>

Sets the arguments for the function invocation.

Parameters

NameTypeDescription
...argsTArgsThe arguments.

Returns

FunctionInvocationScope<TArgs, TReturn>

The instance of FunctionInvocationScope.

Defined in

functions/invocation-scope.ts:65


simulate

simulate<T>(): Promise<InvocationCallResult<T>>

Simulates a transaction.

Type parameters

NameType
TTReturn

Returns

Promise<InvocationCallResult<T>>

The result of the invocation call.

Inherited from

BaseInvocationScope.simulate

Defined in

functions/base-invocation-scope.ts:389


txParams

txParams(txParams): FunctionInvocationScope<TArgs, TReturn>

Sets the transaction parameters.

Parameters

NameTypeDescription
txParamsPartial<{ gasLimit: BigNumberish ; gasPrice: BigNumberish ; maturity?: number ; maxFee?: BigNumberish ; variableOutputs: number ; witnessLimit?: BigNumberish }>The transaction parameters to set.

Returns

FunctionInvocationScope<TArgs, TReturn>

The current instance of the class.

Inherited from

BaseInvocationScope.txParams

Defined in

functions/base-invocation-scope.ts:291


updateContractInputAndOutput

updateContractInputAndOutput(): void

Updates the transaction request with the current input/output.

Returns

void

Inherited from

BaseInvocationScope.updateContractInputAndOutput

Defined in

functions/base-invocation-scope.ts:116


updateRequiredCoins

updateRequiredCoins(): void

Updates the required coins for the transaction.

Returns

void

Inherited from

BaseInvocationScope.updateRequiredCoins

Defined in

functions/base-invocation-scope.ts:143


updateScriptRequest

updateScriptRequest(): void

Updates the script request with the current contract calls.

Returns

void

Inherited from

BaseInvocationScope.updateScriptRequest

Defined in

functions/base-invocation-scope.ts:107