Wallet class

Represents a wallet which contains the hex private key, the hex public key and the hex address. In order to create one properly, the Wallet.derive method should always be used. The associated networkInfo will be used when computing the bech32Address associated with the wallet.

Constructors

Wallet({required NetworkInfo networkInfo, required Uint8List address, required Uint8List privateKey, required Uint8List publicKey})
Wallet.convert(Wallet wallet, NetworkInfo networkInfo)
Creates a new Wallet instance based on the existent wallet for the given networkInfo.
factory
Wallet.derive(List<String> mnemonic, NetworkInfo networkInfo, {String derivationPath = derivationPath})
Derives the private key from the given mnemonic using the specified networkInfo.
factory
Wallet.fromJson(Map<String, dynamic> json, Uint8List privateKey)
Creates a new Wallet instance from the given json and privateKey.
factory
Wallet.import(NetworkInfo networkInfo, Uint8List privateKey)
Creates a new Wallet instance from privateKey.
factory
Wallet.random(NetworkInfo networkInfo, {String derivationPath = derivationPath})
Generated a new random Wallet using the specified networkInfo and the optional derivationPath.
factory

Properties

address Uint8List
final
bech32Address String
Returns the associated address as a Bech32 string.
no setter
ecPublicKey → ECPublicKey
Returns the associated publicKey as an ECPublicKey instance.
no setter
hashCode int
The hash code for this object.
no setterinherited
networkInfo NetworkInfo
final
privateKey Uint8List
final
props List<Object>
The list of properties that will be used to determine whether two instances are equal.
no setter
publicKey Uint8List
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign(Uint8List data) Uint8List
Hashes the given data with SHA-256, and then sign the hash using the private key associated with this wallet, returning the signature encoded as a 64 bytes array.
toJson() Map<String, dynamic>
Converts the current Wallet instance into a JSON object. Note that the private key is not serialized for safety reasons.
toString() String
A string representation of this object.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

derivationPath → const String