Skip to content

Pre-built Mempool Service Protobuf definitions for Go

Notifications You must be signed in to change notification settings

eden-network/mempool-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mempool Service

Go package with pre-built gRPC client for the Eden Mempool Service.

Installation

go get github.com/eden-network/mempool-service

Usage

import (
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	pb "github.com/eden-network/mempool-service/protobuf"
	"os"
)

func main() {
	url := os.Getenv("EDEN_MEMPOOL_SERVICE_URL")
	authKey := os.Getenv("EDEN_MEMPOOL_SERVICE_AUTH")

	conn, err := grpc.Dial(url, grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		return
	}

	client := pb.NewStreamServiceClient(conn)
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	stream, err := client.StreamRawTransactions(ctx, &pb.StreamRawTransactionsRequest{
		AuthHeader: authKey,
	})

	for {
		msg, err := stream.Recv()
		if err != nil {
			return
		}

		// do something with msg
	}
}

About

Pre-built Mempool Service Protobuf definitions for Go

Resources

Stars

Watchers

Forks

Packages

No packages published