Make MarketListDeals and DealsList return points for MarketDeal
This commit is contained in:
@@ -670,8 +670,8 @@ func (a *StateAPI) StateMarketParticipants(ctx context.Context, tsk types.TipSet
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]api.MarketDeal, error) {
|
||||
out := map[string]api.MarketDeal{}
|
||||
func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]*api.MarketDeal, error) {
|
||||
out := map[string]*api.MarketDeal{}
|
||||
|
||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||
if err != nil {
|
||||
@@ -700,7 +700,7 @@ func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (m
|
||||
} else if !found {
|
||||
s = market.EmptyDealState()
|
||||
}
|
||||
out[strconv.FormatInt(int64(dealID), 10)] = api.MarketDeal{
|
||||
out[strconv.FormatInt(int64(dealID), 10)] = &api.MarketDeal{
|
||||
Proposal: d,
|
||||
State: *s,
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ func (sm *StorageMinerAPI) MarketImportDealData(ctx context.Context, propCid cid
|
||||
return sm.StorageProvider.ImportDataForDeal(ctx, propCid, fi)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, error) {
|
||||
func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]*api.MarketDeal, error) {
|
||||
ts, err := sm.Full.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -465,7 +465,7 @@ func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var out []api.MarketDeal
|
||||
var out []*api.MarketDeal
|
||||
|
||||
for _, deal := range allDeals {
|
||||
if deal.Proposal.Provider == sm.Miner.Address() {
|
||||
@@ -476,7 +476,7 @@ func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, err
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]api.MarketDeal, error) {
|
||||
func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]*api.MarketDeal, error) {
|
||||
return sm.listDeals(ctx)
|
||||
}
|
||||
|
||||
@@ -1072,7 +1072,7 @@ func (sm *StorageMinerAPI) DagstoreLookupPieces(ctx context.Context, cid cid.Cid
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) DealsList(ctx context.Context) ([]api.MarketDeal, error) {
|
||||
func (sm *StorageMinerAPI) DealsList(ctx context.Context) ([]*api.MarketDeal, error) {
|
||||
return sm.listDeals(ctx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user