@fuel-ts/account v0.94.9 • Docs
BaseWalletUnlocked
provides the base functionalities for an unlocked wallet.
new BaseWalletUnlocked(
privateKey
,provider
?):BaseWalletUnlocked
Creates a new BaseWalletUnlocked instance.
• privateKey: BytesLike
The private key of the wallet.
• provider?: Provider
A Provider instance (optional).
packages/account/src/wallet/base-wallet-unlocked.ts:40
protected
optional
_connector:FuelConnector
The connector for use with external wallets
packages/account/src/account.ts:87
protected
optional
_provider:Provider
The provider used to interact with the network.
packages/account/src/account.ts:82
readonly
address:AbstractAddress
The address associated with the account.
packages/account/src/account.ts:77
signer: () =>
Signer
A function that returns the wallet's signer.
packages/account/src/wallet/base-wallet-unlocked.ts:32
static
defaultPath:string
="m/44'/117999342./0"
Default HDWallet path.
packages/account/src/wallet/base-wallet-unlocked.ts:27
get
privateKey():string
Gets the private key of the wallet.
string
The private key of the wallet.
packages/account/src/wallet/base-wallet-unlocked.ts:51
get
provider():Provider
The provider used to interact with the network.
FuelError
if the provider is not set.
set
provider(provider
):void
Sets the provider for the account.
• provider: Provider
A Provider instance.
A Provider instance.
packages/account/src/account.ts:110
get
publicKey():string
Gets the public key of the wallet.
string
packages/account/src/wallet/base-wallet-unlocked.ts:60
addBatchTransfer(
request
,transferParams
):ScriptTransactionRequest
Adds multiple transfers to a script transaction request.
• request: ScriptTransactionRequest
The script transaction request to add transfers to.
• transferParams: TransferParams
[]
An array of TransferParams
objects representing the transfers to be made.
The updated script transaction request.
packages/account/src/account.ts:407
addTransfer(
request
,transferParams
):ScriptTransactionRequest
Adds a transfer to the given transaction request.
• request: ScriptTransactionRequest
The script transaction request to add transfers to.
• transferParams: TransferParams
The object representing the transfer to be made.
The updated transaction request with the added transfer.
packages/account/src/account.ts:389
batchTransfer(
transferParams
,txParams
):Promise
<TransactionResponse
>
Transfers multiple amounts of a token to multiple recipients.
• transferParams: TransferParams
[]
An array of TransferParams
objects representing the transfers to be made.
• txParams: TxParamsType
= {}
Optional transaction parameters.
Promise
<TransactionResponse
>
A promise that resolves to a TransactionResponse
object representing the transaction result.
packages/account/src/account.ts:372
connect(
provider
):Provider
Changes the provider connection for the account.
• provider: Provider
A Provider instance.
The updated Provider instance.
packages/account/src/account.ts:133
createTransfer(
destination
,amount
,assetId
?,txParams
?):Promise
<ScriptTransactionRequest
>
A helper that creates a transfer transaction request and returns it.
• 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).
Promise
<ScriptTransactionRequest
>
A promise that resolves to the prepared transaction request.
packages/account/src/account.ts:334
encrypt(
password
):Promise
<string
>
Encrypts an unlocked wallet with a password.
• password: string
the password to encrypt the wallet with.
Promise
<string
>
packages/account/src/wallet/base-wallet-unlocked.ts:156
fund<
T
>(request
,params
):Promise
<T
>
Funds a transaction request by adding the necessary resources.
• T extends TransactionRequest
The type of the TransactionRequest.
• request: T
The transaction request to fund.
• params: EstimatedTxParams
The estimated transaction parameters.
Promise
<T
>
A promise that resolves to the funded transaction request.
packages/account/src/account.ts:203
generateFakeResources(
coins
):Resource
[]
Generates an array of fake resources based on the provided coins.
• coins: FakeResources
[]
An array of FakeResources
objects representing the coins.
Resource
[]
An array of Resource
objects with generated properties.
Account
.generateFakeResources
packages/account/src/account.ts:671
getBalance(
assetId
?):Promise
<BN
>
Retrieves the balance of the account for the given asset.
• assetId?: BytesLike
The asset ID to check the balance for (optional).
Promise
<BN
>
A promise that resolves to the balance amount.
packages/account/src/account.ts:180
getBalances():
Promise
<GetBalancesResponse
>
Retrieves all the balances for the account.
Promise
<GetBalancesResponse
>
A promise that resolves to an array of Coins and their quantities.
packages/account/src/account.ts:191
getCoins(
assetId
?,paginationArgs
?):Promise
<GetCoinsResponse
>
Retrieves coins owned by the account.
• assetId?: BytesLike
The asset ID of the coins to retrieve (optional).
• paginationArgs?: CursorPaginationArgs
Promise
<GetCoinsResponse
>
A promise that resolves to an array of Coins.
packages/account/src/account.ts:158
getMessages(
paginationArgs
?):Promise
<GetMessagesResponse
>
Retrieves messages owned by the account.
• paginationArgs?: CursorPaginationArgs
Promise
<GetMessagesResponse
>
A promise that resolves to an array of Messages.
packages/account/src/account.ts:170
getResourcesToSpend(
quantities
,excludedIds
?):Promise
<Resource
[]>
Retrieves resources satisfying the spend query for the account.
• quantities: CoinQuantityLike
[]
Quantities of resources to be obtained.
• excludedIds?: ExcludeResourcesOption
IDs of resources to be excluded from the query (optional).
Promise
<Resource
[]>
A promise that resolves to an array of Resources.
packages/account/src/account.ts:145
getTransactionCost(
transactionRequestLike
,transactionCostParams
):Promise
<TransactionCost
>
Returns a transaction cost to enable user to set gasLimit and also reserve balance amounts on the transaction.
• transactionRequestLike: TransactionRequestLike
The transaction request object.
• transactionCostParams: TransactionCostParams
= {}
The transaction cost parameters (optional).
Promise
<TransactionCost
>
A promise that resolves to the transaction cost object.
packages/account/src/account.ts:530
populateTransactionWitnessesSignature<
T
>(transactionRequestLike
):Promise
<T
>
Populates a transaction with the witnesses signature.
• T extends TransactionRequest
• transactionRequestLike: TransactionRequestLike
The transaction request to populate.
Promise
<T
>
The populated transaction request.
packages/account/src/wallet/base-wallet-unlocked.ts:95
sendTransaction(
transactionRequestLike
,estimateTxDependencies
):Promise
<TransactionResponse
>
Populates the witness signature for a transaction and sends it to the network using provider.sendTransaction
.
• transactionRequestLike: TransactionRequestLike
The transaction request to send.
• estimateTxDependencies: EstimateTransactionParams
= {}
Whether to estimate the transaction dependencies.
Promise
<TransactionResponse
>
A promise that resolves to the TransactionResponse object.
packages/account/src/wallet/base-wallet-unlocked.ts:113
signMessage(
message
):Promise
<string
>
Signs a message with the wallet's private key.
• message: string
The message to sign.
Promise
<string
>
A promise that resolves to the signature as a ECDSA 64 bytes string.
Account.signMessage
packages/account/src/wallet/base-wallet-unlocked.ts:70
signTransaction(
transactionRequestLike
):Promise
<string
>
Signs a transaction with the wallet's private key.
• transactionRequestLike: TransactionRequestLike
The transaction request to sign.
Promise
<string
>
A promise that resolves to the signature as a ECDSA 64 bytes string.
packages/account/src/wallet/base-wallet-unlocked.ts:81
simulateTransaction(
transactionRequestLike
,__namedParameters
):Promise
<CallResult
>
Populates the witness signature for a transaction and sends a call to the network using provider.dryRun
.
• transactionRequestLike: TransactionRequestLike
The transaction request to simulate.
• __namedParameters: EstimateTransactionParams
= {}
Promise
<CallResult
>
A promise that resolves to the CallResult object.
packages/account/src/wallet/base-wallet-unlocked.ts:133
transfer(
destination
,amount
,assetId
?,txParams
?):Promise
<TransactionResponse
>
Transfers coins to a destination address.
• 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).
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
packages/account/src/account.ts:355
transferToContract(
contractId
,amount
,assetId
?,txParams
?):Promise
<TransactionResponse
>
Transfers coins to a contract address.
• 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).
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
packages/account/src/account.ts:428
withdrawToBaseLayer(
recipient
,amount
,txParams
):Promise
<TransactionResponse
>
Withdraws an amount of the base asset to the base chain.
• recipient: string
| AbstractAddress
Address of the recipient on the base chain.
• amount: BigNumberish
Amount of base asset.
• txParams: TxParamsType
= {}
The transaction parameters (optional).
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.