Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
WalletUnlocked

@fuel-ts/account v0.94.2 Docs


Icon LinkClass: WalletUnlocked

WalletUnlocked provides the functionalities for an unlocked wallet.

Icon LinkExtends

Icon LinkConstructors

Icon Linknew WalletUnlocked()

Icon InfoCircle

new WalletUnlocked(privateKey, provider?): WalletUnlocked

Creates a new BaseWalletUnlocked instance.

Icon LinkParameters

privateKey: BytesLike

The private key of the wallet.

provider?: Provider

A Provider instance (optional).

Icon LinkReturns

WalletUnlocked

Icon LinkInherited from

BaseWalletUnlocked .constructor

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:40 Icon Link

Icon LinkProperties

Icon Link_connector?

Icon InfoCircle

protected optional _connector: FuelConnector

The connector for use with external wallets

Icon LinkInherited from

BaseWalletUnlocked ._connector

Icon LinkDefined in

packages/account/src/account.ts:85 Icon Link


Icon Link_provider?

Icon InfoCircle

protected optional _provider: Provider

The provider used to interact with the network.

Icon LinkInherited from

BaseWalletUnlocked ._provider

Icon LinkDefined in

packages/account/src/account.ts:80 Icon Link


Icon Linkaddress

Icon InfoCircle

readonly address: AbstractAddress

The address associated with the account.

Icon LinkInherited from

BaseWalletUnlocked .address

Icon LinkDefined in

packages/account/src/account.ts:75 Icon Link


Icon Linksigner()

Icon InfoCircle

signer: () => Signer

A function that returns the wallet's signer.

Icon LinkReturns

Signer

Icon LinkInherited from

BaseWalletUnlocked .signer

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:32 Icon Link


Icon LinkdefaultPath

Icon InfoCircle

static defaultPath: string = "m/44'/117999342./0"

Default HDWallet path.

Icon LinkInherited from

BaseWalletUnlocked .defaultPath

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:27 Icon Link

Icon LinkAccessors

Icon LinkprivateKey

Icon InfoCircle

get privateKey(): string

Gets the private key of the wallet.

Icon LinkReturns

string

The private key of the wallet.

Icon LinkInherited from

BaseWalletUnlocked .privateKey

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:51 Icon Link


Icon Linkprovider

Icon InfoCircle

get provider(): Provider

The provider used to interact with the network.

Icon LinkThrows

FuelError if the provider is not set.

Icon InfoCircle

set provider(provider): void

Sets the provider for the account.

Icon LinkParameters

provider: Provider

A Provider instance.

Icon LinkReturns

Provider

A Provider instance.

Icon LinkInherited from

BaseWalletUnlocked .provider

Icon LinkDefined in

packages/account/src/account.ts:108 Icon Link


Icon LinkpublicKey

Icon InfoCircle

get publicKey(): string

Gets the public key of the wallet.

Icon LinkReturns

string

Icon LinkInherited from

BaseWalletUnlocked .publicKey

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:60 Icon Link

Icon LinkMethods

Icon LinkaddBatchTransfer()

Icon InfoCircle

addBatchTransfer(request, transferParams): ScriptTransactionRequest

Adds multiple transfers to a script transaction request.

Icon LinkParameters

request: ScriptTransactionRequest

The script transaction request to add transfers to.

transferParams: TransferParams []

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

Icon LinkReturns

ScriptTransactionRequest

The updated script transaction request.

Icon LinkInherited from

BaseWalletUnlocked .addBatchTransfer

Icon LinkDefined in

packages/account/src/account.ts:405 Icon Link


Icon LinkaddTransfer()

Icon InfoCircle

addTransfer(request, transferParams): ScriptTransactionRequest

Adds a transfer to the given transaction request.

Icon LinkParameters

request: ScriptTransactionRequest

The script transaction request to add transfers to.

transferParams: TransferParams

The object representing the transfer to be made.

Icon LinkReturns

ScriptTransactionRequest

The updated transaction request with the added transfer.

Icon LinkInherited from

BaseWalletUnlocked .addTransfer

Icon LinkDefined in

packages/account/src/account.ts:387 Icon Link


Icon LinkbatchTransfer()

Icon InfoCircle

batchTransfer(transferParams, txParams): Promise<TransactionResponse >

