WOTSWallet constructor
Implementation
WOTSWallet({
this.name,
Uint8List? wots,
Uint8List? addrTag,
Uint8List? secret,
}) {
if (secret != null && secret.length != 32) {
throw ArgumentError('Invalid secret length');
}
if (addrTag != null && addrTag.length != WotsAddress.ADDR_TAG_LEN) {
throw ArgumentError('Invalid address tag');
}
// Store copies of the arrays
_wots = wots != null ? Uint8List.fromList(wots) : null;
_addrTag = addrTag != null ? Uint8List.fromList(addrTag) : null;
_secret = secret != null ? Uint8List.fromList(secret) : null;
// Create hex strings
wotsAddrHex = _wots != null ? ByteUtils.bytesToHex(_wots!) : null;
addrTagHex = _addrTag != null ? ByteUtils.bytesToHex(_addrTag!) : null;
mochimoAddr = (_wots != null)
? WotsAddress.wotsAddressFromBytes(_wots!.sublist(0, WOTS.WOTSSIGBYTES))
: null;
if (mochimoAddr != null && _addrTag != null) {
mochimoAddr!.setTag(_addrTag!);
}
}