Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
WalletUnlocked

Icon LinkClass: WalletUnlocked

@fuel-ts/account .WalletUnlocked

WalletUnlocked provides the functionalities for an unlocked wallet.

Icon LinkHierarchy

Icon LinkConstructors

Icon Linkconstructor

new WalletUnlocked(privateKey, provider?): WalletUnlocked

Creates a new BaseWalletUnlocked instance.

Icon LinkParameters

NameTypeDescription
privateKeyBytesLike 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

Protected Optional _connector: FuelConnector

Icon LinkInherited from

BaseWalletUnlocked ._connector

Icon LinkDefined in

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


Icon Link_provider

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:65 Icon Link


Icon Linkaddress

Readonly address: AbstractAddress

The address associated with the account.

Icon LinkInherited from

BaseWalletUnlocked .address

Icon LinkDefined in

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


Icon Linksigner

signer: () => Signer

Icon LinkType declaration

▸ (): 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

Static defaultPath: string = "m/44'/1179993420'/0'/0/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

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

get provider(): Provider

The provider used to interact with the network.

Throws

FuelError if the provider is not set.

Icon LinkReturns

Provider

A Provider instance.

Icon LinkInherited from

BaseWalletUnlocked.provider

Icon LinkDefined in

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

set provider(provider): void

Sets the provider for the account.

Icon LinkParameters

NameTypeDescription
providerProvider A Provider instance.

Icon LinkReturns

void

Icon LinkInherited from

BaseWalletUnlocked.provider

Icon LinkDefined in

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


Icon LinkpublicKey

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 Linkconnect

connect(provider): Provider

Changes the provider connection for the account.

Icon LinkParameters

NameTypeDescription
providerProvider A Provider instance.

Icon LinkReturns

Provider

The updated Provider instance.

Icon LinkInherited from

BaseWalletUnlocked .connect

Icon LinkDefined in

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


Icon LinkcreateTransfer

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

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

Icon LinkParameters

NameTypeDescription
destinationstring | AbstractAddress The address of the destination.
amountBigNumberishThe amount of coins to transfer.
assetId?BytesLike The asset ID of the coins to transfer.
txParamsTxParamsType The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).

Icon LinkReturns

Promise<TransactionRequest >

A promise that resolves to the prepared transaction request.

Icon LinkInherited from

BaseWalletUnlocked .createTransfer

Icon LinkDefined in

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


Icon Linkencrypt

encrypt(password): Promise<string>

Icon LinkParameters

NameType
passwordstring

Icon LinkReturns

Promise<string>

Icon LinkInherited from

BaseWalletUnlocked .encrypt

Icon LinkDefined in

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


Icon Linkfund

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

Funds a transaction request by adding the necessary resources.

Icon LinkType parameters

NameTypeDescription
Textends TransactionRequest The type of the TransactionRequest.

Icon LinkParameters

NameTypeDescription
requestTThe transaction request to fund.
paramsEstimatedTxParams The estimated transaction parameters.

Icon LinkReturns

Promise<T>

The funded transaction request.

Icon LinkInherited from

BaseWalletUnlocked .fund

Icon LinkDefined in

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


Icon LinkgetBalance

getBalance(assetId?): Promise<BN>

Retrieves the balance of the account for the given asset.

Icon LinkParameters

NameTypeDescription
assetId?BytesLike The asset ID to check the balance for.

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:206 Icon Link


Icon LinkgetBalances

getBalances(): Promise<CoinQuantity []>

Retrieves all the balances for the account.

Icon LinkReturns

Promise<CoinQuantity []>

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:217 Icon Link


Icon LinkgetCoins

getCoins(assetId?): Promise<Coin []>

Retrieves coins owned by the account.

Icon LinkParameters

NameTypeDescription
assetId?BytesLike The asset ID of the coins to retrieve.

Icon LinkReturns

Promise<Coin []>

A promise that resolves to an array of Coins.

Icon LinkInherited from

BaseWalletUnlocked .getCoins

Icon LinkDefined in

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


Icon LinkgetMessages

getMessages(): Promise<Message []>

Retrieves messages owned by the account.

Icon LinkReturns

Promise<Message []>

A promise that resolves to an array of Messages.

Icon LinkInherited from

BaseWalletUnlocked .getMessages

Icon LinkDefined in

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


Icon LinkgetResourcesToSpend

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

Retrieves resources satisfying the spend query for the account.

Icon LinkParameters

NameTypeDescription
quantitiesCoinQuantityLike []IDs of coins to exclude.
excludedIds?ExcludeResourcesOptionIDs of resources to be excluded from the query.

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:124 Icon Link


Icon Linklock

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

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

Populates a transaction with the witnesses signature.

Icon LinkType parameters

NameType
Textends TransactionRequest

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike 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

sendTransaction(transactionRequestLike, «destructured»?): Promise<TransactionResponse >

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

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request to send.
«destructured»ProviderSendTxParams -

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:112 Icon Link


Icon LinksignMessage

signMessage(message): Promise<string>

Signs a message with the wallet's private key.

Icon LinkParameters

NameTypeDescription
messagestringThe 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

signTransaction(transactionRequestLike): Promise<string>

Signs a transaction with the wallet's private key.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike 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

simulateTransaction(transactionRequestLike, «destructured»?): Promise<CallResult >

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

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request to simulate.
«destructured»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:132 Icon Link


Icon Linktransfer

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

Transfers coins to a destination address.

Icon LinkParameters

NameTypeDescription
destinationstring | AbstractAddress The address of the destination.
amountBigNumberishThe amount of coins to transfer.
assetId?BytesLike The asset ID of the coins to transfer.
txParamsTxParamsType The transaction parameters (gasLimit, maturity).

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:410 Icon Link


Icon LinktransferToContract

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

Transfers coins to a contract address.

Icon LinkParameters

NameTypeDescription
contractIdstring | AbstractAddress The address of the contract.
amountBigNumberishThe amount of coins to transfer.
assetId?BytesLike The asset ID of the coins to transfer.
txParamsTxParamsType The optional transaction parameters.

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:440 Icon Link


Icon LinkwithdrawToBaseLayer

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

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

Icon LinkParameters

NameTypeDescription
recipientstring | AbstractAddress Address of the recipient on the base chain.
amountBigNumberishAmount of base asset.
txParamsTxParamsType The optional transaction parameters.

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:498 Icon Link


Icon LinkfromEncryptedJson

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

Create a Wallet Unlocked from an encrypted JSON.

Icon LinkParameters

NameTypeDescription
jsonWalletstringThe encrypted JSON keystore.
passwordstringThe 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

fromExtendedKey(extendedKey, provider?): WalletUnlocked

Create a Wallet Unlocked from an extended key.

Icon LinkParameters

NameTypeDescription
extendedKeystringThe 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

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

Create a Wallet Unlocked from a mnemonic phrase.

Icon LinkParameters

NameTypeDescription
mnemonicstringThe mnemonic phrase.
path?stringThe 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

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

Create a Wallet Unlocked from a seed.

Icon LinkParameters

NameTypeDescription
seedstringThe seed phrase.
path?stringThe 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

generate(generateOptions?): WalletUnlocked

Generate a new Wallet Unlocked with a random key pair.

Icon LinkParameters

NameTypeDescription
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