Skip to content

Commit

Permalink
remove temp object in GetOffers
Browse files Browse the repository at this point in the history
  • Loading branch information
dkackman committed Mar 25, 2022
1 parent d24fb46 commit a2e0e43
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/chia-dotnet/TradeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,11 @@ public async Task<IEnumerable<OfferRecord>> GetOffers(int start, int end, bool e

var response = await WalletProxy.SendMessage("get_all_offers", data, cancellationToken).ConfigureAwait(false);

var rTemp = new
{
response.offers,
response.success,
response.trade_records
};

var tradeRecords = Converters.ToObject<TradeRecord[]>((rTemp.trade_records as object).ToJson());
var offers = Converters.ToObject<string[]>((rTemp.offers as object).ToJson());
// need to explicitly decalre these two types to cast away any dynamicness
TradeRecord[] tradeRecords = Converters.ToObject<TradeRecord[]>(response.trade_records);
string[] offers = Converters.ToObject<string[]>(response.offers);

var zipped = offers!.Zip(tradeRecords!);
var zipped = offers.Zip(tradeRecords);

return from zip in zipped
select new OfferRecord()
Expand Down

0 comments on commit a2e0e43

Please sign in to comment.