diff --git a/cmd/server/main.go b/cmd/server/main.go index eb4707f..a9e847c 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -16,7 +16,7 @@ import ( "google.golang.org/grpc/reflection" "github.com/zcash-hackworks/lightwalletd/frontend" - "github.com/zcash-hackworks/lightwalletd/rpc" + "github.com/zcash-hackworks/lightwalletd/walletrpc" ) var log *logrus.Entry @@ -147,7 +147,7 @@ func main() { defer service.(*frontend.SqlStreamer).GracefulStop() // Register service - rpc.RegisterCompactTxStreamerServer(server, service) + walletrpc.RegisterCompactTxStreamerServer(server, service) // Start listening listener, err := net.Listen("tcp", opts.bindAddr) diff --git a/frontend/service.go b/frontend/service.go index bd1071d..c1a9e99 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -11,8 +11,8 @@ import ( "github.com/golang/protobuf/proto" _ "github.com/mattn/go-sqlite3" - "github.com/zcash-hackworks/lightwalletd/rpc" "github.com/zcash-hackworks/lightwalletd/storage" + "github.com/zcash-hackworks/lightwalletd/walletrpc" ) var ( @@ -25,7 +25,7 @@ type SqlStreamer struct { db *sql.DB } -func NewSQLiteStreamer(dbPath string) (rpc.CompactTxStreamerServer, error) { +func NewSQLiteStreamer(dbPath string) (walletrpc.CompactTxStreamerServer, error) { db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?_busy_timeout=10000&cache=shared", dbPath)) db.SetMaxOpenConns(1) if err != nil { @@ -45,17 +45,17 @@ func (s *SqlStreamer) GracefulStop() error { return s.db.Close() } -func (s *SqlStreamer) GetLatestBlock(ctx context.Context, placeholder *rpc.ChainSpec) (*rpc.BlockID, error) { +func (s *SqlStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc.ChainSpec) (*walletrpc.BlockID, error) { // the ChainSpec type is an empty placeholder height, err := storage.GetCurrentHeight(ctx, s.db) if err != nil { return nil, err } // TODO: also return block hashes here - return &rpc.BlockID{Height: uint64(height)}, nil + return &walletrpc.BlockID{Height: uint64(height)}, nil } -func (s *SqlStreamer) GetBlock(ctx context.Context, id *rpc.BlockID) (*rpc.CompactBlock, error) { +func (s *SqlStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*walletrpc.CompactBlock, error) { if id.Height == 0 && id.Hash == nil { return nil, ErrUnspecified } @@ -75,12 +75,12 @@ func (s *SqlStreamer) GetBlock(ctx context.Context, id *rpc.BlockID) (*rpc.Compa return nil, err } - cBlock := &rpc.CompactBlock{} + cBlock := &walletrpc.CompactBlock{} err = proto.Unmarshal(blockBytes, cBlock) return cBlock, err } -func (s *SqlStreamer) GetBlockRange(span *rpc.BlockRange, resp rpc.CompactTxStreamer_GetBlockRangeServer) error { +func (s *SqlStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.CompactTxStreamer_GetBlockRangeServer) error { blockChan := make(chan []byte) errChan := make(chan error) @@ -101,7 +101,7 @@ func (s *SqlStreamer) GetBlockRange(span *rpc.BlockRange, resp rpc.CompactTxStre // this will also catch context.DeadlineExceeded from the timeout return err case blockBytes := <-blockChan: - cBlock := &rpc.CompactBlock{} + cBlock := &walletrpc.CompactBlock{} err := proto.Unmarshal(blockBytes, cBlock) if err != nil { return err // TODO really need better logging in this whole service @@ -116,7 +116,7 @@ func (s *SqlStreamer) GetBlockRange(span *rpc.BlockRange, resp rpc.CompactTxStre return nil } -func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*rpc.RawTransaction, error) { +func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilter) (*walletrpc.RawTransaction, error) { var txBytes []byte var err error @@ -126,7 +126,7 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*r if err != nil { return nil, err } - return &rpc.RawTransaction{Data: txBytes}, nil + return &walletrpc.RawTransaction{Data: txBytes}, nil } @@ -136,7 +136,7 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*r if err != nil { return nil, err } - return &rpc.RawTransaction{Data: txBytes}, nil + return &walletrpc.RawTransaction{Data: txBytes}, nil } // A totally unset protobuf will attempt to fetch the genesis coinbase tx. @@ -144,9 +144,9 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*r if err != nil { return nil, err } - return &rpc.RawTransaction{Data: txBytes}, nil + return &walletrpc.RawTransaction{Data: txBytes}, nil } -func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *rpc.RawTransaction) (*rpc.SendResponse, error) { +func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) { return nil, ErrNoImpl } diff --git a/parser/block.go b/parser/block.go index 8e063b1..06155e3 100644 --- a/parser/block.go +++ b/parser/block.go @@ -3,9 +3,9 @@ package parser import ( "fmt" - "github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring" - "github.com/zcash-hackworks/lightwalletd/rpc" "github.com/pkg/errors" + "github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring" + "github.com/zcash-hackworks/lightwalletd/walletrpc" ) type block struct { @@ -78,8 +78,8 @@ func (b *block) GetHeight() int { return int(blockHeight) } -func (b *block) ToCompact() *rpc.CompactBlock { - compactBlock := &rpc.CompactBlock{ +func (b *block) ToCompact() *walletrpc.CompactBlock { + compactBlock := &walletrpc.CompactBlock{ //TODO ProtoVersion: 1, Height: uint64(b.GetHeight()), Hash: b.GetEncodableHash(), @@ -87,7 +87,7 @@ func (b *block) ToCompact() *rpc.CompactBlock { } // Only Sapling transactions have a meaningful compact encoding - saplingTxns := make([]*rpc.CompactTx, 0, len(b.vtx)) + saplingTxns := make([]*walletrpc.CompactTx, 0, len(b.vtx)) for idx, tx := range b.vtx { if tx.HasSaplingTransactions() { saplingTxns = append(saplingTxns, tx.ToCompact(idx)) diff --git a/parser/transaction.go b/parser/transaction.go index a8166b9..c6c2a1a 100644 --- a/parser/transaction.go +++ b/parser/transaction.go @@ -3,9 +3,9 @@ package parser import ( "crypto/sha256" - "github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring" - "github.com/zcash-hackworks/lightwalletd/rpc" "github.com/pkg/errors" + "github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring" + "github.com/zcash-hackworks/lightwalletd/walletrpc" ) type rawTransaction struct { @@ -126,8 +126,8 @@ func (p *spend) ParseFromSlice(data []byte) ([]byte, error) { return []byte(s), nil } -func (p *spend) ToCompact() *rpc.CompactSpend { - return &rpc.CompactSpend{ +func (p *spend) ToCompact() *walletrpc.CompactSpend { + return &walletrpc.CompactSpend{ Nf: p.nullifier, } } @@ -173,8 +173,8 @@ func (p *output) ParseFromSlice(data []byte) ([]byte, error) { return []byte(s), nil } -func (p *output) ToCompact() *rpc.CompactOutput { - return &rpc.CompactOutput{ +func (p *output) ToCompact() *walletrpc.CompactOutput { + return &walletrpc.CompactOutput{ Cmu: p.cmu, Epk: p.ephemeralKey, Ciphertext: p.encCiphertext[:52], @@ -304,13 +304,13 @@ func (tx *Transaction) HasSaplingTransactions() bool { return tx.version >= 4 && (len(tx.shieldedSpends)+len(tx.shieldedOutputs)) > 0 } -func (tx *Transaction) ToCompact(index int) *rpc.CompactTx { - ctx := &rpc.CompactTx{ +func (tx *Transaction) ToCompact(index int) *walletrpc.CompactTx { + ctx := &walletrpc.CompactTx{ Index: uint64(index), // index is contextual Hash: tx.GetEncodableHash(), //Fee: 0, // TODO: calculate fees - Spends: make([]*rpc.CompactSpend, len(tx.shieldedSpends)), - Outputs: make([]*rpc.CompactOutput, len(tx.shieldedOutputs)), + Spends: make([]*walletrpc.CompactSpend, len(tx.shieldedSpends)), + Outputs: make([]*walletrpc.CompactOutput, len(tx.shieldedOutputs)), } for i, spend := range tx.shieldedSpends { ctx.Spends[i] = spend.ToCompact() diff --git a/storage/sqlite3_test.go b/storage/sqlite3_test.go index dc013b9..12773f9 100644 --- a/storage/sqlite3_test.go +++ b/storage/sqlite3_test.go @@ -15,7 +15,7 @@ import ( "github.com/pkg/errors" "github.com/zcash-hackworks/lightwalletd/parser" - "github.com/zcash-hackworks/lightwalletd/rpc" + "github.com/zcash-hackworks/lightwalletd/walletrpc" ) type compactTest struct { @@ -107,7 +107,7 @@ func TestSqliteStorage(t *testing.T) { if err != nil { t.Error(errors.Wrap(err, "retrieving stored block")) } - cblock := &rpc.CompactBlock{} + cblock := &walletrpc.CompactBlock{} err = proto.Unmarshal(storedBlock, cblock) if err != nil { t.Fatal(err) diff --git a/rpc/compact_formats.pb.go b/walletrpc/compact_formats.pb.go similarity index 75% rename from rpc/compact_formats.pb.go rename to walletrpc/compact_formats.pb.go index 6a85dc1..9a8fdc5 100644 --- a/rpc/compact_formats.pb.go +++ b/walletrpc/compact_formats.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: compact_formats.proto -package rpc +package walletrpc import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -38,7 +38,7 @@ func (m *CompactBlock) Reset() { *m = CompactBlock{} } func (m *CompactBlock) String() string { return proto.CompactTextString(m) } func (*CompactBlock) ProtoMessage() {} func (*CompactBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{0} + return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{0} } func (m *CompactBlock) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CompactBlock.Unmarshal(m, b) @@ -123,7 +123,7 @@ func (m *CompactTx) Reset() { *m = CompactTx{} } func (m *CompactTx) String() string { return proto.CompactTextString(m) } func (*CompactTx) ProtoMessage() {} func (*CompactTx) Descriptor() ([]byte, []int) { - return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{1} + return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{1} } func (m *CompactTx) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CompactTx.Unmarshal(m, b) @@ -189,7 +189,7 @@ func (m *CompactSpend) Reset() { *m = CompactSpend{} } func (m *CompactSpend) String() string { return proto.CompactTextString(m) } func (*CompactSpend) ProtoMessage() {} func (*CompactSpend) Descriptor() ([]byte, []int) { - return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{2} + return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{2} } func (m *CompactSpend) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CompactSpend.Unmarshal(m, b) @@ -229,7 +229,7 @@ func (m *CompactOutput) Reset() { *m = CompactOutput{} } func (m *CompactOutput) String() string { return proto.CompactTextString(m) } func (*CompactOutput) ProtoMessage() {} func (*CompactOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{3} + return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{3} } func (m *CompactOutput) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CompactOutput.Unmarshal(m, b) @@ -271,35 +271,37 @@ func (m *CompactOutput) GetCiphertext() []byte { } func init() { - proto.RegisterType((*CompactBlock)(nil), "rpc.CompactBlock") - proto.RegisterType((*CompactTx)(nil), "rpc.CompactTx") - proto.RegisterType((*CompactSpend)(nil), "rpc.CompactSpend") - proto.RegisterType((*CompactOutput)(nil), "rpc.CompactOutput") + proto.RegisterType((*CompactBlock)(nil), "cash.z.wallet.sdk.rpc.CompactBlock") + proto.RegisterType((*CompactTx)(nil), "cash.z.wallet.sdk.rpc.CompactTx") + proto.RegisterType((*CompactSpend)(nil), "cash.z.wallet.sdk.rpc.CompactSpend") + proto.RegisterType((*CompactOutput)(nil), "cash.z.wallet.sdk.rpc.CompactOutput") } func init() { - proto.RegisterFile("compact_formats.proto", fileDescriptor_compact_formats_9dd2f8e478a3b8fc) -} - -var fileDescriptor_compact_formats_9dd2f8e478a3b8fc = []byte{ - // 302 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x51, 0x4b, 0x4e, 0xc3, 0x30, - 0x10, 0x55, 0x3e, 0x0d, 0x62, 0x48, 0x2b, 0x18, 0x01, 0xf2, 0xaa, 0x8a, 0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, 0x5a, 0x77, 0x35, 0x5f, 0xb7, 0xf5, 0x0a, 0x0f, 0x06, 0xbc, 0x87, 0x33, 0x75, - 0x70, 0xfa, 0xe0, 0x2c, 0x5b, 0x90, 0x17, 0xe7, 0xde, 0x17, 0x92, 0xf8, 0xbf, 0xa5, 0x5c, 0x4f, - 0x07, 0xa5, 0x29, 0xb8, 0x82, 0x78, 0x68, 0x28, 0x61, 0xce, 0xe3, 0xa1, 0x29, 0xb7, 0xb0, 0x3c, - 0xe9, 0xf4, 0xd9, 0x44, 0x7f, 0x08, 0x0e, 0x0f, 0x3d, 0x23, 0xf5, 0x3e, 0x3c, 0xc0, 0x43, 0x5c, - 0x03, 0x88, 0x4e, 0xb7, 0xd2, 0x38, 0x39, 0xba, 0x70, 0xdf, 0x19, 0xf3, 0x91, 0xd1, 0xff, 0x3c, - 0xfe, 0x05, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x23, 0xf6, 0xee, 0xeb, 0x01, 0x00, 0x00, + proto.RegisterFile("compact_formats.proto", fileDescriptor_compact_formats_e98cba77ef7a6fd2) +} + +var fileDescriptor_compact_formats_e98cba77ef7a6fd2 = []byte{ + // 332 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x3f, 0x6b, 0xeb, 0x30, + 0x14, 0xc5, 0xf1, 0x9f, 0xf8, 0x91, 0x1b, 0xe7, 0xf1, 0x10, 0x2f, 0x45, 0x53, 0x30, 0x6e, 0x07, + 0x4f, 0x1a, 0xd2, 0xb1, 0xd0, 0x21, 0xfd, 0x00, 0x05, 0xa5, 0x74, 0xe8, 0x52, 0x5c, 0x59, 0xae, + 0x4d, 0x62, 0x4b, 0x48, 0x4a, 0x6b, 0xfa, 0xe1, 0x3a, 0xf5, 0x83, 0x15, 0xc9, 0x6a, 0x48, 0xa0, + 0x64, 0x3b, 0xf7, 0x70, 0xce, 0xe5, 0x77, 0xb9, 0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e7, 0xdb, 0xf7, + 0x2e, 0x4c, 0x7f, 0x4a, 0xf9, 0xf2, 0xf0, 0x06, 0xb7, 0x17, 0xfd, 0x85, 0xb0, 0xaf, 0xdd, 0x15, + 0x29, 0x0d, 0xfb, 0x3a, 0xdf, 0xc0, 0xfc, 0xa4, 0x69, 0xf9, 0x59, 0xb7, 0xf7, 0x09, 0x2b, 0xad, + 0xc3, 0xe5, 0xd6, 0x1f, 0x69, 0x25, 0x5a, 0x02, 0xb0, 0x56, 0x36, 0x5c, 0x19, 0x3e, 0x18, 0xff, + 0x95, 0x23, 0x67, 0x3d, 0x7b, 0x9a, 0x8e, 0x74, 0x4a, 0xb2, 0x97, 0xc4, 0xbd, 0xf8, 0xfa, 0x3b, + 0x00, 0x00, 0xff, 0xff, 0xf7, 0x3a, 0x6a, 0x01, 0x40, 0x02, 0x00, 0x00, } diff --git a/rpc/compact_formats.proto b/walletrpc/compact_formats.proto similarity index 96% rename from rpc/compact_formats.proto rename to walletrpc/compact_formats.proto index 07e336c..d65b658 100644 --- a/rpc/compact_formats.proto +++ b/walletrpc/compact_formats.proto @@ -1,5 +1,6 @@ syntax = "proto3"; -package rpc; +package cash.z.wallet.sdk.rpc; +option go_package = "walletrpc"; // Remember that proto3 fields are all optional. A field that is not present will be set to its zero value. // bytes fields of hashes are in canonical little-endian format. diff --git a/rpc/generate.go b/walletrpc/generate.go similarity index 88% rename from rpc/generate.go rename to walletrpc/generate.go index e6c7d33..836010f 100644 --- a/rpc/generate.go +++ b/walletrpc/generate.go @@ -1,4 +1,4 @@ -package rpc +package walletrpc //go:generate protoc -I . ./compact_formats.proto --go_out=plugins=grpc:. //go:generate protoc -I . ./service.proto --go_out=plugins=grpc:. diff --git a/rpc/service.pb.go b/walletrpc/service.pb.go similarity index 79% rename from rpc/service.pb.go rename to walletrpc/service.pb.go index a254c9d..2356195 100644 --- a/rpc/service.pb.go +++ b/walletrpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: service.proto -package rpc +package walletrpc import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -37,7 +37,7 @@ func (m *BlockID) Reset() { *m = BlockID{} } func (m *BlockID) String() string { return proto.CompactTextString(m) } func (*BlockID) ProtoMessage() {} func (*BlockID) Descriptor() ([]byte, []int) { - return fileDescriptor_service_a868da2f21e04b98, []int{0} + return fileDescriptor_service_087f17e455cf31eb, []int{0} } func (m *BlockID) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockID.Unmarshal(m, b) @@ -86,7 +86,7 @@ func (m *BlockRange) Reset() { *m = BlockRange{} } func (m *BlockRange) String() string { return proto.CompactTextString(m) } func (*BlockRange) ProtoMessage() {} func (*BlockRange) Descriptor() ([]byte, []int) { - return fileDescriptor_service_a868da2f21e04b98, []int{1} + return fileDescriptor_service_087f17e455cf31eb, []int{1} } func (m *BlockRange) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockRange.Unmarshal(m, b) @@ -135,7 +135,7 @@ func (m *TxFilter) Reset() { *m = TxFilter{} } func (m *TxFilter) String() string { return proto.CompactTextString(m) } func (*TxFilter) ProtoMessage() {} func (*TxFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_service_a868da2f21e04b98, []int{2} + return fileDescriptor_service_087f17e455cf31eb, []int{2} } func (m *TxFilter) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TxFilter.Unmarshal(m, b) @@ -188,7 +188,7 @@ func (m *RawTransaction) Reset() { *m = RawTransaction{} } func (m *RawTransaction) String() string { return proto.CompactTextString(m) } func (*RawTransaction) ProtoMessage() {} func (*RawTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_service_a868da2f21e04b98, []int{3} + return fileDescriptor_service_087f17e455cf31eb, []int{3} } func (m *RawTransaction) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RawTransaction.Unmarshal(m, b) @@ -227,7 +227,7 @@ func (m *SendResponse) Reset() { *m = SendResponse{} } func (m *SendResponse) String() string { return proto.CompactTextString(m) } func (*SendResponse) ProtoMessage() {} func (*SendResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_service_a868da2f21e04b98, []int{4} + return fileDescriptor_service_087f17e455cf31eb, []int{4} } func (m *SendResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendResponse.Unmarshal(m, b) @@ -272,7 +272,7 @@ func (m *ChainSpec) Reset() { *m = ChainSpec{} } func (m *ChainSpec) String() string { return proto.CompactTextString(m) } func (*ChainSpec) ProtoMessage() {} func (*ChainSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_service_a868da2f21e04b98, []int{5} + return fileDescriptor_service_087f17e455cf31eb, []int{5} } func (m *ChainSpec) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChainSpec.Unmarshal(m, b) @@ -293,12 +293,12 @@ func (m *ChainSpec) XXX_DiscardUnknown() { var xxx_messageInfo_ChainSpec proto.InternalMessageInfo func init() { - proto.RegisterType((*BlockID)(nil), "rpc.BlockID") - proto.RegisterType((*BlockRange)(nil), "rpc.BlockRange") - proto.RegisterType((*TxFilter)(nil), "rpc.TxFilter") - proto.RegisterType((*RawTransaction)(nil), "rpc.RawTransaction") - proto.RegisterType((*SendResponse)(nil), "rpc.SendResponse") - proto.RegisterType((*ChainSpec)(nil), "rpc.ChainSpec") + proto.RegisterType((*BlockID)(nil), "cash.z.wallet.sdk.rpc.BlockID") + proto.RegisterType((*BlockRange)(nil), "cash.z.wallet.sdk.rpc.BlockRange") + proto.RegisterType((*TxFilter)(nil), "cash.z.wallet.sdk.rpc.TxFilter") + proto.RegisterType((*RawTransaction)(nil), "cash.z.wallet.sdk.rpc.RawTransaction") + proto.RegisterType((*SendResponse)(nil), "cash.z.wallet.sdk.rpc.SendResponse") + proto.RegisterType((*ChainSpec)(nil), "cash.z.wallet.sdk.rpc.ChainSpec") } // Reference imports to suppress errors if they are not otherwise used. @@ -330,7 +330,7 @@ func NewCompactTxStreamerClient(cc *grpc.ClientConn) CompactTxStreamerClient { func (c *compactTxStreamerClient) GetLatestBlock(ctx context.Context, in *ChainSpec, opts ...grpc.CallOption) (*BlockID, error) { out := new(BlockID) - err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/GetLatestBlock", in, out, opts...) + err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock", in, out, opts...) if err != nil { return nil, err } @@ -339,7 +339,7 @@ func (c *compactTxStreamerClient) GetLatestBlock(ctx context.Context, in *ChainS func (c *compactTxStreamerClient) GetBlock(ctx context.Context, in *BlockID, opts ...grpc.CallOption) (*CompactBlock, error) { out := new(CompactBlock) - err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/GetBlock", in, out, opts...) + err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock", in, out, opts...) if err != nil { return nil, err } @@ -347,7 +347,7 @@ func (c *compactTxStreamerClient) GetBlock(ctx context.Context, in *BlockID, opt } func (c *compactTxStreamerClient) GetBlockRange(ctx context.Context, in *BlockRange, opts ...grpc.CallOption) (CompactTxStreamer_GetBlockRangeClient, error) { - stream, err := c.cc.NewStream(ctx, &_CompactTxStreamer_serviceDesc.Streams[0], "/rpc.CompactTxStreamer/GetBlockRange", opts...) + stream, err := c.cc.NewStream(ctx, &_CompactTxStreamer_serviceDesc.Streams[0], "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange", opts...) if err != nil { return nil, err } @@ -380,7 +380,7 @@ func (x *compactTxStreamerGetBlockRangeClient) Recv() (*CompactBlock, error) { func (c *compactTxStreamerClient) GetTransaction(ctx context.Context, in *TxFilter, opts ...grpc.CallOption) (*RawTransaction, error) { out := new(RawTransaction) - err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/GetTransaction", in, out, opts...) + err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction", in, out, opts...) if err != nil { return nil, err } @@ -389,7 +389,7 @@ func (c *compactTxStreamerClient) GetTransaction(ctx context.Context, in *TxFilt func (c *compactTxStreamerClient) SendTransaction(ctx context.Context, in *RawTransaction, opts ...grpc.CallOption) (*SendResponse, error) { out := new(SendResponse) - err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/SendTransaction", in, out, opts...) + err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction", in, out, opts...) if err != nil { return nil, err } @@ -419,7 +419,7 @@ func _CompactTxStreamer_GetLatestBlock_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/rpc.CompactTxStreamer/GetLatestBlock", + FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CompactTxStreamerServer).GetLatestBlock(ctx, req.(*ChainSpec)) @@ -437,7 +437,7 @@ func _CompactTxStreamer_GetBlock_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/rpc.CompactTxStreamer/GetBlock", + FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CompactTxStreamerServer).GetBlock(ctx, req.(*BlockID)) @@ -476,7 +476,7 @@ func _CompactTxStreamer_GetTransaction_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/rpc.CompactTxStreamer/GetTransaction", + FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CompactTxStreamerServer).GetTransaction(ctx, req.(*TxFilter)) @@ -494,7 +494,7 @@ func _CompactTxStreamer_SendTransaction_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/rpc.CompactTxStreamer/SendTransaction", + FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CompactTxStreamerServer).SendTransaction(ctx, req.(*RawTransaction)) @@ -503,7 +503,7 @@ func _CompactTxStreamer_SendTransaction_Handler(srv interface{}, ctx context.Con } var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rpc.CompactTxStreamer", + ServiceName: "cash.z.wallet.sdk.rpc.CompactTxStreamer", HandlerType: (*CompactTxStreamerServer)(nil), Methods: []grpc.MethodDesc{ { @@ -533,33 +533,35 @@ var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{ Metadata: "service.proto", } -func init() { proto.RegisterFile("service.proto", fileDescriptor_service_a868da2f21e04b98) } - -var fileDescriptor_service_a868da2f21e04b98 = []byte{ - // 386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcd, 0x8f, 0x12, 0x31, - 0x14, 0x9f, 0x59, 0x60, 0x5d, 0xde, 0x0e, 0x6c, 0xb6, 0x7e, 0x64, 0x33, 0x31, 0x86, 0x34, 0x1e, - 0xb8, 0x48, 0x08, 0x46, 0x3d, 0x78, 0x13, 0x23, 0x31, 0xd1, 0x84, 0x14, 0x0e, 0xde, 0x4c, 0xe9, - 0x3c, 0x99, 0x89, 0xd0, 0x4e, 0xda, 0x46, 0xf9, 0x7b, 0xfc, 0x4b, 0xcd, 0xbc, 0x0e, 0x30, 0xb3, - 0xe1, 0xd6, 0xf7, 0x7e, 0x1f, 0xef, 0xab, 0x30, 0x70, 0x68, 0xff, 0x14, 0x0a, 0x27, 0xa5, 0x35, - 0xde, 0xb0, 0x8e, 0x2d, 0x55, 0xfa, 0x5c, 0x99, 0x7d, 0x29, 0x95, 0xff, 0xf9, 0xcb, 0xd8, 0xbd, - 0xf4, 0x2e, 0x60, 0xfc, 0x1d, 0x3c, 0xf9, 0xb4, 0x33, 0xea, 0xf7, 0xd7, 0xcf, 0x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49, 0x8f, 0xce, 0xd3, 0x7c, 0x6c, 0x48, 0xb3, 0x9e, 0x74, 0x69, 0x6b, 0x76, - 0x1e, 0xb1, 0x37, 0x70, 0xb3, 0xc0, 0x9a, 0xdb, 0xc2, 0xd2, 0xfb, 0xa0, 0x0c, 0x35, 0x28, 0xc9, - 0x23, 0xf6, 0x01, 0x06, 0x47, 0x7a, 0x38, 0xd5, 0xdd, 0x59, 0x43, 0x89, 0x8b, 0xb2, 0x69, 0xcc, - 0xde, 0x53, 0x67, 0xcd, 0xa5, 0x0d, 0x88, 0x78, 0xbc, 0x51, 0xfa, 0x94, 0xc2, 0xf6, 0x62, 0x79, - 0xc4, 0x3e, 0xc2, 0x5d, 0xb5, 0xc6, 0xa6, 0xf0, 0x12, 0xb3, 0x2e, 0xdb, 0xdc, 0x38, 0x8f, 0x36, - 0xd7, 0xf4, 0x27, 0xdf, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xe7, 0x91, 0x93, 0xc0, 0x02, - 0x00, 0x00, +func init() { proto.RegisterFile("service.proto", fileDescriptor_service_087f17e455cf31eb) } + +var fileDescriptor_service_087f17e455cf31eb = []byte{ + // 420 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x51, 0x6f, 0xd3, 0x30, + 0x10, 0xc7, 0x1b, 0xda, 0x8e, 0xe5, 0x9a, 0x0d, 0x61, 0x31, 0x34, 0x45, 0x08, 0x8a, 0x01, 0x69, + 0x4f, 0xd1, 0x34, 0xe0, 0x0b, 0xac, 0x88, 0x09, 0x09, 0x24, 0x70, 0xf3, 0x34, 0x1e, 0xa6, 0x9b, + 0x73, 0x34, 0x61, 0xa9, 0x1d, 0xd9, 0x16, 0xab, 0xf8, 0xa0, 0x7c, 0x1e, 0x14, 0xbb, 0x1b, 0x99, + 0x44, 0xd6, 0xbe, 0xf9, 0x9c, 0xdf, 0xfd, 0x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7b, 0x06, 0x31, + 0x19, 0xa3, 0xcd, 0x4c, 0x17, 0xe4, 0xc1, 0xb1, 0xf8, 0x77, 0xc1, 0x38, 0x24, 0x3e, 0xf8, 0x42, + 0xd6, 0xe2, 0x82, 0x7c, 0x11, 0xb1, 0xb8, 0x73, 0xc7, 0x27, 0x10, 0xcf, 0x4a, 0xac, 0xd4, 0xbc, + 0x21, 0x79, 0xf2, 0x67, 0x08, 0x8f, 0x67, 0x61, 0x6e, 0xf9, 0x6a, 0xee, 0x0c, 0xe1, 0x92, 0x0c, + 0xcb, 0x61, 0xff, 0x8c, 0xdc, 0x67, 0x74, 0x64, 0x9d, 0xef, 0x8f, 0x4d, 0x7b, 0xba, 0xbf, 0x55, + 0x4a, 0x37, 0xbc, 0x0f, 0x1f, 0xb0, 0x6f, 0xb0, 0x7b, 0x46, 0x6b, 0xbd, 0x0d, 0x74, 0xfa, 0xaa, + 0xcf, 0x2f, 0xd4, 0xea, 0x31, 0x3e, 0x60, 0xdf, 0x61, 0xef, 0x46, 0x32, 0x2c, 0xca, 0xcb, 0xfb, + 0x74, 0x3d, 0xb2, 0xa5, 0xf4, 0x71, 0xc4, 0xce, 0xfd, 0x2b, 0x74, 0x07, 0xf4, 0xa2, 0x27, 0xf5, + 0x66, 0x67, 0xd2, 0x37, 0x3d, 0xc0, 0xdd, 0x41, 0xf3, 0x01, 0xbb, 0x80, 0x47, 0xed, 0x58, 0xbb, + 0xe2, 0xdb, 0xe5, 0xf6, 0x96, 0xdf, 0xdd, 0x12, 0x3e, 0x38, 0x9d, 0x9c, 0xc7, 0x01, 0x30, 0x8d, + 0xbc, 0xdc, 0xf1, 0xbf, 0xe2, 0xdb, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x58, 0x6c, 0xab, 0xf9, + 0xc9, 0x03, 0x00, 0x00, } diff --git a/rpc/service.proto b/walletrpc/service.proto similarity index 95% rename from rpc/service.proto rename to walletrpc/service.proto index d808ef0..2ae46d2 100644 --- a/rpc/service.proto +++ b/walletrpc/service.proto @@ -1,5 +1,6 @@ syntax = "proto3"; -package rpc; +package cash.z.wallet.sdk.rpc; +option go_package = "walletrpc"; import "compact_formats.proto";