Wallet class
The Wallet class inherits Signer and can sign transactions and messages using a private key as a standard Externally Owned Account (EOA).
Constructors
-
Wallet(String privateKey, [Provider<
_ProviderImpl> ? provider]) -
Create a new Wallet instance for
privateKey
and optionally connected to theprovider
.factory - Wallet.createRandom()
-
Returns a new Wallet with a random private key, generated from cryptographically secure entropy sources. If the current environment does not have a secure entropy source, an error is thrown.
factory
- Wallet.fromEncryptedJsonSync(String json, String password)
-
Create an instance from an encrypted JSON wallet.
factory
- Wallet.fromMnemonic(String mnemonic, [String? path])
-
Create an instance from a
mnemonic
phrase.factory
Properties
- address → String
-
The Address of this EOA.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- impl → _WalletImpl
-
Internal JS Object, should not be used directly.
finalinherited
- mnemonic → Mnemonic?
-
The account HD mnemonic, if it has one and can be determined. Some sources do not encode the mnemonic, such as HD extended keys.
no setter
- privateKey → String
-
The privateKey of this EOA
no setter
-
provider
→ Provider<
_ProviderImpl> ? -
The provider this wallet is connected to, which will be used for any Blockchain Methods methods. This can be
null
.no setter - publicKey → String
-
The uncompressed public key for this Wallet represents.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
TransactionRequest request) → Future< String> -
Returns the result of calling using the
request
, with this account address being used as the from field.inherited -
connect(
Provider< _ProviderImpl> provider) → Wallet -
Connect this Signer to new
provider
. May simply throw an error if changing providers is not supported.override -
encrypt(
String password, [void progressCallback(double progress)?]) → Future< String> -
Encrypt the wallet using
password
returning a Future which resolves to a JSON wallet. -
estimateGas(
TransactionRequest request) → Future< BigInt> -
Returns the result of estimating the cost to send the
request
, with this account address being used as the from field.inherited -
getAddress(
) → Future< String> -
Returns a Future that resolves to the account address.
inherited
-
getBalance(
[dynamic blockTag]) → Future< BigInt> -
Returns the balance of this wallet at
blockTag
.inherited -
getChainId(
) → Future< int> -
Returns the chain ID this wallet is connected to.
inherited
-
getGasPrice(
) → Future< BigInt> -
Returns the current gas price.
inherited
-
getTransactionCount(
[dynamic blockTag]) → Future< int> -
Returns the number of transactions this account has ever sent at
blockTag
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendTransaction(
TransactionRequest request) → Future< TransactionResponse> -
Submits transaction to the network to be mined.
inherited
-
signMessage(
String message) → Future< String> -
Returns a Future which resolves to the Raw Signature of
message
.inherited -
signTransaction(
TransactionRequest request) → Future< String> -
Returns a Future which resolves to the signed transaction of the
request
. This method does not populate any missing fields.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited