Skip to content

Commit c86f2f9

Browse files
committed
update return of create, cancel and update orders to be bool
1 parent 20bbbef commit c86f2f9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/stellar_client/lib/src/client.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ class Client {
589589
/// - For example, instead of writing `.1`, the price should be written as `0.1`.
590590
/// - **Correct format**: `0.1`
591591
/// - **Incorrect format**: `.1`
592-
Future<SubmitTransactionResponse> createOrder(
592+
Future<bool> createOrder(
593593
{required String sellingAssetCode,
594594
required String buyingAssetCode,
595595
required String amount,
@@ -651,8 +651,9 @@ class Client {
651651
await _sdk.submitTransaction(transaction);
652652
if (!response.success) {
653653
logger.e('Transaction failed with result: ${response.resultXdr}');
654+
return false;
654655
}
655-
return response;
656+
return true;
656657
} catch (error) {
657658
throw Exception('Transaction failed due to: ${error.toString()}');
658659
}
@@ -664,7 +665,7 @@ class Client {
664665
///
665666
/// **Note:** Cancelling an order requires having XLM in the account
666667
/// to cover transaction fees and reserve requirements.
667-
Future<SubmitTransactionResponse> cancelOrder(
668+
Future<bool> cancelOrder(
668669
{required String sellingAssetCode,
669670
required String buyingAssetCode,
670671
required String offerId,
@@ -702,8 +703,9 @@ class Client {
702703
await _sdk.submitTransaction(transaction);
703704
if (!response.success) {
704705
logger.e('Transaction failed with result: ${response.resultXdr}');
706+
return false;
705707
}
706-
return response;
708+
return true;
707709
} catch (error) {
708710
throw Exception('Transaction failed due to: ${error.toString()}');
709711
}
@@ -721,7 +723,7 @@ class Client {
721723
/// - For example, instead of writing `.1`, the price should be written as `0.1`.
722724
/// - **Correct format**: `0.1`
723725
/// - **Incorrect format**: `.1`
724-
Future<SubmitTransactionResponse> updateOrder(
726+
Future<bool> updateOrder(
725727
{required String sellingAssetCode,
726728
required String buyingAssetCode,
727729
required String amount,
@@ -762,8 +764,9 @@ class Client {
762764
await _sdk.submitTransaction(transaction);
763765
if (!response.success) {
764766
logger.e('Transaction failed with result: ${response.resultXdr}');
767+
return false;
765768
}
766-
return response;
769+
return true;
767770
} catch (error) {
768771
throw Exception('Transaction failed due to: ${error.toString()}');
769772
}

0 commit comments

Comments
 (0)