MochimoTransaction.sign constructor
MochimoTransaction.sign({
- required WOTSWallet source,
- required WOTSWallet change,
- required List<
TxDestination> destinations, - required BigInt changeAmount,
- required BigInt fee,
- BigInt? blockToLive,
Signs a spend from source.
change is the next one-time key. Its public key becomes the change
address, under the same 20-byte account tag as source. The source and
change hashes must differ, and a destination tag must differ from the
source tag. Those are checks in tx_val.
Implementation
factory MochimoTransaction.sign({
required WOTSWallet source,
required WOTSWallet change,
required List<TxDestination> destinations,
required BigInt changeAmount,
required BigInt fee,
BigInt? blockToLive,
}) {
final secret = source.getSecret();
final wots = source.getWots();
final tag = source.getAddrTag();
final next = change.getWots();
if (secret == null || wots == null || tag == null || next == null) {
throw StateError(
'Source and change wallets need a key and an account tag');
}
return MochimoTransaction.signWithKey(
signingSeed: secret,
sourceWots: wots,
accountTag: tag,
changeAddress: changeAddress(tag, next.sublist(0, WOTS.WOTSSIGBYTES)),
destinations: destinations,
changeAmount: changeAmount,
fee: fee,
blockToLive: blockToLive,
);
}