Merge pull request #1480 from filecoin-project/feat/better-deal-info

Better deal info at the command line
This commit is contained in:
Whyrusleeping 2020-03-31 13:29:07 -07:00 committed by GitHub
commit ea135991e3
4 changed files with 11 additions and 7 deletions

View File

@ -178,9 +178,10 @@ type Import struct {
type DealInfo struct {
ProposalCid cid.Cid
State storagemarket.StorageDealStatus
Message string // more information about deal state, particularly errors
Provider address.Address
PieceRef []byte // cid bytes
PieceCID cid.Cid
Size uint64
PricePerEpoch types.BigInt

View File

@ -429,9 +429,9 @@ var clientListDeals = &cli.Command{
}
w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
fmt.Fprintf(w, "DealCid\tProvider\tState\tPieceRef\tSize\tPrice\tDuration\n")
fmt.Fprintf(w, "DealCid\tProvider\tState\tPieceCID\tSize\tPrice\tDuration\tMessage\n")
for _, d := range deals {
fmt.Fprintf(w, "%s\t%s\t%s\t%x\t%d\t%s\t%d\n", d.ProposalCid, d.Provider, storagemarket.DealStates[d.State], d.PieceRef, d.Size, d.PricePerEpoch, d.Duration)
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%s\t%d\t%s\n", d.ProposalCid, d.Provider, storagemarket.DealStates[d.State], d.PieceCID, d.Size, d.PricePerEpoch, d.Duration, d.Message)
}
return w.Flush()
},

View File

@ -86,7 +86,7 @@ var dealsListCmd = &cli.Command{
ctx := lcli.DaemonContext(cctx)
deals, err := api.DealsList(ctx)
deals, err := api.MarketListIncompleteDeals(ctx)
if err != nil {
return err
}

View File

@ -3,10 +3,11 @@ package client
import (
"context"
"errors"
"github.com/filecoin-project/sector-storage/ffiwrapper"
"io"
"os"
"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"golang.org/x/xerrors"
@ -125,9 +126,10 @@ func (a *API) ClientListDeals(ctx context.Context) ([]api.DealInfo, error) {
out[k] = api.DealInfo{
ProposalCid: v.ProposalCid,
State: v.State,
Message: v.Message,
Provider: v.Proposal.Provider,
PieceRef: v.Proposal.PieceCID.Bytes(),
PieceCID: v.Proposal.PieceCID,
Size: uint64(v.Proposal.PieceSize.Unpadded()),
PricePerEpoch: v.Proposal.StoragePricePerEpoch,
@ -148,8 +150,9 @@ func (a *API) ClientGetDealInfo(ctx context.Context, d cid.Cid) (*api.DealInfo,
return &api.DealInfo{
ProposalCid: v.ProposalCid,
State: v.State,
Message: v.Message,
Provider: v.Proposal.Provider,
PieceRef: v.Proposal.PieceCID.Bytes(),
PieceCID: v.Proposal.PieceCID,
Size: uint64(v.Proposal.PieceSize.Unpadded()),
PricePerEpoch: v.Proposal.StoragePricePerEpoch,
Duration: uint64(v.Proposal.Duration()),