@fuel-ts/account v0.94.5 • Docs
Class: WalletLocked
WalletLocked
provides the functionalities for a locked wallet.
Extends
Constructors
new WalletLocked()
new WalletLocked(
address
,provider
?,connector
?):WalletLocked
Creates a new Account instance.
Parameters
• address: string
| AbstractAddress
The address of the account.
• provider?: Provider
A Provider instance (optional).
• connector?: FuelConnector
A FuelConnector instance (optional).
Returns
Inherited from
Defined in
packages/account/src/account.ts:96
Properties
_connector?
protected
optional
_connector:FuelConnector
The connector for use with external wallets
Inherited from
Defined in
packages/account/src/account.ts:87
_provider?
protected
optional
_provider:Provider
The provider used to interact with the network.
Inherited from
Defined in
packages/account/src/account.ts:82
address
readonly
address:AbstractAddress
The address associated with the account.
Inherited from
Defined in
packages/account/src/account.ts:77
Accessors
provider
get
provider():Provider
The provider used to interact with the network.
Throws
FuelError
if the provider is not set.
set
provider(provider
):void
Sets the provider for the account.
Parameters
• provider: Provider
A Provider instance.
Returns
A Provider instance.
Inherited from
Defined in
packages/account/src/account.ts:110
Methods
addBatchTransfer()
addBatchTransfer(
request
,transferParams
):ScriptTransactionRequest
Adds multiple transfers to a script transaction request.
Parameters
• request: ScriptTransactionRequest
The script transaction request to add transfers to.
• transferParams: TransferParams
[]
An array of TransferParams
objects representing the transfers to be made.
Returns
The updated script transaction request.
Inherited from
Defined in
packages/account/src/account.ts:407
addTransfer()
addTransfer(
request
,transferParams
):ScriptTransactionRequest
Adds a transfer to the given transaction request.
Parameters
• request: ScriptTransactionRequest
The script transaction request to add transfers to.
• transferParams: TransferParams
The object representing the transfer to be made.
Returns
The updated transaction request with the added transfer.
Inherited from
Defined in
packages/account/src/account.ts:389
batchTransfer()
batchTransfer(
transferParams
,txParams
):Promise
<TransactionResponse
>
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.
Inherited from
Defined in
packages/account/src/account.ts:372
connect()
connect(
provider
):Provider
Changes the provider connection for the account.
Parameters
• provider: Provider
A Provider instance.
Returns
The updated Provider instance.
Inherited from
Defined in
packages/account/src/account.ts:133
createTransfer()
createTransfer(
destination
,amount
,assetId
?,txParams
?):Promise
<ScriptTransactionRequest
>
A helper that creates a transfer transaction request and returns it.
Parameters
• 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).
Returns
Promise
<ScriptTransactionRequest
>
A promise that resolves to the prepared transaction request.
Inherited from
Defined in
packages/account/src/account.ts:334
fund()
fund<
T
>(request
,params
):Promise
<T
>
Funds a transaction request by adding the necessary resources.
Type Parameters
• T extends TransactionRequest
The type of the TransactionRequest.
Parameters
• request: T
The transaction request to fund.
• params: EstimatedTxParams
The estimated transaction parameters.
Returns
Promise
<T
>
A promise that resolves to the funded transaction request.
Inherited from
Defined in
packages/account/src/account.ts:203
generateFakeResources()
generateFakeResources(
coins
):Resource
[]
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.
Inherited from
Defined in
packages/account/src/account.ts:671
getBalance()
getBalance(
assetId
?):Promise
<BN
>
Retrieves the balance of the account for the given asset.
Parameters
• assetId?: BytesLike
The asset ID to check the balance for (optional).
Returns
Promise
<BN
>
A promise that resolves to the balance amount.
Inherited from
Defined in
packages/account/src/account.ts:180
getBalances()
getBalances():
Promise
<GetBalancesResponse
>
Retrieves all the balances for the account.
Returns
Promise
<GetBalancesResponse
>
A promise that resolves to an array of Coins and their quantities.
Inherited from
Defined in
packages/account/src/account.ts:191
getCoins()
getCoins(
assetId
?,paginationArgs
?):Promise
<GetCoinsResponse
>
Retrieves coins owned by the account.
Parameters
• assetId?: BytesLike
The asset ID of the coins to retrieve (optional).
• paginationArgs?: CursorPaginationArgs
Returns
Promise
<GetCoinsResponse
>
A promise that resolves to an array of Coins.
Inherited from
Defined in
packages/account/src/account.ts:158
getMessages()
getMessages(
paginationArgs
?):Promise
<GetMessagesResponse
>
Retrieves messages owned by the account.
Parameters
• paginationArgs?: CursorPaginationArgs
Returns
Promise
<GetMessagesResponse
>
A promise that resolves to an array of Messages.
Inherited from
Defined in
packages/account/src/account.ts:170
getResourcesToSpend()
getResourcesToSpend(
quantities
,excludedIds
?):Promise
<Resource
[]>
Retrieves resources satisfying the spend query for the account.
Parameters
• quantities: CoinQuantityLike
[]
Quantities of resources to be obtained.
• excludedIds?: ExcludeResourcesOption
IDs of resources to be excluded from the query (optional).
Returns
Promise
<Resource
[]>
A promise that resolves to an array of Resources.
Inherited from
Defined in
packages/account/src/account.ts:145
getTransactionCost()
getTransactionCost(
transactionRequestLike
,transactionCostParams
):Promise
<TransactionCost
>
Returns a transaction cost to enable user to set gasLimit and also reserve balance amounts on the transaction.
Parameters
• transactionRequestLike: TransactionRequestLike
The transaction request object.
• transactionCostParams: TransactionCostParams
= {}
The transaction cost parameters (optional).
Returns
Promise
<TransactionCost
>
A promise that resolves to the transaction cost object.
Inherited from
Defined in
packages/account/src/account.ts:530
sendTransaction()
sendTransaction(
transactionRequestLike
,sendTransactionParams
):Promise
<TransactionResponse
>
Sends a transaction to the network.
Parameters
• transactionRequestLike: TransactionRequestLike
The transaction request to be sent.
• sendTransactionParams: EstimateTransactionParams
= {}
The provider send transaction parameters (optional).
Returns
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
Inherited from
Defined in
packages/account/src/account.ts:629
signTransaction()
signTransaction(
transactionRequestLike
):Promise
<string
>
Signs a transaction from the account via the connector..
Parameters
• transactionRequestLike: TransactionRequestLike
The transaction request to sign.
Returns
Promise
<string
>
A promise that resolves to the signature of the transaction.
Inherited from
Defined in
packages/account/src/account.ts:612
simulateTransaction()
simulateTransaction(
transactionRequestLike
,estimateTxParams
):Promise
<CallResult
>
Simulates a transaction.
Parameters
• transactionRequestLike: TransactionRequestLike
The transaction request to be simulated.
• estimateTxParams: EstimateTransactionParams
= {}
The estimate transaction params (optional).
Returns
Promise
<CallResult
>
A promise that resolves to the call result.
Inherited from
Defined in
packages/account/src/account.ts:654
transfer()
transfer(
destination
,amount
,assetId
?,txParams
?):Promise
<TransactionResponse
>
Transfers coins to a destination address.
Parameters
• 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).
Returns
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
Inherited from
Defined in
packages/account/src/account.ts:355
transferToContract()
transferToContract(
contractId
,amount
,assetId
?,txParams
?):Promise
<TransactionResponse
>
Transfers coins to a contract address.
Parameters
• 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).
Returns
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
Inherited from
Defined in
packages/account/src/account.ts:428
unlock()
unlock(
privateKey
):WalletUnlocked
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
An instance of WalletUnlocked.
Defined in
packages/account/src/wallet/wallets.ts:33
withdrawToBaseLayer()
withdrawToBaseLayer(
recipient
,amount
,txParams
):Promise
<TransactionResponse
>
Withdraws an amount of the base asset to the base chain.
Parameters
• recipient: string
| AbstractAddress
Address of the recipient on the base chain.
• amount: BigNumberish
Amount of base asset.
• txParams: TxParamsType
= {}
The transaction parameters (optional).
Returns
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
Inherited from
Defined in
packages/account/src/account.ts:481