Transfers multiple amounts of a token to multiple recipients.

Icon LinkParameters

transferParams: TransferParams []

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

txParams: TxParamsType = {}

Optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

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

Icon LinkInherited from

BaseWalletUnlocked .batchTransfer

Icon LinkDefined in

packages/account/src/account.ts:370 Icon Link


Icon Linkconnect()

Icon InfoCircle

connect(provider): Provider

Changes the provider connection for the account.

Icon LinkParameters

provider: Provider

A Provider instance.

Icon LinkReturns

Provider

The updated Provider instance.

Icon LinkInherited from

BaseWalletUnlocked .connect

Icon LinkDefined in

packages/account/src/account.ts:131 Icon Link


Icon LinkcreateTransfer()

Icon InfoCircle

createTransfer(destination, amount, assetId?, txParams?): Promise<ScriptTransactionRequest >

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

Icon LinkParameters

destination: string | AbstractAddress

The address of the destination.

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

Icon LinkReturns

Promise<ScriptTransactionRequest >

A promise that resolves to the prepared transaction request.

Icon LinkInherited from

BaseWalletUnlocked .createTransfer

Icon LinkDefined in

packages/account/src/account.ts:332 Icon Link


Icon Linkencrypt()

Icon InfoCircle

encrypt(password): Promise<string>

Encrypts an unlocked wallet with a password.

Icon LinkParameters

password: string

the password to encrypt the wallet with.

Icon LinkReturns

Promise<string>

  • the encrypted wallet.

Icon LinkInherited from

BaseWalletUnlocked .encrypt

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:156 Icon Link


Icon Linkfund()

Icon InfoCircle

fund<T>(request, params): Promise<T>

Funds a transaction request by adding the necessary resources.

Icon LinkType Parameters

T extends TransactionRequest

The type of the TransactionRequest.

Icon LinkParameters

request: T

The transaction request to fund.

params: EstimatedTxParams

The estimated transaction parameters.

Icon LinkReturns

Promise<T>

A promise that resolves to the funded transaction request.

Icon LinkInherited from

BaseWalletUnlocked .fund

Icon LinkDefined in

packages/account/src/account.ts:201 Icon Link


Icon LinkgenerateFakeResources()

Icon InfoCircle

generateFakeResources(coins): Resource []

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

Icon LinkParameters

coins: FakeResources []

An array of FakeResources objects representing the coins.

Icon LinkReturns

Resource []

An array of Resource objects with generated properties.

Icon LinkInherited from

BaseWalletUnlocked .generateFakeResources

Icon LinkDefined in

packages/account/src/account.ts:667 Icon Link


Icon LinkgetBalance()

Icon InfoCircle

getBalance(assetId?): Promise<BN>

Retrieves the balance of the account for the given asset.

Icon LinkParameters

assetId?: BytesLike

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

Icon LinkReturns

Promise<BN>

A promise that resolves to the balance amount.

Icon LinkInherited from

BaseWalletUnlocked .getBalance

Icon LinkDefined in

packages/account/src/account.ts:178 Icon Link


Icon LinkgetBalances()

Icon InfoCircle

getBalances(): Promise<GetBalancesResponse >

Retrieves all the balances for the account.

Icon LinkReturns

Promise<GetBalancesResponse >

A promise that resolves to an array of Coins and their quantities.

Icon LinkInherited from

BaseWalletUnlocked .getBalances

Icon LinkDefined in

packages/account/src/account.ts:189 Icon Link


Icon LinkgetCoins()

Icon InfoCircle

getCoins(assetId?, paginationArgs?): Promise<GetCoinsResponse >

Retrieves coins owned by the account.

Icon LinkParameters

assetId?: BytesLike

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

paginationArgs?: CursorPaginationArgs

Icon LinkReturns

Promise<GetCoinsResponse >

A promise that resolves to an array of Coins.

Icon LinkInherited from

BaseWalletUnlocked .getCoins

Icon LinkDefined in

packages/account/src/account.ts:156 Icon Link


Icon LinkgetMessages()

Icon InfoCircle

getMessages(paginationArgs?): Promise<GetMessagesResponse >

Retrieves messages owned by the account.

Icon LinkParameters

