Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
BaseWalletUnlocked

Icon LinkClass: BaseWalletUnlocked

@fuel-ts/wallet .BaseWalletUnlocked

BaseWalletUnlocked provides the base functionalities for an unlocked wallet.

Icon LinkHierarchy

Icon LinkConstructors

Icon Linkconstructor

new BaseWalletUnlocked(privateKey, provider?): BaseWalletUnlocked

Creates a new BaseWalletUnlocked instance.

Icon LinkParameters

Name
Type
Description
privateKey
BytesLike
The private key of the wallet.
provider?
A Provider instance (optional).

Icon LinkReturns

BaseWalletUnlocked

Icon LinkOverrides

Account .constructor

Icon LinkDefined in

base-unlocked-wallet.ts:36 Icon Link

Icon LinkProperties

Icon Link_provider

Protected Optional _provider: Provider

The provider used to interact with the network.

Icon LinkInherited from

Account ._provider

Icon LinkDefined in

account.ts:54 Icon Link


Icon Linkaddress

Readonly address: AbstractAddress

The address associated with the account.

Icon LinkInherited from

Account .address

Icon LinkDefined in

account.ts:49 Icon Link


Icon Linksigner

signer: () => Signer

Icon LinkType declaration

▸ (): Signer

A function that returns the wallet's signer.

Icon LinkReturns

Signer

Icon LinkDefined in

base-unlocked-wallet.ts:28 Icon Link


Icon LinkdefaultPath

Static defaultPath: string = "m/44'/1179993420'/0'/0/0"

Default HDWallet path.

Icon LinkDefined in

base-unlocked-wallet.ts:23 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 LinkDefined in

base-unlocked-wallet.ts:47 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

Account.provider

Icon LinkDefined in

account.ts:75 Icon Link

set provider(provider): void

Sets the provider for the account.

Icon LinkParameters

Name
Type
Description
provider
A Provider instance.

Icon LinkReturns

void

Icon LinkInherited from

Account.provider

Icon LinkDefined in

account.ts:88 Icon Link


Icon LinkpublicKey

get publicKey(): string

Gets the public key of the wallet.

Icon LinkReturns

string

Icon LinkDefined in

base-unlocked-wallet.ts:56 Icon Link

Icon LinkMethods

Icon Linkconnect

connect(provider): Provider

Changes the provider connection for the account.

Icon LinkParameters

Name
Type
Description
provider
A Provider instance.

Icon LinkReturns

Provider

The updated Provider instance.

Icon LinkInherited from

Account .connect

Icon LinkDefined in

account.ts:98 Icon Link


Icon LinkcreateTransfer

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

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

Icon LinkParameters

Name
Type
Default value
Description
destination
undefined
The address of the destination.
amount
BigNumberish
undefined
The amount of coins to transfer.
assetId
BytesLike
BaseAssetId
The asset ID of the coins to transfer.
txParams
{}
The transaction parameters (gasLimit, gasPrice, maturity).

Icon LinkReturns

Promise<TransactionRequest >

A promise that resolves to the prepared transaction request.

Icon LinkInherited from

Account .createTransfer

Icon LinkDefined in

account.ts:318 Icon Link


Icon Linkencrypt

encrypt(password): Promise<string>

Icon LinkParameters

Name
Type
password
string

Icon LinkReturns

Promise<string>

Icon LinkDefined in

base-unlocked-wallet.ts:137 Icon Link


Icon Linkfund

fund<T>(request, coinQuantities, fee): Promise<void>

Adds resources to the transaction enough to fund it.

Icon LinkType parameters

Name
Type
T

Icon LinkParameters

Name
Type
Description
request
T
The transaction request.
coinQuantities
The coin quantities required to execute the transaction.
fee
BN
The estimated transaction fee.

Icon LinkReturns

Promise<void>

A promise that resolves when the resources are added to the transaction.

Icon LinkInherited from

Account .fund

Icon LinkDefined in

account.ts:239 Icon Link


Icon LinkgetBalance

getBalance(assetId?): Promise<BN>

Retrieves the balance of the account for the given asset.

Icon LinkParameters

Name
Type
Default value
Description
assetId
BytesLike
BaseAssetId
The asset ID to check the balance for.

