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,
}) async {
try {
String result = await compute(_createTransactionWrapper, (
String result = await compute(_createTransactionWrapper, (
wallet: wallet,
amount: amount,
address: address,
@ -579,7 +579,7 @@ abstract class LibEpiccash {
///
///
///
static Future<String> txHttpSend({
static Future<({String commitId, String slateId})> txHttpSend({
required String wallet,
required int selectionStrategyIsAll,
required int minimumConfirmations,
@ -588,7 +588,7 @@ abstract class LibEpiccash {
required String address,
}) async {
try {
return await compute(_txHttpSendWrapper, (
var result = await compute(_txHttpSendWrapper, (
wallet: wallet,
selectionStrategyIsAll: selectionStrategyIsAll,
minimumConfirmations: minimumConfirmations,
@ -596,6 +596,22 @@ abstract class LibEpiccash {
amount: amount,
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) {
throw ("Error sending tx HTTP : ${e.toString()}");
}