forked from cerc-io/ipld-eth-server
fix subscribe command and client (remove rlp encoding of subscription params)
This commit is contained in:
parent
e917ccb973
commit
add6afadd7
@ -77,17 +77,17 @@ func serve() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startServers(server s.Server, settings *s.Config) error {
|
func startServers(server s.Server, settings *s.Config) error {
|
||||||
logWithCommand.Debug("starting up IPC server")
|
logWithCommand.Info("starting up IPC server")
|
||||||
_, _, err := rpc.StartIPCEndpoint(settings.IPCEndpoint, server.APIs())
|
_, _, err := rpc.StartIPCEndpoint(settings.IPCEndpoint, server.APIs())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logWithCommand.Debug("starting up WS server")
|
logWithCommand.Info("starting up WS server")
|
||||||
_, _, err = rpc.StartWSEndpoint(settings.WSEndpoint, server.APIs(), []string{"vdb"}, nil, true)
|
_, _, err = rpc.StartWSEndpoint(settings.WSEndpoint, server.APIs(), []string{"vdb"}, nil, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logWithCommand.Debug("starting up HTTP server")
|
logWithCommand.Info("starting up HTTP server")
|
||||||
_, _, err = rpc.StartHTTPEndpoint(settings.HTTPEndpoint, server.APIs(), []string{"eth"}, nil, nil, rpc.HTTPTimeouts{})
|
_, _, err = rpc.StartHTTPEndpoint(settings.HTTPEndpoint, server.APIs(), []string{"eth"}, nil, nil, rpc.HTTPTimeouts{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -70,11 +70,7 @@ func subscribe() {
|
|||||||
payloadChan := make(chan w.SubscriptionPayload, 20000)
|
payloadChan := make(chan w.SubscriptionPayload, 20000)
|
||||||
|
|
||||||
// Subscribe to the watcher service with the given config/filter parameters
|
// Subscribe to the watcher service with the given config/filter parameters
|
||||||
rlpParams, err := rlp.EncodeToBytes(ethSubConfig)
|
sub, err := subClient.Stream(payloadChan, *ethSubConfig)
|
||||||
if err != nil {
|
|
||||||
logWithCommand.Fatal(err)
|
|
||||||
}
|
|
||||||
sub, err := subClient.Stream(payloadChan, rlpParams)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logWithCommand.Fatal(err)
|
logWithCommand.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ package client
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/vulcanize/ipld-eth-server/pkg/eth"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
|
||||||
"github.com/vulcanize/ipld-eth-server/pkg/serve"
|
"github.com/vulcanize/ipld-eth-server/pkg/serve"
|
||||||
@ -38,6 +40,6 @@ func NewClient(c *rpc.Client) *Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stream is the main loop for subscribing to iplds from an ipld-eth-server server
|
// Stream is the main loop for subscribing to iplds from an ipld-eth-server server
|
||||||
func (c *Client) Stream(payloadChan chan serve.SubscriptionPayload, rlpParams []byte) (*rpc.ClientSubscription, error) {
|
func (c *Client) Stream(payloadChan chan serve.SubscriptionPayload, params eth.SubscriptionSettings) (*rpc.ClientSubscription, error) {
|
||||||
return c.c.Subscribe(context.Background(), "vdb", payloadChan, "stream", rlpParams)
|
return c.c.Subscribe(context.Background(), "vdb", payloadChan, "stream", params)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user