From e56558922bb7e03933922bb95c0e0b3f800c6d9f Mon Sep 17 00:00:00 2001 From: Ben Lebherz Date: Tue, 25 Jul 2023 17:42:27 +0200 Subject: [PATCH] add mvp of a grpc model for remote usage of seawatcher and similar --- cmd/live.go | 71 ++++- cmd/root.go | 4 +- cmd/seawatcherCmd.go | 11 +- internal/seawa/models/item_listed.go | 4 +- internal/seawa/models/nftid.go | 32 +- internal/seawa/seawa.pb.go | 425 ++++++++++++++------------- internal/seawa/seawa.proto | 9 +- internal/seawa/seawa_grpc.pb.go | 44 +-- internal/seawa/seawatcher.go | 124 +++++--- 9 files changed, 430 insertions(+), 294 deletions(-) diff --git a/cmd/live.go b/cmd/live.go index 740c9af..974f411 100644 --- a/cmd/live.go +++ b/cmd/live.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "math/big" "net" "strings" "time" @@ -378,12 +379,20 @@ func runGloomberg(_ *cobra.Command, _ []string) { // // subscribe to OpenSea API - if viper.GetBool("seawatcher.enabled") || viper.GetBool("listings.enabled") { + if viper.GetBool("seawatcher.local") || viper.GetBool("listings.enabled") { go trapri.OpenseaEventsHandler(gb) go gb.SendSlugsToServer() } + if viper.GetBool("seawatcher.grpc.client.enabled") { + gb.Prf("starting grpc client...") + + // go seawa.GetEvents() + + go testGRPC() + } + // // subscribe to redis pubsub channel to receive events from gloomberg central if viper.GetBool("seawatcher.pubsub") || viper.GetBool("pubsub.listings.subscribe") { @@ -469,11 +478,6 @@ func runGloomberg(_ *cobra.Command, _ []string) { gb.Prf("wallet watcher started: %+v", wawa) }() - if viper.IsSet("seawatcher.grpc.server") { - gb.Prf("starting grpc client...") - go testGRPC() - } - // loop forever select {} } @@ -501,7 +505,7 @@ func testGRPC() { opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) } - grpcAddress := fmt.Sprintf("%s:%d", viper.GetString("seawatcher.grpc.server"), viper.GetUint("seawatcher.grpc.port")) + grpcAddress := fmt.Sprintf("%s:%d", viper.GetString("seawatcher.grpc.client.host"), viper.GetUint("seawatcher.grpc.port")) gb.Prf("connecting to gRPC %s...", style.BoldAlmostWhite(grpcAddress)) @@ -515,7 +519,7 @@ func testGRPC() { gb.Prf("subscribing via grpc to: %s", style.BoldAlmostWhite(degendb.Listing.OpenseaEventName())) subsriptionRequest := &seawatcher.SubscriptionRequest{EventTypes: []seawatcher.EventType{seawatcher.EventType_ITEM_LISTED}, Collections: gb.CollectionDB.OpenseaSlugs()} //nolint:nosnakecase - stream, err := client.GetEvents(context.Background(), subsriptionRequest) + stream, err := client.GetItemListedEvents(context.Background(), subsriptionRequest) if err != nil { log.Errorf("client.GetEvents failed: %v", err) @@ -536,7 +540,49 @@ func testGRPC() { time.Sleep(time.Second * 1) } - gb.Prf("🐔 RECEIVED: %+v", event) + basePrice, ok := new(big.Int).SetString(event.Payload.BasePrice, 10) + if !ok { + log.Errorf("error parsing base price: %v", err) + + continue + } + + // transform event back to seawaModel.ItemListed + itemListedEvent := seawaModels.ItemListed{ + EventType: strings.ToLower(event.EventType.String()), + SentAt: event.SentAt.AsTime(), + Payload: seawaModels.ItemListedPayload{ + Item: seawaModels.Item{ + NftID: *seawaModels.ParseNftID(event.Payload.Item.NftId), + Chain: seawaModels.Chain{Name: event.Payload.Item.Chain.Name}, + Permalink: event.Payload.Item.Permalink, + Metadata: seawaModels.Metadata{ + Name: event.Payload.Item.Metadata.Name, + ImageURL: event.Payload.Item.Metadata.ImageUrl, + AnimationURL: event.Payload.Item.Metadata.AnimationUrl, + MetadataURL: event.Payload.Item.Metadata.MetadataUrl, + }, + }, + IsPrivate: event.Payload.IsPrivate, + ListingDate: event.Payload.ListingDate.AsTime(), + EventPayload: seawaModels.EventPayload{ + EventTimestamp: event.Payload.EventTimestamp.AsTime(), + BasePrice: basePrice, + Maker: seawaModels.Account{Address: common.HexToAddress(event.Payload.Maker.Address)}, + Taker: seawaModels.Account{Address: common.HexToAddress(event.Payload.Taker.Address)}, + Quantity: int(event.Payload.Quantity), + OrderHash: common.HexToHash(event.Payload.OrderHash), + ExpirationDate: event.Payload.ExpirationDate.AsTime(), + CollectionCriteria: seawaModels.CollectionCriteria{Slug: event.Payload.Collection.Slug}, + PaymentToken: seawaModels.PaymentToken{Address: common.HexToAddress(event.Payload.PaymentToken.Address), Symbol: event.Payload.PaymentToken.Symbol, Decimals: int(event.Payload.PaymentToken.Decimals)}, + }, + }, + } + + gb.In.ItemListed <- &itemListedEvent + + // gb.Prf("🐔 RECEIVED: %+v", event) + gb.Prf("🐔🐔🐔 RECEIVED: %+v", itemListedEvent) } } @@ -615,15 +661,18 @@ func init() { //nolint:gochecknoinits // worker settings viper.SetDefault("trapri.numOpenSeaEventhandlers", 3) + // eventhub viper.SetDefault("gloomberg.eventhub.numHandler", 3) viper.SetDefault("gloomberg.eventhub.inQueuesSize", 256) viper.SetDefault("gloomberg.eventhub.outQueuesSize", 32) + // first txs + viper.SetDefault("gloomberg.firstTxs.min_value", 0.5) + // job runner viper.SetDefault("jobs.numRunner", 3) viper.SetDefault("jobs.defaults.intervals", jobs.DefaultIntervals) - - viper.SetDefault("etherscan.fetchInterval", time.Second*3) + viper.SetDefault("jobs.status_every", 137) // OLD worker settings OLD viper.SetDefault("server.workers.newHeadHandler", 2) diff --git a/cmd/root.go b/cmd/root.go index 5e3861e..673da3e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -27,8 +27,8 @@ var ( keyPath string // grpc. - grpcServer net.IP - grpcListen net.IP + grpcServerListen net.IP + grpcClientHost net.IP gb *gloomberg.Gloomberg ) diff --git a/cmd/seawatcherCmd.go b/cmd/seawatcherCmd.go index 2b988e3..a56fcbc 100644 --- a/cmd/seawatcherCmd.go +++ b/cmd/seawatcherCmd.go @@ -23,16 +23,11 @@ func init() { seaWatcherCmd.Flags().Uint16("grpc-port", 31337, "gRPC server port") _ = viper.BindPFlag("seawatcher.grpc.port", seaWatcherCmd.Flags().Lookup("grpc-port")) // grpc server - seaWatcherCmd.Flags().IPVar(&grpcServer, "grpc-listen", nil, "gRPC server listen address") + seaWatcherCmd.Flags().IPVar(&grpcServerListen, "grpc-listen", nil, "gRPC server listen address") _ = viper.BindPFlag("grpc.listen", seaWatcherCmd.Flags().Lookup("grpc-listen")) // grpc client - seaWatcherCmd.Flags().IPVar(&grpcListen, "grpc", nil, "server gRPC client connects to") - _ = viper.BindPFlag("grpc.server", seaWatcherCmd.Flags().Lookup("grpc")) - - // // metrics/prometheus - // viper.SetDefault("metrics.enabled", false) - // viper.SetDefault("metrics.host", net.IPv4(0, 0, 0, 0)) - // viper.SetDefault("metrics.port", 9090) + seaWatcherCmd.Flags().IPVar(&grpcClientHost, "grpc", nil, "server gRPC client connects to") + _ = viper.BindPFlag("seawatcher.grpc.client.host", seaWatcherCmd.Flags().Lookup("grpc")) } func runSeawatcher(cmd *cobra.Command, _ []string) { diff --git a/internal/seawa/models/item_listed.go b/internal/seawa/models/item_listed.go index 7d880a6..09d01a5 100644 --- a/internal/seawa/models/item_listed.go +++ b/internal/seawa/models/item_listed.go @@ -5,12 +5,12 @@ import "time" type ItemListed struct { EventType string `json:"event_type" mapstructure:"event_type"` SentAt time.Time `json:"sent_at" mapstructure:"sent_at"` - Payload itemListedPayload `json:"payload" mapstructure:"payload"` + Payload ItemListedPayload `json:"payload" mapstructure:"payload"` Other map[string]interface{} `mapstructure:",remain"` } -type itemListedPayload struct { +type ItemListedPayload struct { Item Item `json:"item" mapstructure:"item"` EventPayload `mapstructure:",squash"` diff --git a/internal/seawa/models/nftid.go b/internal/seawa/models/nftid.go index aa54ab1..acc0ce5 100644 --- a/internal/seawa/models/nftid.go +++ b/internal/seawa/models/nftid.go @@ -23,24 +23,46 @@ func NewNftID(chain string, contractAddress common.Address, tokenID *big.Int) *N func ParseNftID(combinedNftID string) *NftID { nftID := strings.Split(combinedNftID, "/") - if len(nftID) != 3 { - gbl.Log.Error("Invalid NFT ID: %s", combinedNftID) + chain := "ethereum" + + var collection common.Address + + var tokenID *big.Int + + var rawTokenID string + + switch len(nftID) { + case 3: + chain = nftID[0] + + collection = common.HexToAddress(nftID[1]) + + rawTokenID = nftID[2] + + case 2: + collection = common.HexToAddress(nftID[0]) + + rawTokenID = nftID[1] + + default: + gbl.Log.Errorf("Invalid NFT ID: %s", combinedNftID) empty := []string{"", "", ""} return (*NftID)(&empty) } - tokenID, ok := new(big.Int).SetString(nftID[2], 10) + var ok bool + tokenID, ok = new(big.Int).SetString(rawTokenID, 10) if !ok { - gbl.Log.Error("Invalid NFT ID: %s", combinedNftID) + gbl.Log.Errorf("Invalid NFT ID - error parsing tokenID: %s", combinedNftID) empty := []string{"", "", ""} return (*NftID)(&empty) } - return NewNftID(nftID[0], common.HexToAddress(nftID[1]), tokenID) + return NewNftID(chain, collection, tokenID) } // Chain returns the chain of the token. diff --git a/internal/seawa/seawa.pb.go b/internal/seawa/seawa.pb.go index 93e3028..9d96d4a 100644 --- a/internal/seawa/seawa.pb.go +++ b/internal/seawa/seawa.pb.go @@ -156,6 +156,8 @@ type OpenSeaEvent struct { // The name of the feature. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The event type. + EventType EventType `protobuf:"varint,2,opt,name=eventType,proto3,enum=seawatcher.EventType" json:"eventType,omitempty"` } func (x *OpenSeaEvent) Reset() { @@ -197,6 +199,13 @@ func (x *OpenSeaEvent) GetName() string { return "" } +func (x *OpenSeaEvent) GetEventType() EventType { + if x != nil { + return x.EventType + } + return EventType_UNKNOWN +} + // Event emitted when an item is listed for sale. // // This event is emitted when an item is listed for sale on opensea. @@ -207,7 +216,7 @@ type ItemListed struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - EventType string `protobuf:"bytes,1,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + EventType EventType `protobuf:"varint,1,opt,name=event_type,json=eventType,proto3,enum=seawatcher.EventType" json:"event_type,omitempty"` Payload *ItemListed_ItemListedPayload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` SentAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=sent_at,json=sentAt,proto3" json:"sent_at,omitempty"` } @@ -244,11 +253,11 @@ func (*ItemListed) Descriptor() ([]byte, []int) { return file_seawa_seawa_proto_rawDescGZIP(), []int{2} } -func (x *ItemListed) GetEventType() string { +func (x *ItemListed) GetEventType() EventType { if x != nil { return x.EventType } - return "" + return EventType_UNKNOWN } func (x *ItemListed) GetPayload() *ItemListed_ItemListedPayload { @@ -1165,186 +1174,192 @@ var file_seawa_seawa_proto_rawDesc = []byte{ 0x68, 0x65, 0x72, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x22, 0x0a, 0x0c, 0x4f, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x53, 0x65, 0x61, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, - 0x8e, 0x14, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1d, - 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x42, 0x0a, - 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, - 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, - 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, - 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x12, 0x33, 0x0a, 0x07, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, - 0x73, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x1a, 0x20, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x1a, 0x1b, 0x0a, 0x05, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x83, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x69, 0x6d, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, - 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x61, 0x67, - 0x65, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0xac, 0x01, 0x0a, 0x04, - 0x49, 0x74, 0x65, 0x6d, 0x12, 0x32, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x52, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x61, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x33, 0x0a, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x22, 0xa5, 0x14, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, + 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, + 0x63, 0x68, 0x65, 0x72, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x42, 0x0a, 0x07, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, - 0x65, 0x64, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x66, 0x74, 0x5f, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x70, 0x65, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x70, 0x65, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x6e, 0x6b, 0x1a, 0x23, 0x0a, 0x07, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, - 0xab, 0x01, 0x0a, 0x0d, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, - 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, - 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x74, 0x68, 0x5f, 0x70, - 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x74, 0x68, 0x50, - 0x72, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, - 0x6f, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, - 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x64, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x1a, 0xd3, 0x01, - 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x32, 0x0a, - 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4f, 0x72, 0x43, 0x72, 0x69, - 0x74, 0x65, 0x72, 0x69, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x69, 0x64, 0x65, + 0x65, 0x64, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x33, 0x0a, + 0x07, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x74, + 0x41, 0x74, 0x1a, 0x20, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x73, 0x6c, 0x75, 0x67, 0x1a, 0x1b, 0x0a, 0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x1a, 0x83, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, + 0x0a, 0x0d, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, + 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x72, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0xac, 0x01, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, + 0x12, 0x32, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, + 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x66, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6e, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x65, 0x72, 0x6d, + 0x61, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x65, 0x72, + 0x6d, 0x61, 0x6c, 0x69, 0x6e, 0x6b, 0x1a, 0x23, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0xab, 0x01, 0x0a, 0x0d, + 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, + 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, + 0x61, 0x6c, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x74, 0x68, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x74, 0x68, 0x50, 0x72, 0x69, 0x63, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x1b, 0x0a, 0x09, + 0x75, 0x73, 0x64, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x75, 0x73, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x1a, 0xd3, 0x01, 0x0a, 0x0d, 0x43, 0x6f, + 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x65, + 0x6e, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, + 0x65, 0x6e, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4f, 0x72, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, - 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x1a, 0xad, 0x01, 0x0a, 0x05, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x1c, 0x0a, - 0x09, 0x65, 0x6e, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x09, 0x65, 0x6e, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x14, 0x69, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4f, 0x72, 0x43, 0x72, 0x69, 0x74, 0x65, - 0x72, 0x69, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x4f, 0x72, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x12, - 0x1a, 0x0a, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x1a, 0xc4, 0x03, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x75, 0x69, 0x74, 0x4b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x75, 0x69, 0x74, 0x4b, - 0x65, 0x79, 0x12, 0x4a, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x61, 0x77, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, - 0x64, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, - 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, - 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, - 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x52, - 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x65, - 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x65, 0x72, - 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, - 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x61, - 0x6c, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, - 0x12, 0x48, 0x0a, 0x1f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, - 0x6c, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x74, - 0x65, 0x6d, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x1f, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, - 0x6e, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x7a, 0x6f, 0x6e, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x7a, 0x6f, 0x6e, 0x65, 0x48, 0x61, 0x73, 0x68, 0x1a, 0xcc, 0x01, 0x0a, 0x0d, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x0a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, - 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x5a, 0x0a, - 0x2b, 0x75, 0x73, 0x65, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x74, 0x5f, 0x61, - 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x64, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x25, 0x75, 0x73, 0x65, 0x4c, 0x61, 0x7a, 0x79, 0x4d, 0x69, 0x6e, 0x74, 0x41, - 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x1a, 0x84, 0x06, 0x0a, 0x11, 0x49, 0x74, - 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, - 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x41, - 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x43, 0x0a, 0x0f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x43, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x65, 0x78, 0x70, - 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, - 0x73, 0x5f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x09, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, - 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x3d, 0x0a, 0x0c, 0x6c, - 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x6c, - 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x6c, 0x69, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0b, 0x6c, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x6d, 0x61, 0x6b, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x52, 0x05, 0x6d, 0x61, 0x6b, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x48, 0x61, 0x73, 0x68, 0x12, 0x49, 0x0a, 0x0d, 0x70, 0x61, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, - 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x12, 0x49, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x61, - 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, - 0x65, 0x64, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, - 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1a, - 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x74, 0x61, - 0x6b, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x65, 0x61, 0x77, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, - 0x64, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, 0x74, 0x61, 0x6b, 0x65, 0x72, - 0x2a, 0x6c, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, - 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, - 0x45, 0x4d, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x49, - 0x54, 0x45, 0x4d, 0x5f, 0x52, 0x45, 0x43, 0x45, 0x49, 0x56, 0x45, 0x44, 0x5f, 0x42, 0x49, 0x44, - 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, - 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4c, 0x4c, - 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x46, 0x46, 0x45, 0x52, 0x10, 0x04, 0x32, 0x58, - 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x09, - 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x73, 0x65, 0x61, 0x77, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x73, 0x65, 0x61, - 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x53, 0x65, 0x61, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x22, 0x00, 0x30, 0x01, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x65, 0x6e, 0x6c, 0x65, 0x62, 0x2f, 0x67, 0x6c, - 0x6f, 0x6f, 0x6d, 0x62, 0x65, 0x72, 0x67, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2f, 0x73, 0x65, 0x61, 0x77, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x4f, 0x72, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x12, 0x1a, 0x0a, + 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, + 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, + 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, + 0xad, 0x01, 0x0a, 0x05, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x65, 0x6e, + 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x4f, 0x72, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x4f, 0x72, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x69, + 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x69, + 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, + 0xc4, 0x03, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1e, + 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x75, 0x69, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x75, 0x69, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x4a, + 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, + 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x6f, + 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, + 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x32, + 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, + 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x66, 0x66, + 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x65, 0x72, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, + 0x6c, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x48, 0x0a, 0x1f, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x6e, + 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x1f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x7a, 0x6f, + 0x6e, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x7a, 0x6f, + 0x6e, 0x65, 0x48, 0x61, 0x73, 0x68, 0x1a, 0xcc, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, + 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, + 0x73, 0x74, 0x65, 0x64, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, + 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x5a, 0x0a, 0x2b, 0x75, 0x73, 0x65, + 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x25, + 0x75, 0x73, 0x65, 0x4c, 0x61, 0x7a, 0x79, 0x4d, 0x69, 0x6e, 0x74, 0x41, 0x64, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x46, 0x6f, 0x72, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x1a, 0x84, 0x06, 0x0a, 0x11, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, + 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x62, + 0x61, 0x73, 0x65, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x62, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, + 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, + 0x0f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x0e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x12, 0x43, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x70, 0x72, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, + 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x49, 0x74, 0x65, + 0x6d, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x3d, 0x0a, 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x6c, 0x69, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x44, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, + 0x6e, 0x79, 0x52, 0x0b, 0x6c, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x34, 0x0a, 0x05, 0x6d, 0x61, 0x6b, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, + 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, + 0x6d, 0x61, 0x6b, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x49, 0x0a, 0x0d, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, + 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, + 0x74, 0x65, 0x64, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x49, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0c, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, + 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x71, 0x75, + 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x74, 0x61, 0x6b, 0x65, 0x72, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, + 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, 0x74, 0x61, 0x6b, 0x65, 0x72, 0x2a, 0x6c, 0x0a, 0x09, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x4c, + 0x49, 0x53, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x54, 0x45, 0x4d, 0x5f, + 0x52, 0x45, 0x43, 0x45, 0x49, 0x56, 0x45, 0x44, 0x5f, 0x42, 0x49, 0x44, 0x10, 0x02, 0x12, 0x14, + 0x0a, 0x10, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, + 0x45, 0x44, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4c, 0x4c, 0x45, 0x43, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x4f, 0x46, 0x46, 0x45, 0x52, 0x10, 0x04, 0x32, 0x60, 0x0a, 0x0a, 0x53, 0x65, + 0x61, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x49, + 0x74, 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, + 0x1f, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, 0x74, + 0x65, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x22, 0x00, 0x30, 0x01, 0x42, 0x2c, 0x5a, 0x2a, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x65, 0x6e, 0x6c, 0x65, + 0x62, 0x2f, 0x67, 0x6c, 0x6f, 0x6f, 0x6d, 0x62, 0x65, 0x72, 0x67, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x73, 0x65, 0x61, 0x77, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1382,30 +1397,32 @@ var file_seawa_seawa_proto_goTypes = []interface{}{ } var file_seawa_seawa_proto_depIdxs = []int32{ 0, // 0: seawatcher.SubscriptionRequest.eventTypes:type_name -> seawatcher.EventType - 14, // 1: seawatcher.ItemListed.payload:type_name -> seawatcher.ItemListed.ItemListedPayload - 15, // 2: seawatcher.ItemListed.sent_at:type_name -> google.protobuf.Timestamp - 5, // 3: seawatcher.ItemListed.Item.chain:type_name -> seawatcher.ItemListed.Chain - 6, // 4: seawatcher.ItemListed.Item.metadata:type_name -> seawatcher.ItemListed.Metadata - 10, // 5: seawatcher.ItemListed.Parameters.consideration:type_name -> seawatcher.ItemListed.Consideration - 11, // 6: seawatcher.ItemListed.Parameters.offer:type_name -> seawatcher.ItemListed.Offer - 12, // 7: seawatcher.ItemListed.Protocol_data.parameters:type_name -> seawatcher.ItemListed.Parameters - 4, // 8: seawatcher.ItemListed.ItemListedPayload.collection:type_name -> seawatcher.ItemListed.Collection - 15, // 9: seawatcher.ItemListed.ItemListedPayload.event_timestamp:type_name -> google.protobuf.Timestamp - 15, // 10: seawatcher.ItemListed.ItemListedPayload.expiration_date:type_name -> google.protobuf.Timestamp - 7, // 11: seawatcher.ItemListed.ItemListedPayload.item:type_name -> seawatcher.ItemListed.Item - 15, // 12: seawatcher.ItemListed.ItemListedPayload.listing_date:type_name -> google.protobuf.Timestamp - 16, // 13: seawatcher.ItemListed.ItemListedPayload.listing_type:type_name -> google.protobuf.Any - 8, // 14: seawatcher.ItemListed.ItemListedPayload.maker:type_name -> seawatcher.ItemListed.Account - 9, // 15: seawatcher.ItemListed.ItemListedPayload.payment_token:type_name -> seawatcher.ItemListed.Payment_token - 13, // 16: seawatcher.ItemListed.ItemListedPayload.protocol_data:type_name -> seawatcher.ItemListed.Protocol_data - 8, // 17: seawatcher.ItemListed.ItemListedPayload.taker:type_name -> seawatcher.ItemListed.Account - 1, // 18: seawatcher.SeaWatcher.GetEvents:input_type -> seawatcher.SubscriptionRequest - 2, // 19: seawatcher.SeaWatcher.GetEvents:output_type -> seawatcher.OpenSeaEvent - 19, // [19:20] is the sub-list for method output_type - 18, // [18:19] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name + 0, // 1: seawatcher.OpenSeaEvent.eventType:type_name -> seawatcher.EventType + 0, // 2: seawatcher.ItemListed.event_type:type_name -> seawatcher.EventType + 14, // 3: seawatcher.ItemListed.payload:type_name -> seawatcher.ItemListed.ItemListedPayload + 15, // 4: seawatcher.ItemListed.sent_at:type_name -> google.protobuf.Timestamp + 5, // 5: seawatcher.ItemListed.Item.chain:type_name -> seawatcher.ItemListed.Chain + 6, // 6: seawatcher.ItemListed.Item.metadata:type_name -> seawatcher.ItemListed.Metadata + 10, // 7: seawatcher.ItemListed.Parameters.consideration:type_name -> seawatcher.ItemListed.Consideration + 11, // 8: seawatcher.ItemListed.Parameters.offer:type_name -> seawatcher.ItemListed.Offer + 12, // 9: seawatcher.ItemListed.Protocol_data.parameters:type_name -> seawatcher.ItemListed.Parameters + 4, // 10: seawatcher.ItemListed.ItemListedPayload.collection:type_name -> seawatcher.ItemListed.Collection + 15, // 11: seawatcher.ItemListed.ItemListedPayload.event_timestamp:type_name -> google.protobuf.Timestamp + 15, // 12: seawatcher.ItemListed.ItemListedPayload.expiration_date:type_name -> google.protobuf.Timestamp + 7, // 13: seawatcher.ItemListed.ItemListedPayload.item:type_name -> seawatcher.ItemListed.Item + 15, // 14: seawatcher.ItemListed.ItemListedPayload.listing_date:type_name -> google.protobuf.Timestamp + 16, // 15: seawatcher.ItemListed.ItemListedPayload.listing_type:type_name -> google.protobuf.Any + 8, // 16: seawatcher.ItemListed.ItemListedPayload.maker:type_name -> seawatcher.ItemListed.Account + 9, // 17: seawatcher.ItemListed.ItemListedPayload.payment_token:type_name -> seawatcher.ItemListed.Payment_token + 13, // 18: seawatcher.ItemListed.ItemListedPayload.protocol_data:type_name -> seawatcher.ItemListed.Protocol_data + 8, // 19: seawatcher.ItemListed.ItemListedPayload.taker:type_name -> seawatcher.ItemListed.Account + 1, // 20: seawatcher.SeaWatcher.GetItemListedEvents:input_type -> seawatcher.SubscriptionRequest + 3, // 21: seawatcher.SeaWatcher.GetItemListedEvents:output_type -> seawatcher.ItemListed + 21, // [21:22] is the sub-list for method output_type + 20, // [20:21] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_seawa_seawa_proto_init() } diff --git a/internal/seawa/seawa.proto b/internal/seawa/seawa.proto index db252b7..29d3ee4 100644 --- a/internal/seawa/seawa.proto +++ b/internal/seawa/seawa.proto @@ -29,7 +29,8 @@ service SeaWatcher { // streamed rather than returned at once (e.g. in a response message with a // repeated field), as the rectangle may cover a large area and contain a // huge number of features. - rpc GetEvents(SubscriptionRequest) returns (stream OpenSeaEvent) {} + // rpc GetEvents(SubscriptionRequest) returns (stream OpenSeaEvent) {} + rpc GetItemListedEvents(SubscriptionRequest) returns (stream ItemListed) {} } // Points are represented as latitude-longitude pairs in the E7 representation @@ -61,8 +62,8 @@ message OpenSeaEvent { // The name of the feature. string name = 1; - // // The point where the feature is detected. - // Point location = 2; + // The event type. + EventType eventType = 2; } // Event emitted when an item is listed for sale. @@ -161,7 +162,7 @@ message ItemListed { Account taker = 14; } - string event_type = 1; + EventType event_type = 1; ItemListedPayload payload = 2; google.protobuf.Timestamp sent_at = 3; } diff --git a/internal/seawa/seawa_grpc.pb.go b/internal/seawa/seawa_grpc.pb.go index 9db8269..70b2268 100644 --- a/internal/seawa/seawa_grpc.pb.go +++ b/internal/seawa/seawa_grpc.pb.go @@ -33,7 +33,7 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - SeaWatcher_GetEvents_FullMethodName = "/seawatcher.SeaWatcher/GetEvents" + SeaWatcher_GetItemListedEvents_FullMethodName = "/seawatcher.SeaWatcher/GetItemListedEvents" ) // SeaWatcherClient is the client API for SeaWatcher service. @@ -46,7 +46,8 @@ type SeaWatcherClient interface { // streamed rather than returned at once (e.g. in a response message with a // repeated field), as the rectangle may cover a large area and contain a // huge number of features. - GetEvents(ctx context.Context, in *SubscriptionRequest, opts ...grpc.CallOption) (SeaWatcher_GetEventsClient, error) + // rpc GetEvents(SubscriptionRequest) returns (stream OpenSeaEvent) {} + GetItemListedEvents(ctx context.Context, in *SubscriptionRequest, opts ...grpc.CallOption) (SeaWatcher_GetItemListedEventsClient, error) } type seaWatcherClient struct { @@ -57,12 +58,12 @@ func NewSeaWatcherClient(cc grpc.ClientConnInterface) SeaWatcherClient { return &seaWatcherClient{cc} } -func (c *seaWatcherClient) GetEvents(ctx context.Context, in *SubscriptionRequest, opts ...grpc.CallOption) (SeaWatcher_GetEventsClient, error) { - stream, err := c.cc.NewStream(ctx, &SeaWatcher_ServiceDesc.Streams[0], SeaWatcher_GetEvents_FullMethodName, opts...) +func (c *seaWatcherClient) GetItemListedEvents(ctx context.Context, in *SubscriptionRequest, opts ...grpc.CallOption) (SeaWatcher_GetItemListedEventsClient, error) { + stream, err := c.cc.NewStream(ctx, &SeaWatcher_ServiceDesc.Streams[0], SeaWatcher_GetItemListedEvents_FullMethodName, opts...) if err != nil { return nil, err } - x := &seaWatcherGetEventsClient{stream} + x := &seaWatcherGetItemListedEventsClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -72,17 +73,17 @@ func (c *seaWatcherClient) GetEvents(ctx context.Context, in *SubscriptionReques return x, nil } -type SeaWatcher_GetEventsClient interface { - Recv() (*OpenSeaEvent, error) +type SeaWatcher_GetItemListedEventsClient interface { + Recv() (*ItemListed, error) grpc.ClientStream } -type seaWatcherGetEventsClient struct { +type seaWatcherGetItemListedEventsClient struct { grpc.ClientStream } -func (x *seaWatcherGetEventsClient) Recv() (*OpenSeaEvent, error) { - m := new(OpenSeaEvent) +func (x *seaWatcherGetItemListedEventsClient) Recv() (*ItemListed, error) { + m := new(ItemListed) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -99,7 +100,8 @@ type SeaWatcherServer interface { // streamed rather than returned at once (e.g. in a response message with a // repeated field), as the rectangle may cover a large area and contain a // huge number of features. - GetEvents(*SubscriptionRequest, SeaWatcher_GetEventsServer) error + // rpc GetEvents(SubscriptionRequest) returns (stream OpenSeaEvent) {} + GetItemListedEvents(*SubscriptionRequest, SeaWatcher_GetItemListedEventsServer) error mustEmbedUnimplementedSeaWatcherServer() } @@ -107,8 +109,8 @@ type SeaWatcherServer interface { type UnimplementedSeaWatcherServer struct { } -func (UnimplementedSeaWatcherServer) GetEvents(*SubscriptionRequest, SeaWatcher_GetEventsServer) error { - return status.Errorf(codes.Unimplemented, "method GetEvents not implemented") +func (UnimplementedSeaWatcherServer) GetItemListedEvents(*SubscriptionRequest, SeaWatcher_GetItemListedEventsServer) error { + return status.Errorf(codes.Unimplemented, "method GetItemListedEvents not implemented") } func (UnimplementedSeaWatcherServer) mustEmbedUnimplementedSeaWatcherServer() {} @@ -123,24 +125,24 @@ func RegisterSeaWatcherServer(s grpc.ServiceRegistrar, srv SeaWatcherServer) { s.RegisterService(&SeaWatcher_ServiceDesc, srv) } -func _SeaWatcher_GetEvents_Handler(srv interface{}, stream grpc.ServerStream) error { +func _SeaWatcher_GetItemListedEvents_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(SubscriptionRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SeaWatcherServer).GetEvents(m, &seaWatcherGetEventsServer{stream}) + return srv.(SeaWatcherServer).GetItemListedEvents(m, &seaWatcherGetItemListedEventsServer{stream}) } -type SeaWatcher_GetEventsServer interface { - Send(*OpenSeaEvent) error +type SeaWatcher_GetItemListedEventsServer interface { + Send(*ItemListed) error grpc.ServerStream } -type seaWatcherGetEventsServer struct { +type seaWatcherGetItemListedEventsServer struct { grpc.ServerStream } -func (x *seaWatcherGetEventsServer) Send(m *OpenSeaEvent) error { +func (x *seaWatcherGetItemListedEventsServer) Send(m *ItemListed) error { return x.ServerStream.SendMsg(m) } @@ -153,8 +155,8 @@ var SeaWatcher_ServiceDesc = grpc.ServiceDesc{ Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { - StreamName: "GetEvents", - Handler: _SeaWatcher_GetEvents_Handler, + StreamName: "GetItemListedEvents", + Handler: _SeaWatcher_GetItemListedEvents_Handler, ServerStreams: true, }, }, diff --git a/internal/seawa/seawatcher.go b/internal/seawa/seawatcher.go index 69dcf59..0fec5cb 100644 --- a/internal/seawa/seawatcher.go +++ b/internal/seawa/seawatcher.go @@ -28,6 +28,7 @@ import ( "github.com/spf13/viper" "go.uber.org/zap" grpc "google.golang.org/grpc" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) type SeaWatcher struct { @@ -47,6 +48,10 @@ type SeaWatcher struct { // subscriptions map[string]map[osmodels.EventType]func() subscriptions map[string]map[EventType]func() + runLocal bool + runPubsubServer bool + runGRPCServer bool + // redis client rdb rueidis.Client @@ -65,7 +70,10 @@ var eventsReceivedCounter = promauto.NewCounter(prometheus.CounterOpts{ // func NewSeaWatcher(apiToken string, rdb rueidis.Client) *SeaWatcher {. func NewSeaWatcher(apiToken string, gb *gloomberg.Gloomberg) *SeaWatcher { - if apiToken == "" { + // we might not connect to the stream api locally if we use grpc or other ways to get the events + runLocalAPIClient := viper.GetBool("seawatcher.local") + + if runLocalAPIClient && apiToken == "" { log.Info("no OpenSea api token provided, skipping OpenSea stream api") return nil @@ -87,6 +95,10 @@ func NewSeaWatcher(apiToken string, gb *gloomberg.Gloomberg) *SeaWatcher { channels: make(map[string]*phx.Channel), + runLocal: runLocalAPIClient, + runPubsubServer: viper.GetBool("seawatcher.pubsub"), + runGRPCServer: viper.IsSet("seawatcher.grpc.listen"), + gb: gb, rdb: gb.Rdb, @@ -94,53 +106,57 @@ func NewSeaWatcher(apiToken string, gb *gloomberg.Gloomberg) *SeaWatcher { } // create phoenix socket - sw.phoenixSocket = phx.NewSocket(endpoint) - sw.phoenixSocket.Logger = phx.NewCustomLogger(phx.LoggerLevel(phx.LogWarning), zap.NewStdLog(gbl.Log.Desugar())) + if runLocalAPIClient { + sw.phoenixSocket = phx.NewSocket(endpoint) + sw.phoenixSocket.Logger = phx.NewCustomLogger(phx.LoggerLevel(phx.LogWarning), zap.NewStdLog(gbl.Log.Desugar())) - // exponential backoff for reconnects - sw.phoenixSocket.ReconnectAfterFunc = func(attempt int) time.Duration { - // max waitTime is 2^7 = 128sec - waitTime := time.Second * time.Duration(math.Pow(2.0, float64(int(math.Min(float64(attempt), 5))))) + // exponential backoff for reconnects + sw.phoenixSocket.ReconnectAfterFunc = func(attempt int) time.Duration { + // max waitTime is 2^7 = 128sec + waitTime := time.Second * time.Duration(math.Pow(2.0, float64(int(math.Min(float64(attempt), 5))))) - sw.Prf("❌ reconnecting to OpenSea failed (#%d) 😩 trying again in %dsec..", attempt, int(waitTime.Seconds())) + sw.Prf("❌ reconnecting to OpenSea failed (#%d) 😩 trying again in %dsec..", attempt, int(waitTime.Seconds())) - return waitTime - } + return waitTime + } - // error function - sw.phoenixSocket.OnError(func(err error) { gbl.Log.Errorf("❌ seawa socket error: %+v", err) }) + // error function + sw.phoenixSocket.OnError(func(err error) { gbl.Log.Errorf("❌ seawa socket error: %+v", err) }) - // called on successful connection to the socket/OpenSea - sw.phoenixSocket.OnOpen(func() { - sw.Pr("✅ connected to the OpenSea stream") - }) + // called on successful connection to the socket/OpenSea + sw.phoenixSocket.OnOpen(func() { + sw.Pr("✅ connected to the OpenSea stream") + }) - // called on disconnect/connection breaks to the socket/OpenSea - sw.phoenixSocket.OnClose(func() { - sw.Pr("❕ connection to OpenSea closed, trying to reconnect...") + // called on disconnect/connection breaks to the socket/OpenSea + sw.phoenixSocket.OnClose(func() { + sw.Pr("❕ connection to OpenSea closed, trying to reconnect...") - err := sw.phoenixSocket.Reconnect() - if err != nil { - sw.Prf("❌ reconnecting to OpenSea stream failed: %s", err) - } - }) + err := sw.phoenixSocket.Reconnect() + if err != nil { + sw.Prf("❌ reconnecting to OpenSea stream failed: %s", err) + } + }) - // initial connection to the socket/OpenSea - if sw.phoenixSocket != nil { - sw.Pr("connecting to OpenSea...") + // initial connection to the socket/OpenSea + if sw.phoenixSocket != nil { + sw.Pr("connecting to OpenSea...") - if err := sw.phoenixSocket.Connect(); err != nil { - socketError := errors.New("OpenSea stream socket connection failed: " + err.Error()) - sw.Prf("❌ socket error: %s", socketError.Error()) + if err := sw.phoenixSocket.Connect(); err != nil { + socketError := errors.New("OpenSea stream socket connection failed: " + err.Error()) + sw.Prf("❌ socket error: %s", socketError.Error()) - return nil + return nil + } } } // start worker for managing subscriptions - go sw.WorkerMgmtChannel() + if viper.GetBool("seawatcher.grpc.pubsub") { + go sw.WorkerMgmtChannel() + } - if viper.IsSet("seawatcher.grpc.listen") { + if viper.GetBool("seawatcher.grpc.server.enabled") { sw.Prf("starting grpc server...") listenHost := viper.GetString("seawatcher.grpc.listen") @@ -609,7 +625,7 @@ func (sw *SeaWatcher) PublishSendSlugs() { } } -func (sw *SeaWatcher) GetEvents(req *SubscriptionRequest, stream SeaWatcher_GetEventsServer) error { //nolint:nosnakecase +func (sw *SeaWatcher) GetItemListedEvents(req *SubscriptionRequest, stream SeaWatcher_GetItemListedEventsServer) error { //nolint:nosnakecase sw.Prf("received subscription request for %s collections/slugs (%s types each)...", style.BoldAlmostWhite(fmt.Sprint(len(req.Collections))), style.BoldAlmostWhite(fmt.Sprint(len(req.EventTypes)))) newEventSubscriptions := 0 @@ -633,11 +649,45 @@ func (sw *SeaWatcher) GetEvents(req *SubscriptionRequest, stream SeaWatcher_GetE }() for event := range sw.gb.SubscribeItemListed() { - osEvent := &OpenSeaEvent{Name: event.Payload.Item.Name} + // transform *models.ItemListed event to ItemListed grpc message + itemListed := &ItemListed{ + EventType: EventType_ITEM_LISTED, //nolint:nosnakecase + SentAt: ×tamppb.Timestamp{Seconds: event.SentAt.Unix()}, + Payload: &ItemListed_ItemListedPayload{ //nolint:nosnakecase + Item: &ItemListed_Item{ //nolint:nosnakecase + Chain: &ItemListed_Chain{Name: "ethereum"}, //nolint:nosnakecase + NftId: event.Payload.Item.String(), + Permalink: event.Payload.Item.Permalink, + Metadata: &ItemListed_Metadata{ //nolint:nosnakecase + Name: event.Payload.Item.Name, + ImageUrl: event.Payload.Item.ImageURL, + AnimationUrl: event.Payload.Item.AnimationURL, + MetadataUrl: event.Payload.Item.MetadataURL, + }, + }, + BasePrice: event.Payload.BasePrice.String(), + Collection: &ItemListed_Collection{Slug: event.Payload.Slug}, //nolint:nosnakecase + IsPrivate: event.Payload.IsPrivate, + ListingDate: ×tamppb.Timestamp{Seconds: event.Payload.ListingDate.Unix()}, + EventTimestamp: ×tamppb.Timestamp{Seconds: event.Payload.EventTimestamp.Unix()}, + Quantity: uint32(event.Payload.Quantity), + Maker: &ItemListed_Account{Address: event.Payload.Maker.Address.String()}, //nolint:nosnakecase + Taker: &ItemListed_Account{Address: event.Payload.Taker.Address.String()}, //nolint:nosnakecase + ExpirationDate: ×tamppb.Timestamp{Seconds: event.Payload.ExpirationDate.Unix()}, + OrderHash: event.Payload.OrderHash.String(), + PaymentToken: &ItemListed_PaymentToken{ //nolint:nosnakecase + Address: event.Payload.Address.String(), + Symbol: event.Payload.Symbol, + Name: event.Payload.Name, + Decimals: uint32(event.Payload.Decimals), + UsdPrice: event.Payload.UsdPrice, + }, + }, + } - sw.Prf("🐔 received osEvent %s", style.AlmostWhiteStyle.Render(fmt.Sprint(osEvent))) + sw.Prf("🐔 received osEvent %s", style.AlmostWhiteStyle.Render(fmt.Sprint(itemListed))) - if err := stream.Send(osEvent); err != nil { + if err := stream.Send(itemListed); err != nil { return err } }