WalletLocked provides the functionalities for a locked wallet.

Hierarchy (view full)

Constructors

  • Creates a new Account instance.

    Parameters

    • address: AddressInput

      The address of the account.

    • Optionalprovider: Provider

      A Provider instance (optional).

    • Optionalconnector: FuelConnector

      A FuelConnector instance (optional).

    Returns WalletLocked

Properties

_connector?: FuelConnector

The connector for use with external wallets

_provider?: Provider

The provider used to interact with the network.

address: Address

The address associated with the account.

Accessors

  • get provider(): Provider
  • The provider used to interact with the network.

    Returns Provider

    A Provider instance.

    FuelError if the provider is not set.

  • set provider(provider): void
  • Sets the provider for the account.

    Parameters

    Returns void

Methods

  • Assembles transactions for consolidating base asset coins into fewer UTXOs.

    This method splits the provided coins into batches and creates transaction requests to consolidate them. It calculates the necessary fee and sets up the transactions to be submitted either in parallel (default) or sequentially.

    Parameters

    Returns Promise<{
        submitAll: SubmitAllCallback;
        totalFeeCost: BN;
        txs: ScriptTransactionRequest[];
    }>

    An object containing the assembled transactions, the total fee cost, and a callback to submit all transactions.

  • Transfers multiple amounts of a token to multiple recipients.

    Parameters

    • transferParams: TransferParams[]

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

    • txParams: TxParamsType = {}

      Optional transaction parameters.

    Returns Promise<TransactionResponse>

    A promise that resolves to a TransactionResponse object representing the transaction result.

  • Changes the provider connection for the account.

    Parameters

    Returns Provider

    The updated Provider instance.

  • Consolidates base asset UTXOs into fewer, larger ones.

    Retrieves a limited number of base asset coins (as defined by Provider.RESOURCES_PAGE_SIZE_LIMIT), assembles consolidation transactions, and submits them to the network.

    Note: This method currently supports only the base asset.

    Parameters

    • params: ConsolidateCoins

      The parameters for coin consolidation, including the asset ID, mode, and output number.

    Returns Promise<SubmitAllCallbackResponse>

    A promise that resolves to the response of the submitted transactions.

    Will throw an error if the asset is not a base asset as non-base asset consolidation is not implemented.

  • A helper that creates a transfer transaction request and returns it.

    Parameters

    • destination: string | Address

      The address of the destination.

    • amount: BigNumberish

      The amount of coins to transfer.

    • OptionalassetId: BytesLike

      The asset ID of the coins to transfer (optional).

    • txParams: TxParamsType = {}

      The transaction parameters (optional).

    Returns Promise<ScriptTransactionRequest>

    A promise that resolves to the prepared transaction request.

  • Generates an array of fake resources based on the provided coins.

    Parameters

    • coins: FakeResources[]

      An array of FakeResources objects representing the coins.

    Returns Resource[]

    An array of Resource objects with generated properties.

  • Retrieves the balance of the account for the given asset.

    Parameters

    • OptionalassetId: BytesLike

      The asset ID to check the balance for (optional).

    Returns Promise<BN>

    A promise that resolves to the balance amount.

  • Retrieves coins owned by the account.

    Parameters

    • OptionalassetId: BytesLike

      The asset ID of the coins to retrieve (optional).

    • OptionalpaginationArgs: CursorPaginationArgs

    Returns Promise<GetCoinsResponse>

    A promise that resolves to an array of Coins.

  • Retrieves messages owned by the account.

    Parameters

    • OptionalpaginationArgs: CursorPaginationArgs

    Returns Promise<GetMessagesResponse>

    A promise that resolves to an array of Messages.

  • Retrieves resources satisfying the spend query for the account.

    Parameters

    Returns Promise<Resource[]>

    A promise that resolves to an array of Resources.

  • Prepares a function to submit all transactions either sequentially or in parallel.

    Parameters

    Returns SubmitAllCallback

    A callback that, when called, submits all transactions and returns their results and any errors encountered.

  • Signs a transaction from the account via the connector..

    Parameters

    Returns Promise<string>

    A promise that resolves to the signature of the transaction.

  • Transfers coins to a destination address.

    Parameters

    • destination: string | Address

      The address of the destination.

    • amount: BigNumberish

      The amount of coins to transfer.

    • OptionalassetId: BytesLike

      The asset ID of the coins to transfer (optional).

    • txParams: TxParamsType = {}

      The transaction parameters (optional).

    Returns Promise<TransactionResponse>

    A promise that resolves to the transaction response.

  • Transfers coins to a contract address.

    Parameters

    • contractId: string | Address

      The address of the contract.

    • amount: BigNumberish

      The amount of coins to transfer.

    • assetId: BytesLike

      The asset ID of the coins to transfer (optional).

    • txParams: TxParamsType = {}

      The transaction parameters (optional).

    Returns Promise<TransactionResponse>

    A promise that resolves to the transaction response.

  • Unlocks the wallet using the provided private key and returns an instance of WalletUnlocked.

    Parameters

    • privateKey: BytesLike

      The private key used to unlock the wallet.

    Returns WalletUnlocked

    An instance of WalletUnlocked.