sendAda method
Future<Result<ShelleyTransaction, String> >
sendAda({
- required ShelleyAddress toAddress,
- required int lovelace,
- int ttl = 0,
- int fee = 0,
- bool logTxHex = false,
- bool logTx = false,
override
Send ADA to another address.
Implementation
@override
Future<Result<ShelleyTransaction, String>> sendAda({
required ShelleyAddress toAddress,
required int lovelace,
int ttl = 0,
int fee = 0,
bool logTxHex = false,
bool logTx = false,
}) async {
final txResult = await buildSpendTransaction(
toAddress: toAddress,
lovelace: lovelace,
ttl: ttl,
fee: fee,
);
if (txResult.isErr()) {
return Err(txResult.unwrapErr());
}
if (logTxHex) {
print("tx hex: ${HEX.encode(txResult.unwrap().serialize)}");
}
if (logTx) {
print("tx: ${txResult.unwrap().toJson(prettyPrint: true)}");
}
final sendResult = submitTransaction(
tx: txResult.unwrap(),
);
return sendResult;
}