Make gateway work with v1 api

This commit is contained in:
Łukasz Magiera
2021-04-05 13:47:10 +02:00
parent deb2b90b6a
commit d8bff4d19f
13 changed files with 91 additions and 252 deletions
+14
View File
@@ -3,6 +3,7 @@ package cliutil
import (
"context"
"fmt"
"github.com/filecoin-project/lotus/api/v1api"
"net/http"
"net/url"
"os"
@@ -187,6 +188,19 @@ func GetFullNodeAPI(ctx *cli.Context) (v0api.FullNode, jsonrpc.ClientCloser, err
return client.NewFullNodeRPCV0(ctx.Context, addr, headers)
}
func GetFullNodeAPIV1(ctx *cli.Context) (v1api.FullNode, jsonrpc.ClientCloser, error) {
if tn, ok := ctx.App.Metadata["testnode-full"]; ok {
return tn.(v1api.FullNode), func() {}, nil
}
addr, headers, err := GetRawAPI(ctx, repo.FullNode, "v1")
if err != nil {
return nil, nil, err
}
return client.NewFullNodeRPCV1(ctx.Context, addr, headers)
}
type GetStorageMinerOptions struct {
PreferHttp bool
}