another merge conflict ?

This commit is contained in:
ryleedavis 2023-09-29 10:00:46 -06:00
parent 9a37b18615
commit 53b90fa01d

View file

@ -214,7 +214,7 @@ abstract class LibEpiccash {
required String note, required String note,
}) async { }) async {
try { try {
String result = await compute(_createTransactionWrapper, ( String result = await compute(_createTransactionWrapper, (
wallet: wallet, wallet: wallet,
amount: amount, amount: amount,
address: address, address: address,
@ -579,7 +579,7 @@ abstract class LibEpiccash {
/// ///
/// ///
/// ///
static Future<String> txHttpSend({ static Future<({String commitId, String slateId})> txHttpSend({
required String wallet, required String wallet,
required int selectionStrategyIsAll, required int selectionStrategyIsAll,
required int minimumConfirmations, required int minimumConfirmations,
@ -588,7 +588,7 @@ abstract class LibEpiccash {
required String address, required String address,
}) async { }) async {
try { try {
return await compute(_txHttpSendWrapper, ( var result = await compute(_txHttpSendWrapper, (
wallet: wallet, wallet: wallet,
selectionStrategyIsAll: selectionStrategyIsAll, selectionStrategyIsAll: selectionStrategyIsAll,
minimumConfirmations: minimumConfirmations, minimumConfirmations: minimumConfirmations,
@ -596,6 +596,22 @@ abstract class LibEpiccash {
amount: amount, amount: amount,
address: address, address: address,
)); ));
if (result.toUpperCase().contains("ERROR")) {
throw Exception("Error creating transaction ${result.toString()}");
}
//Decode sent tx and return Slate Id
final slate0 = jsonDecode(result);
final slate = jsonDecode(slate0[0] as String);
final part1 = jsonDecode(slate[0] as String);
final part2 = jsonDecode(slate[1] as String);
({String slateId, String commitId}) data = (
slateId: part1[0]['tx_slate_id'],
commitId: part2['tx']['body']['outputs'][0]['commit'],
);
return data;
} catch (e) { } catch (e) {
throw ("Error sending tx HTTP : ${e.toString()}"); throw ("Error sending tx HTTP : ${e.toString()}");
} }