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})
const
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 lastDerivationPathSegment = '0'})
Derives the private key from the given mnemonic using the specified networkInfo. Optionally can define a different derivation path setting lastDerivationPathSegment.
factory
Wallet.fromJson(Map<String, dynamic> json, Uint8List privateKey)
Creates a new Wallet instance from the given json and privateKey.
factory

Properties

address Uint8List
final
bech32Address String
Returns the associated address as a Bech32 string.
no setter
bech32PublicKey String
Returns the associated publicKey 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
Signs the given data using the private key associated with this wallet, returning the signature bytes ASN.1 DER encoded.
signTxData(List<int> data) Uint8List
Signs the given data using the associated privateKey and encodes the signature bytes to be included inside a transaction.
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.
inherited

Operators

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

Constants

BASE_DERIVATION_PATH → const String