Represents a scope for invoking a function.

Type Parameters

  • TArgs extends any[] = any[]

    The type of the function arguments.

  • TReturn = any

    The type of the return value.

Hierarchy

  • BaseInvocationScope<TReturn>
    • FunctionInvocationScope

Constructors

Properties

args: TArgs
externalAbis: Record<string, JsonAbi> = {}
functionInvocationScopes: InvocationScopeLike[] = []
hasCallParamsGasLimit: boolean = false
isMultiCall: boolean = false
program: AbstractProgram
requiredCoins: CoinQuantity[] = []
transactionRequest: ScriptTransactionRequest
txParameters?: Partial<{
    gasLimit: BigNumberish;
    maturity?: number;
    maxFee?: BigNumberish;
    tip: BigNumberish;
    variableOutputs: number;
    witnessLimit?: BigNumberish;
}>

Accessors

  • get calls(): ContractCall[]
  • Getter for the contract calls.

    Returns ContractCall[]

    An array of contract calls.

Methods

  • Adds multiple transfers to the contract call transaction request.

    Parameters

    • transferParams: TransferParams[]

      An array of TransferParams objects representing the transfers to be made.

    Returns FunctionInvocationScope<TArgs, TReturn>

    The current instance of the class.

  • 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.

    Type Parameters

    • T = TReturn

      The type of the return value.

    Returns Promise<{
        transactionId: string;
        waitForResult: (() => Promise<FunctionResult<T>>);
    }>

    A promise that resolves to an object containing:

    • transactionId: The ID of the submitted transaction.
    • waitForResult: A function that waits for the transaction result.
  • Checks if the total gas limit is within the acceptable range.

    Returns void

  • Executes a transaction in dry run mode.

    Type Parameters

    Returns Promise<DryRunResult<T>>

    The result of the invocation call.

  • Funds the transaction with the required coins.

    Returns Promise<ScriptTransactionRequest>

    The current instance of the class.

  • Type Parameters

    Returns Promise<DryRunResult<T>>

  • Gets the call configuration.

    Returns CallConfig<TArgs>

    The call configuration.

  • Returns Provider

  • Gets the required coins for the transaction.

    Returns CoinQuantity[]

    An array of required coin quantities.

  • Gets the transaction cost for dry running the transaction.

    Returns Promise<TransactionCost>

    The transaction cost details.

  • Obtains the ID of a transaction.

    Parameters

    • OptionalchainId: number

      the chainId to use to hash the transaction with

    Returns Promise<string>

    the ID of the transaction.

  • Prepares and returns the transaction request object.

    Returns Promise<ScriptTransactionRequest>

    The prepared transaction request.

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

    Returns Promise<void>

  • Simulates a transaction.

    Type Parameters

    Returns Promise<DryRunResult<T>>

    The result of the invocation call.

  • Updates the transaction request with the current input/output.

    Returns void

  • Updates the required coins for the transaction.

    Returns void

  • Updates the script request with the current contract calls.

    Returns void