diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 797951130..e3cec560f 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -9,15 +9,6 @@ import ( "net/url" "time" - "github.com/google/uuid" - blocks "github.com/ipfs/go-block-format" - "github.com/ipfs/go-cid" - "github.com/libp2p/go-libp2p/core/metrics" - "github.com/libp2p/go-libp2p/core/network" - "github.com/libp2p/go-libp2p/core/peer" - "github.com/libp2p/go-libp2p/core/protocol" - "golang.org/x/xerrors" - "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-bitfield" datatransfer "github.com/filecoin-project/go-data-transfer/v2" @@ -33,7 +24,6 @@ import ( "github.com/filecoin-project/go-state-types/dline" abinetwork "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/proof" - apitypes "github.com/filecoin-project/lotus/api/types" builtinactors "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -46,6 +36,14 @@ import ( "github.com/filecoin-project/lotus/storage/sealer/fsutil" "github.com/filecoin-project/lotus/storage/sealer/sealtasks" "github.com/filecoin-project/lotus/storage/sealer/storiface" + "github.com/google/uuid" + blocks "github.com/ipfs/go-block-format" + "github.com/ipfs/go-cid" + "github.com/libp2p/go-libp2p/core/metrics" + "github.com/libp2p/go-libp2p/core/network" + "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/core/protocol" + "golang.org/x/xerrors" ) var ErrNotSupported = xerrors.New("method not supported") @@ -838,6 +836,8 @@ type LotusProviderMethods struct { Shutdown func(p0 context.Context) error `perm:"admin"` + StorageAddLocal func(p0 context.Context, p1 string) error `perm:"admin"` + Version func(p0 context.Context) (Version, error) `perm:"admin"` } @@ -5227,6 +5227,17 @@ func (s *LotusProviderStub) Shutdown(p0 context.Context) error { return ErrNotSupported } +func (s *LotusProviderStruct) StorageAddLocal(p0 context.Context, p1 string) error { + if s.Internal.StorageAddLocal == nil { + return ErrNotSupported + } + return s.Internal.StorageAddLocal(p0, p1) +} + +func (s *LotusProviderStub) StorageAddLocal(p0 context.Context, p1 string) error { + return ErrNotSupported +} + func (s *LotusProviderStruct) Version(p0 context.Context) (Version, error) { if s.Internal.Version == nil { return *new(Version), ErrNotSupported diff --git a/api/v0api/proxy_gen.go b/api/v0api/proxy_gen.go index bd37f6429..c8f19fb26 100644 --- a/api/v0api/proxy_gen.go +++ b/api/v0api/proxy_gen.go @@ -5,11 +5,6 @@ package v0api import ( "context" - blocks "github.com/ipfs/go-block-format" - "github.com/ipfs/go-cid" - "github.com/libp2p/go-libp2p/core/peer" - "golang.org/x/xerrors" - "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-bitfield" datatransfer "github.com/filecoin-project/go-data-transfer/v2" @@ -21,7 +16,6 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" abinetwork "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/lotus/api" apitypes "github.com/filecoin-project/lotus/api/types" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -29,6 +23,10 @@ import ( marketevents "github.com/filecoin-project/lotus/markets/loggers" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo/imports" + blocks "github.com/ipfs/go-block-format" + "github.com/ipfs/go-cid" + "github.com/libp2p/go-libp2p/core/peer" + "golang.org/x/xerrors" ) var ErrNotSupported = xerrors.New("method not supported") diff --git a/cmd/lotus-provider/cli.go b/cmd/lotus-provider/cli.go index ace9c2e17..afe110d1a 100644 --- a/cmd/lotus-provider/cli.go +++ b/cmd/lotus-provider/cli.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/lotus/api" lcli "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/cmd/lotus-provider/deps" + "github.com/filecoin-project/lotus/cmd/lotus-provider/rpc" "github.com/gbrlsnchs/jwt/v3" manet "github.com/multiformats/go-multiaddr/net" "github.com/urfave/cli/v2" @@ -82,6 +83,8 @@ var cliCmd = &cli.Command{ if selection < 1 || selection > len(machines) { return xerrors.New("invalid selection") } + + machine = machines[selection-1].HostAndPort } var apiKeys []string @@ -164,7 +167,25 @@ var cliCmd = &cli.Command{ return xerrors.Errorf("net from addr (%v): %w", laddr, err) } - fmt.Printf("Token: %s:%s\n", string(apiToken), ma) + token := fmt.Sprintf("%s:%s", string(apiToken), ma) + if err := os.Setenv(providerEnvVar, token); err != nil { + return xerrors.Errorf("setting env var: %w", err) + } + } + + { + api, closer, err := rpc.GetProviderAPI(cctx) + if err != nil { + return err + } + defer closer() + + v, err := api.Version(ctx) + if err != nil { + return xerrors.Errorf("querying version: %w", err) + } + + fmt.Println("remote node version: ", v.String()) } return nil