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
assembleTxParameters?: Partial<Omit<AssembleTxParams, "request">>
externalAbis: Record<string, JsonAbi> = {}
functionInvocationScopes: InvocationScopeLike[] = []
hasCallParamsGasLimit: boolean = false
isMultiCall: boolean = false
program: AbstractProgram
requiredCoins: CoinQuantity[] = []
transactionRequest: ScriptTransactionRequest
txParameters?: Partial<{
    expiration?: number;
    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.

    Parameters

    • Optionalparams: {
          skipAssembleTx?: boolean;
      }

      Optional parameters for the call.

      • skipAssembleTx: A boolean indicating whether to skip assembling the transaction. This is useful when customizations were made to the transaction request using the assembleTx method.
      • OptionalskipAssembleTx?: boolean

    Returns Promise<{
        transactionId: string;
        waitForPreConfirmation: (() => Promise<PreConfirmationFunctionResult<T>>);
        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.
    • waitForPreConfirmation: A function that waits for the transaction pre-confirmation.
  • 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.

    Use .get instead

  • Sets the transaction request. Useful when you have used getTransactionRequest or fundWithRequiredCoins from the scope to apply customizations to the transaction request.

    Parameters

    Returns FunctionInvocationScope<TArgs, TReturn>

    The current instance of the class.

  • Funds the transaction request with the required coins and returns it.

    Returns Promise<ScriptTransactionRequest>

    The transaction request.

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

  • 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 Promise<void>