Icon LinkReturns

Promise<BN>

A promise that resolves to the balance amount.

Icon LinkInherited from

Account .getBalance

Icon LinkDefined in

account.ts:192 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

Account .getBalances

Icon LinkDefined in

account.ts:202 Icon Link


Icon LinkgetCoins

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

Retrieves coins owned by the account.

Icon LinkParameters

Name
Type
Description
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

Account .getCoins

Icon LinkDefined in

account.ts:123 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

Account .getMessages

Icon LinkDefined in

account.ts:157 Icon Link


Icon LinkgetResourcesToSpend

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

Retrieves resources satisfying the spend query for the account.

Icon LinkParameters

Name
Type
Description
quantities
IDs of coins to exclude.
excludedIds?
ExcludeResourcesOption
IDs of resources to be excluded from the query.

Icon LinkReturns

Promise<Resource []>

A promise that resolves to an array of Resources.

Icon LinkInherited from

Account .getResourcesToSpend

Icon LinkDefined in

account.ts:110 Icon Link


Icon LinkpopulateTransactionWitnessesSignature

populateTransactionWitnessesSignature(transactionRequestLike): Promise<TransactionRequest >

Populates a transaction with the witnesses signature.

Icon LinkParameters

Name
Type
Description
transactionRequestLike
The transaction request to populate.

Icon LinkReturns

Promise<TransactionRequest >

The populated transaction request.

Icon LinkDefined in

base-unlocked-wallet.ts:92 Icon Link


Icon LinksendTransaction

sendTransaction(transactionRequestLike, options?): Promise<TransactionResponse >

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

Icon LinkParameters

Name
Type
Description
transactionRequestLike
The transaction request to send.
options?
Pick<ProviderSendTxParams , "awaitExecution">
-

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the TransactionResponse object.

Icon LinkOverrides

Account .sendTransaction

Icon LinkDefined in

base-unlocked-wallet.ts:107 Icon Link


Icon LinksignMessage

signMessage(message): Promise<string>

Signs a message with the wallet's private key.

Icon LinkParameters

Name
Type
Description
message
string
The message to sign.

Icon LinkReturns

Promise<string>

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

Icon LinkDefined in

base-unlocked-wallet.ts:66 Icon Link


Icon LinksignTransaction

signTransaction(transactionRequestLike): Promise<string>

Signs a transaction with the wallet's private key.

Icon LinkParameters

Name
Type
Description
transactionRequestLike
The transaction request to sign.

Icon LinkReturns

Promise<string>

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

Icon LinkDefined in

base-unlocked-wallet.ts:77 Icon Link


Icon LinksimulateTransaction

simulateTransaction(transactionRequestLike): Promise<CallResult >

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

Icon LinkParameters

Name
Type
Description
transactionRequestLike
The transaction request to simulate.

Icon LinkReturns

Promise<CallResult >

A promise that resolves to the CallResult object.

Icon LinkOverrides

Account .simulateTransaction

Icon LinkDefined in

base-unlocked-wallet.ts:125 Icon Link


Icon Linktransfer

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

Transfers coins to a destination address.

Icon LinkParameters

Name
Type
Default value
Description
destination
undefined
The address of the destination.
amount
BigNumberish
undefined
The amount of coins to transfer.
assetId
BytesLike
BaseAssetId
The asset ID of the coins to transfer.
txParams
{}
The transaction parameters (gasLimit, gasPrice, maturity).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .transfer

Icon LinkDefined in

account.ts:346 Icon Link


Icon LinktransferToContract

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

Transfers coins to a contract address.

Icon LinkParameters

Name
Type
Default value
Description
contractId
undefined
The address of the contract.
amount
BigNumberish
undefined
The amount of coins to transfer.
assetId
BytesLike
BaseAssetId
The asset ID of the coins to transfer.
txParams
{}
The optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .transferToContract

Icon LinkDefined in

account.ts:369 Icon Link


Icon LinkwithdrawToBaseLayer

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

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

Icon LinkParameters

Name
Type
Description
recipient
Address of the recipient on the base chain.
amount
BigNumberish
Amount of base asset.
txParams
The optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .withdrawToBaseLayer

Icon LinkDefined in

account.ts:416 Icon Link