paginationArgs?: CursorPaginationArgs

Icon LinkReturns

Promise<GetMessagesResponse >

A promise that resolves to an array of Messages.

Icon LinkInherited from

BaseWalletUnlocked .getMessages

Icon LinkDefined in

packages/account/src/account.ts:168 Icon Link


Icon LinkgetResourcesToSpend()

Icon InfoCircle

getResourcesToSpend(quantities, excludedIds?): Promise<Resource []>

Retrieves resources satisfying the spend query for the account.

Icon LinkParameters

quantities: CoinQuantityLike []

Quantities of resources to be obtained.

excludedIds?: ExcludeResourcesOption

IDs of resources to be excluded from the query (optional).

Icon LinkReturns

Promise<Resource []>

A promise that resolves to an array of Resources.

Icon LinkInherited from

BaseWalletUnlocked .getResourcesToSpend

Icon LinkDefined in

packages/account/src/account.ts:143 Icon Link


Icon LinkgetTransactionCost()

Icon InfoCircle

getTransactionCost(transactionRequestLike, transactionCostParams): Promise<TransactionCost >

Returns a transaction cost to enable user to set gasLimit and also reserve balance amounts on the transaction.

Icon LinkParameters

transactionRequestLike: TransactionRequestLike

The transaction request object.

transactionCostParams: TransactionCostParams = {}

The transaction cost parameters (optional).

Icon LinkReturns

Promise<TransactionCost >

A promise that resolves to the transaction cost object.

Icon LinkInherited from

BaseWalletUnlocked .getTransactionCost

Icon LinkDefined in

packages/account/src/account.ts:528 Icon Link


Icon Linklock()

Icon InfoCircle

lock(): WalletLocked

Locks the wallet and returns an instance of WalletLocked.

Icon LinkReturns

WalletLocked

An instance of WalletLocked.

Icon LinkDefined in

packages/account/src/wallet/wallets.ts:48 Icon Link


Icon LinkpopulateTransactionWitnessesSignature()

Icon InfoCircle

populateTransactionWitnessesSignature<T>(transactionRequestLike): Promise<T>

Populates a transaction with the witnesses signature.

Icon LinkType Parameters

T extends TransactionRequest

Icon LinkParameters

transactionRequestLike: TransactionRequestLike

The transaction request to populate.

Icon LinkReturns

Promise<T>

The populated transaction request.

Icon LinkInherited from

BaseWalletUnlocked .populateTransactionWitnessesSignature

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:95 Icon Link


Icon LinksendTransaction()

Icon InfoCircle

sendTransaction(transactionRequestLike, estimateTxDependencies): Promise<TransactionResponse >

Populates the witness signature for a transaction and sends it to the network using provider.sendTransaction.

Icon LinkParameters

transactionRequestLike: TransactionRequestLike

The transaction request to send.

estimateTxDependencies: EstimateTransactionParams = {}

Whether to estimate the transaction dependencies.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the TransactionResponse object.

Icon LinkInherited from

BaseWalletUnlocked .sendTransaction

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:113 Icon Link


Icon LinksignMessage()

Icon InfoCircle

signMessage(message): Promise<string>

Signs a message with the wallet's private key.

Icon LinkParameters

message: string

The message to sign.

Icon LinkReturns

Promise<string>

A promise that resolves to the signature as a ECDSA 64 bytes string.

Icon LinkInherited from

BaseWalletUnlocked .signMessage

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:70 Icon Link


Icon LinksignTransaction()

Icon InfoCircle

signTransaction(transactionRequestLike): Promise<string>

Signs a transaction with the wallet's private key.

Icon LinkParameters

transactionRequestLike: TransactionRequestLike

The transaction request to sign.

Icon LinkReturns

Promise<string>

A promise that resolves to the signature as a ECDSA 64 bytes string.

Icon LinkInherited from

BaseWalletUnlocked .signTransaction

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:81 Icon Link


Icon LinksimulateTransaction()

Icon InfoCircle

simulateTransaction(transactionRequestLike, __namedParameters): Promise<CallResult >

Populates the witness signature for a transaction and sends a call to the network using provider.dryRun.

Icon LinkParameters

transactionRequestLike: TransactionRequestLike

The transaction request to simulate.

