lotus/api/client/client.go

33 lines
819 B
Go
Raw Normal View History

package client
import (
2019-07-23 18:49:09 +00:00
"net/http"
"github.com/filecoin-project/go-lotus/api"
2019-07-08 12:46:30 +00:00
"github.com/filecoin-project/go-lotus/lib/jsonrpc"
)
// NewFullNodeRPC creates a new http jsonrpc client.
func NewFullNodeRPC(addr string, requestHeader http.Header) (api.FullNode, error) {
2019-07-24 00:09:34 +00:00
var res api.FullNodeStruct
_, err := jsonrpc.NewMergeClient(addr, "Filecoin",
[]interface{}{
&res.CommonStruct.Internal,
&res.Internal,
}, requestHeader)
2019-07-12 15:29:41 +00:00
return &res, err
}
// NewStorageMinerRPC creates a new http jsonrpc client for storage miner
func NewStorageMinerRPC(addr string, requestHeader http.Header) (api.StorageMiner, error) {
var res api.StorageMinerStruct
_, err := jsonrpc.NewMergeClient(addr, "Filecoin",
[]interface{}{
&res.CommonStruct.Internal,
&res.Internal,
}, requestHeader)
return &res, err
2019-07-24 01:10:26 +00:00
}