getPeerOffers method

Future<List<OfferInfo>> getPeerOffers()

Fetches the list of offers from peers on the Haveno network.

Returns a List of OfferInfo objects representing peer 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>> getPeerOffers() async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }

  List<OfferInfo> peerOffers = [];

  try {
    final getOffersReply = await havenoChannel.offersClient!.getOffers(GetOffersRequest());
    peerOffers = getOffersReply.offers;
    return peerOffers;
  } on GrpcError catch (e) {
    handleGrpcError(e);
    return peerOffers;
  }
}