__namedParameters: EstimateTransactionParams = {}

Icon LinkReturns

Promise<CallResult >

A promise that resolves to the CallResult object.

Icon LinkInherited from

BaseWalletUnlocked .simulateTransaction

Icon LinkDefined in

packages/account/src/wallet/base-wallet-unlocked.ts:133 Icon Link


Icon Linktransfer()

Icon InfoCircle

transfer(destination, amount, assetId?, txParams?): Promise<TransactionResponse >

Transfers coins to a destination address.

Icon LinkParameters

destination: string | AbstractAddress

The address of the destination.

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

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

BaseWalletUnlocked .transfer

Icon LinkDefined in

packages/account/src/account.ts:353 Icon Link


Icon LinktransferToContract()

Icon InfoCircle

transferToContract(contractId, amount, assetId?, txParams?): Promise<TransactionResponse >

Transfers coins to a contract address.

Icon LinkParameters

contractId: string | AbstractAddress

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

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

BaseWalletUnlocked .transferToContract

Icon LinkDefined in

packages/account/src/account.ts:426 Icon Link


Icon LinkwithdrawToBaseLayer()

Icon InfoCircle

withdrawToBaseLayer(recipient, amount, txParams): Promise<TransactionResponse >

Withdraws an amount of the base asset to the base chain.

Icon LinkParameters

recipient: string | AbstractAddress

Address of the recipient on the base chain.

amount: BigNumberish

Amount of base asset.

txParams: TxParamsType = {}

The transaction parameters (optional).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

BaseWalletUnlocked .withdrawToBaseLayer

Icon LinkDefined in

packages/account/src/account.ts:479 Icon Link


Icon LinkfromEncryptedJson()

Icon InfoCircle

static fromEncryptedJson(jsonWallet, password, provider?): Promise<WalletUnlocked >

Create a Wallet Unlocked from an encrypted JSON.

Icon LinkParameters

jsonWallet: string

The encrypted JSON keystore.

password: string

The password to decrypt the JSON.

provider?: Provider

A Provider instance (optional).

Icon LinkReturns

Promise<WalletUnlocked >

An unlocked wallet instance.

Icon LinkDefined in

packages/account/src/wallet/wallets.ts:123 Icon Link


Icon LinkfromExtendedKey()

Icon InfoCircle

static fromExtendedKey(extendedKey, provider?): WalletUnlocked

Create a Wallet Unlocked from an extended key.

Icon LinkParameters

extendedKey: string

The extended key.

provider?: Provider

A Provider instance (optional).

Icon LinkReturns

WalletUnlocked

An instance of WalletUnlocked.

Icon LinkDefined in

packages/account/src/wallet/wallets.ts:109 Icon Link


Icon LinkfromMnemonic()

Icon InfoCircle

static fromMnemonic(mnemonic, path?, passphrase?, provider?): WalletUnlocked

Create a Wallet Unlocked from a mnemonic phrase.

Icon LinkParameters

mnemonic: string

The mnemonic phrase.

path?: string

The derivation path (optional).

passphrase?: BytesLike

The passphrase for the mnemonic (optional).

provider?: Provider

A Provider instance (optional).

Icon LinkReturns

WalletUnlocked

An instance of WalletUnlocked.

Icon LinkDefined in

packages/account/src/wallet/wallets.ts:89 Icon Link


Icon LinkfromSeed()

Icon InfoCircle

static fromSeed(seed, path?, provider?): WalletUnlocked

Create a Wallet Unlocked from a seed.

Icon LinkParameters

seed: string

The seed phrase.

path?: string

The derivation path (optional).

provider?: Provider

A Provider instance (optional).

Icon LinkReturns

WalletUnlocked

An instance of WalletUnlocked.

Icon LinkDefined in

packages/account/src/wallet/wallets.ts:73 Icon Link


Icon Linkgenerate()

Icon InfoCircle

static generate(generateOptions?): WalletUnlocked

Generate a new Wallet Unlocked with a random key pair.

Icon LinkParameters

generateOptions?: GenerateOptions

Options to customize the generation process (optional).

Icon LinkReturns

WalletUnlocked

An instance of WalletUnlocked.

Icon LinkDefined in

packages/account/src/wallet/wallets.ts:59 Icon Link