pub struct Wallet { /* private fields */ }
Expand description

A FuelVM-compatible wallet that can be used to list assets, balances and more.

Note that instances of the Wallet type only know their public address, and as a result can only perform read-only operations.

In order to sign messages or send transactions, a Wallet must first call Wallet::unlock with a valid private key to produce a WalletUnlocked.

Implementations§

Construct a Wallet from its given public address.

Returns a proper vector of Input::Coins for the given asset ID, amount, and witness index. The witness_index is the position of the witness (signature) in the transaction’s list of witnesses. Meaning that, in the validation process, the node will use the witness at this index to validate the coins returned by this method.

Returns a vector containing the output coin and change output given an asset and amount

Gets all coins of asset asset_id owned by the wallet, even spent ones (this is useful for some particular cases, but in general, you should use get_spendable_coins). This returns actual coins (UTXOs).

Get some spendable resources (coins and messages) of asset asset_id owned by the wallet that add up at least to amount amount. The returned coins (UTXOs) are actual coins that can be spent. The number of UXTOs is optimized to prevent dust accumulation.

Get the balance of all spendable coins asset_id for address address. This is different from getting coins because we are just returning a number (the sum of UTXOs amount) instead of the UTXOs.

Get all the spendable balances of all assets for the wallet. This is different from getting the coins because we are only returning the sum of UTXOs coins amount and not the UTXOs coins themselves.

Unlock the wallet with the given private_key.

The private key will be stored in memory until wallet.lock() is called or until the wallet is dropped.

Craft a transaction used to transfer funds between two addresses.

Craft a transaction used to transfer funds to a contract.

Craft a transaction used to transfer funds to the base chain.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more