cli: fix build with v1 api changes
This commit is contained in:
parent
0103d2f621
commit
1b32d7f52f
@ -32,6 +32,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
@ -806,7 +807,7 @@ var ChainGetCmd = &cli.Command{
|
|||||||
|
|
||||||
type apiIpldStore struct {
|
type apiIpldStore struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
api lapi.FullNode
|
api v0api.FullNode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ht *apiIpldStore) Context() context.Context {
|
func (ht *apiIpldStore) Context() context.Context {
|
||||||
@ -834,7 +835,7 @@ func (ht *apiIpldStore) Put(ctx context.Context, v interface{}) (cid.Cid, error)
|
|||||||
panic("No mutations allowed")
|
panic("No mutations allowed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleAmt(ctx context.Context, api lapi.FullNode, r cid.Cid) error {
|
func handleAmt(ctx context.Context, api v0api.FullNode, r cid.Cid) error {
|
||||||
s := &apiIpldStore{ctx, api}
|
s := &apiIpldStore{ctx, api}
|
||||||
mp, err := adt.AsArray(s, r)
|
mp, err := adt.AsArray(s, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -847,7 +848,7 @@ func handleAmt(ctx context.Context, api lapi.FullNode, r cid.Cid) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleHamtEpoch(ctx context.Context, api lapi.FullNode, r cid.Cid) error {
|
func handleHamtEpoch(ctx context.Context, api v0api.FullNode, r cid.Cid) error {
|
||||||
s := &apiIpldStore{ctx, api}
|
s := &apiIpldStore{ctx, api}
|
||||||
mp, err := adt.AsMap(s, r)
|
mp, err := adt.AsMap(s, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -865,7 +866,7 @@ func handleHamtEpoch(ctx context.Context, api lapi.FullNode, r cid.Cid) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleHamtAddress(ctx context.Context, api lapi.FullNode, r cid.Cid) error {
|
func handleHamtAddress(ctx context.Context, api v0api.FullNode, r cid.Cid) error {
|
||||||
s := &apiIpldStore{ctx, api}
|
s := &apiIpldStore{ctx, api}
|
||||||
mp, err := adt.AsMap(s, r)
|
mp, err := adt.AsMap(s, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -40,6 +40,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||||
@ -1340,7 +1341,7 @@ type QueriedAsk struct {
|
|||||||
Ping time.Duration
|
Ping time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAsks(ctx context.Context, api lapi.FullNode) ([]QueriedAsk, error) {
|
func GetAsks(ctx context.Context, api v0api.FullNode) ([]QueriedAsk, error) {
|
||||||
isTTY := true
|
isTTY := true
|
||||||
if fileInfo, _ := os.Stdout.Stat(); (fileInfo.Mode() & os.ModeCharDevice) == 0 {
|
if fileInfo, _ := os.Stdout.Stat(); (fileInfo.Mode() & os.ModeCharDevice) == 0 {
|
||||||
isTTY = false
|
isTTY = false
|
||||||
@ -1647,7 +1648,7 @@ var clientListDeals = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func dealFromDealInfo(ctx context.Context, full api.FullNode, head *types.TipSet, v api.DealInfo) deal {
|
func dealFromDealInfo(ctx context.Context, full v0api.FullNode, head *types.TipSet, v api.DealInfo) deal {
|
||||||
if v.DealID == 0 {
|
if v.DealID == 0 {
|
||||||
return deal{
|
return deal{
|
||||||
LocalDeal: v,
|
LocalDeal: v,
|
||||||
@ -1666,7 +1667,7 @@ func dealFromDealInfo(ctx context.Context, full api.FullNode, head *types.TipSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode, localDeals []lapi.DealInfo, verbose bool, color bool, showFailed bool) error {
|
func outputStorageDeals(ctx context.Context, out io.Writer, full v0api.FullNode, localDeals []lapi.DealInfo, verbose bool, color bool, showFailed bool) error {
|
||||||
sort.Slice(localDeals, func(i, j int) bool {
|
sort.Slice(localDeals, func(i, j int) bool {
|
||||||
return localDeals[i].CreationTime.Before(localDeals[j].CreationTime)
|
return localDeals[i].CreationTime.Before(localDeals[j].CreationTime)
|
||||||
})
|
})
|
||||||
@ -2285,7 +2286,7 @@ func ellipsis(s string, length int) string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func inspectDealCmd(ctx context.Context, api lapi.FullNode, proposalCid string, dealId int) error {
|
func inspectDealCmd(ctx context.Context, api v0api.FullNode, proposalCid string, dealId int) error {
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
@ -356,7 +357,7 @@ var disputerStartCmd = &cli.Command{
|
|||||||
|
|
||||||
// for a given miner, index, and maxPostIndex, tries to dispute posts from 0...postsSnapshotted-1
|
// for a given miner, index, and maxPostIndex, tries to dispute posts from 0...postsSnapshotted-1
|
||||||
// returns a list of DisputeWindowedPoSt msgs that are expected to succeed if sent
|
// returns a list of DisputeWindowedPoSt msgs that are expected to succeed if sent
|
||||||
func makeDisputeWindowedPosts(ctx context.Context, api lapi.FullNode, dl minerDeadline, postsSnapshotted uint64, sender address.Address) ([]*types.Message, error) {
|
func makeDisputeWindowedPosts(ctx context.Context, api v0api.FullNode, dl minerDeadline, postsSnapshotted uint64, sender address.Address) ([]*types.Message, error) {
|
||||||
disputes := make([]*types.Message, 0)
|
disputes := make([]*types.Message, 0)
|
||||||
|
|
||||||
for i := uint64(0); i < postsSnapshotted; i++ {
|
for i := uint64(0); i < postsSnapshotted; i++ {
|
||||||
@ -388,7 +389,7 @@ func makeDisputeWindowedPosts(ctx context.Context, api lapi.FullNode, dl minerDe
|
|||||||
return disputes, nil
|
return disputes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeMinerDeadline(ctx context.Context, api lapi.FullNode, mAddr address.Address) (abi.ChainEpoch, *minerDeadline, error) {
|
func makeMinerDeadline(ctx context.Context, api v0api.FullNode, mAddr address.Address) (abi.ChainEpoch, *minerDeadline, error) {
|
||||||
dl, err := api.StateMinerProvingDeadline(ctx, mAddr, types.EmptyTSK)
|
dl, err := api.StateMinerProvingDeadline(ctx, mAddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, nil, xerrors.Errorf("getting proving index list: %w", err)
|
return -1, nil, xerrors.Errorf("getting proving index list: %w", err)
|
||||||
@ -400,7 +401,7 @@ func makeMinerDeadline(ctx context.Context, api lapi.FullNode, mAddr address.Add
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSender(ctx context.Context, api lapi.FullNode, fromStr string) (address.Address, error) {
|
func getSender(ctx context.Context, api v0api.FullNode, fromStr string) (address.Address, error) {
|
||||||
if fromStr == "" {
|
if fromStr == "" {
|
||||||
return api.WalletDefaultAddress(ctx)
|
return api.WalletDefaultAddress(ctx)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-jsonrpc"
|
"github.com/filecoin-project/go-jsonrpc"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
types "github.com/filecoin-project/lotus/chain/types"
|
types "github.com/filecoin-project/lotus/chain/types"
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
@ -35,7 +35,7 @@ type ServicesAPI interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ServicesImpl struct {
|
type ServicesImpl struct {
|
||||||
api api.FullNode
|
api v0api.FullNode
|
||||||
closer jsonrpc.ClientCloser
|
closer jsonrpc.ClientCloser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,11 +6,12 @@ package cli
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
reflect "reflect"
|
||||||
|
|
||||||
go_address "github.com/filecoin-project/go-address"
|
go_address "github.com/filecoin-project/go-address"
|
||||||
abi "github.com/filecoin-project/go-state-types/abi"
|
abi "github.com/filecoin-project/go-state-types/abi"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
go_cid "github.com/ipfs/go-cid"
|
go_cid "github.com/ipfs/go-cid"
|
||||||
reflect "reflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockServicesAPI is a mock of ServicesAPI interface
|
// MockServicesAPI is a mock of ServicesAPI interface
|
||||||
|
12
cli/state.go
12
cli/state.go
@ -15,6 +15,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
@ -178,7 +180,7 @@ func ParseTipSetString(ts string) ([]cid.Cid, error) {
|
|||||||
return cids, nil
|
return cids, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadTipSet(ctx context.Context, cctx *cli.Context, api api.FullNode) (*types.TipSet, error) {
|
func LoadTipSet(ctx context.Context, cctx *cli.Context, api v0api.FullNode) (*types.TipSet, error) {
|
||||||
tss := cctx.String("tipset")
|
tss := cctx.String("tipset")
|
||||||
if tss == "" {
|
if tss == "" {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@ -187,7 +189,7 @@ func LoadTipSet(ctx context.Context, cctx *cli.Context, api api.FullNode) (*type
|
|||||||
return ParseTipSetRef(ctx, api, tss)
|
return ParseTipSetRef(ctx, api, tss)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseTipSetRef(ctx context.Context, api api.FullNode, tss string) (*types.TipSet, error) {
|
func ParseTipSetRef(ctx context.Context, api v0api.FullNode, tss string) (*types.TipSet, error) {
|
||||||
if tss[0] == '@' {
|
if tss[0] == '@' {
|
||||||
if tss == "@head" {
|
if tss == "@head" {
|
||||||
return api.ChainHead(ctx)
|
return api.ChainHead(ctx)
|
||||||
@ -574,7 +576,7 @@ var StateListMinersCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDealsCounts(ctx context.Context, lapi api.FullNode) (map[address.Address]int, error) {
|
func getDealsCounts(ctx context.Context, lapi v0api.FullNode) (map[address.Address]int, error) {
|
||||||
allDeals, err := lapi.StateMarketDeals(ctx, types.EmptyTSK)
|
allDeals, err := lapi.StateMarketDeals(ctx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1443,7 +1445,7 @@ var StateSearchMsgCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func printReceiptReturn(ctx context.Context, api api.FullNode, m *types.Message, r types.MessageReceipt) error {
|
func printReceiptReturn(ctx context.Context, api v0api.FullNode, m *types.Message, r types.MessageReceipt) error {
|
||||||
if len(r.Return) == 0 {
|
if len(r.Return) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1463,7 +1465,7 @@ func printReceiptReturn(ctx context.Context, api api.FullNode, m *types.Message,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printMsg(ctx context.Context, api api.FullNode, msg cid.Cid, mw *lapi.MsgLookup, m *types.Message) error {
|
func printMsg(ctx context.Context, api v0api.FullNode, msg cid.Cid, mw *lapi.MsgLookup, m *types.Message) error {
|
||||||
if mw != nil {
|
if mw != nil {
|
||||||
if mw.Message != msg {
|
if mw.Message != msg {
|
||||||
fmt.Printf("Message was replaced: %s\n", mw.Message)
|
fmt.Printf("Message was replaced: %s\n", mw.Message)
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -240,7 +241,7 @@ var SyncCheckpointCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func SyncWait(ctx context.Context, napi api.FullNode, watch bool) error {
|
func SyncWait(ctx context.Context, napi v0api.FullNode, watch bool) error {
|
||||||
tick := time.Second / 4
|
tick := time.Second / 4
|
||||||
|
|
||||||
lastLines := 0
|
lastLines := 0
|
||||||
|
@ -10,12 +10,12 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseTipSet(ctx context.Context, api api.FullNode, vals []string) (*types.TipSet, error) {
|
func parseTipSet(ctx context.Context, api v0api.FullNode, vals []string) (*types.TipSet, error) {
|
||||||
var headers []*types.BlockHeader
|
var headers []*types.BlockHeader
|
||||||
for _, c := range vals {
|
for _, c := range vals {
|
||||||
blkc, err := cid.Decode(c)
|
blkc, err := cid.Decode(c)
|
||||||
|
@ -520,8 +520,8 @@ func (a *StateAPI) MinerCreateBlock(ctx context.Context, bt *api.BlockTemplate)
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *StateModule) StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64, lookbackLimit abi.ChainEpoch) (*api.MsgLookup, error) {
|
func (m *StateModule) StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64, lookbackLimit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error) {
|
||||||
ts, recpt, found, err := m.StateManager.WaitForMessage(ctx, msg, confidence, lookbackLimit)
|
ts, recpt, found, err := m.StateManager.WaitForMessage(ctx, msg, confidence, lookbackLimit, allowReplaced)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user