Skip to content

Commit

Permalink
Merge pull request #2154 from vegaprotocol/release/v0.23.1
Browse files Browse the repository at this point in the history
Release v0.23.1
  • Loading branch information
ashleyvega committed Aug 27, 2020
2 parents 17cccfd + 9d6adde commit e3a261a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.23.1

*2020-08-27*

This release backports a fix from the forthcoming 0.24.0 release that fixes a GraphQL issue with the new `Asset` type. When fetching the Assets from the top level, all the details came through. When fetching them as a nested property, only the ID was filled in. This is now fixed.

## Improvements

- [#2140](https://github.com/vegaprotocol/vega/pull/2140) GraphQL fix for fetching assets as nested properties

## 0.23.0

*2020-08-10*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Vega

Version 0.23.0.
Version 0.23.1.

A decentralised trading platform that allows pseudo-anonymous trading of derivatives on a blockchain.

Expand Down
43 changes: 41 additions & 2 deletions gateway/graphql/resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,27 @@ func (r *myPositionResolver) Market(ctx context.Context, obj *types.Position) (*
r.log.Error("tradingData client", logging.Error(err))
return nil, customErrorFromStatus(err)
}
return MarketFromProto(res.Market)
market, err := MarketFromProto(res.Market)
if err != nil {
r.log.Error("unable to convert market from proto", logging.Error(err))
return nil, err
}
// add the market name explicitly here as it does not
// come anymore from the market framework
market.Name = market.TradableInstrument.Instrument.Name
// set Asset here too
switch p := market.TradableInstrument.Instrument.Product.(type) {
case *Future:
req := protoapi.AssetByIDRequest{ID: p.Asset.ID}
res, err := r.tradingDataClient.AssetByID(context.Background(), &req)
if err != nil {
r.log.Error("tradingData client", logging.Error(err))
return nil, customErrorFromStatus(err)
}
p.Asset, err = AssetFromProto(res.Asset)
}

return market, nil
}

func (r *myPositionResolver) OpenVolume(ctx context.Context, obj *types.Position) (string, error) {
Expand Down Expand Up @@ -2316,7 +2336,26 @@ func (r *myAccountResolver) Market(ctx context.Context, acc *types.Account) (*Ma
r.log.Error("tradingData client", logging.Error(err))
return nil, customErrorFromStatus(err)
}
return MarketFromProto(res.Market)
market, err := MarketFromProto(res.Market)
if err != nil {
r.log.Error("unable to convert market from proto", logging.Error(err))
return nil, err
}
// add the market name explicitly here as it does not
// come anymore from the market framework
market.Name = market.TradableInstrument.Instrument.Name
// set Asset here too
switch p := market.TradableInstrument.Instrument.Product.(type) {
case *Future:
req := protoapi.AssetByIDRequest{ID: p.Asset.ID}
res, err := r.tradingDataClient.AssetByID(context.Background(), &req)
if err != nil {
r.log.Error("tradingData client", logging.Error(err))
return nil, customErrorFromStatus(err)
}
p.Asset, err = AssetFromProto(res.Asset)
}
return market, nil
}

return nil, nil
Expand Down

0 comments on commit e3a261a

Please sign in to comment.