getMyOffers method
Fetches the user's own offers from the Haveno network.
Returns a List of OfferInfo objects representing the user's offers.
Throws a DaemonNotConnectedException if the client is not connected to the daemon.
Catches GrpcError
exceptions and handles them using handleGrpcError
.
Implementation
Future<List<OfferInfo>> getMyOffers() async {
if (!havenoChannel.isConnected) {
throw DaemonNotConnectedException();
}
// Fetch from the server
final getMyOffersReply = await havenoChannel.offersClient!.getMyOffers(GetMyOffersRequest());
var myOffers = getMyOffersReply.offers;
// Save to local database
List<OfferInfo> myTradeOffers = [];
try {
for (var myOffer in myOffers) {
myOffer.isMyOffer = true;
myTradeOffers.add(myOffer);
}
return myTradeOffers;
} on GrpcError catch (e) {
handleGrpcError(e);
return myTradeOffers;
}
}