diff --git a/foundation/rpc_server/rpc_server.go b/foundation/rpc_server/rpc_server.go index e3af6c0..307bccf 100644 --- a/foundation/rpc_server/rpc_server.go +++ b/foundation/rpc_server/rpc_server.go @@ -116,6 +116,32 @@ func (s *Server) GetBlockHeight(ctx context.Context, _ *emptypb.Empty) (*protobu }}, nil } +func (s *Server) QuerySmartContract(ctx context.Context, req *protobuff.QuerySmartContractRequest) (*protobuff.QuerySmartContractResponse, error) { + reqData, err := base64.StdEncoding.DecodeString(req.RequestData) + if err != nil { + return nil, status.Errorf(codes.FailedPrecondition, "failed to decode from base64 the request data: %s", req.RequestData) + } + + client, err := s.qPool.Get() + if err != nil { + return nil, status.Errorf(codes.Internal, "getting pool connection %v", err) + } + + scData, err := client.QuerySmartContract(ctx, qubic.RequestContractFunction{ + ContractIndex: req.ContractIndex, + InputType: uint16(req.InputType), + InputSize: uint16(req.InputSize), + }, reqData) + if err != nil { + s.qPool.Close(client) + return nil, status.Errorf(codes.Internal, "query smart contract %v", err) + } + + s.qPool.Put(client) + + return &protobuff.QuerySmartContractResponse{ResponseData: base64.StdEncoding.EncodeToString(scData.Data)}, nil +} + type maxTickResponse struct { MaxTick uint32 `json:"max_tick"` } diff --git a/go.mod b/go.mod index e2d9dce..211ea87 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ardanlabs/conf v1.5.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 github.com/pkg/errors v0.9.1 - github.com/qubic/go-node-connector v0.7.1 + github.com/qubic/go-node-connector v0.8.0 github.com/qubic/go-schnorrq v1.0.0 google.golang.org/genproto/googleapis/api v0.0.0-20240314234333-6e1732d8331c google.golang.org/grpc v1.62.1 diff --git a/go.sum b/go.sum index b78ae5d..cc53ea8 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/qubic/go-node-connector v0.7.1 h1:AvkirqMTW6PQ7VxvALJOSI2+Cja3cl1llwFqWftaD6I= -github.com/qubic/go-node-connector v0.7.1/go.mod h1:3Q9xCv5c01AqxVIx1aijMd8Pt3KJyQQiDfc4sG0UnXI= +github.com/qubic/go-node-connector v0.8.0 h1:GzA8rpLvbEAkqz/AWkM/7Ut4P9KkwrkdP++tmF2eKHs= +github.com/qubic/go-node-connector v0.8.0/go.mod h1:3Q9xCv5c01AqxVIx1aijMd8Pt3KJyQQiDfc4sG0UnXI= github.com/qubic/go-schnorrq v1.0.0 h1:EiCC3v9v3esFFfhKNEGdAI4DFIY3Dm/wbH327pC5qco= github.com/qubic/go-schnorrq v1.0.0/go.mod h1:KW64PcvyF4+cBA22pCx9wcoKDqPIbGz0EZ9dCZWV6Yo= github.com/silenceper/pool v1.0.0 h1:JTCaA+U6hJAA0P8nCx+JfsRCHMwLTfatsm5QXelffmU= diff --git a/protobuff/Makefile b/protobuff/Makefile index f096bce..d89d8a4 100644 --- a/protobuff/Makefile +++ b/protobuff/Makefile @@ -28,8 +28,9 @@ all: $(GO) --go_out=paths=source_relative:. *.proto openapi: *.proto - protoc --openapiv2_out=logtostderr=true:. $(OPT_ARGS) \ - *.proto + protoc --openapiv2_out=logtostderr=true:. \ + --proto_path=.:/opt/homebrew/Cellar/protobuf/25.3_1/include \ + *.proto clean: rm -f *.pb.go diff --git a/protobuff/qubic.pb.go b/protobuff/qubic.pb.go index d825c90..bc629fe 100644 --- a/protobuff/qubic.pb.go +++ b/protobuff/qubic.pb.go @@ -1276,6 +1276,124 @@ func (x *PossessedAssetsResponse) GetPossessedAssets() []*PossessedAsset { return nil } +type QuerySmartContractRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContractIndex uint32 `protobuf:"varint,1,opt,name=contract_index,json=contractIndex,proto3" json:"contract_index,omitempty"` + InputType uint32 `protobuf:"varint,2,opt,name=input_type,json=inputType,proto3" json:"input_type,omitempty"` + InputSize uint32 `protobuf:"varint,3,opt,name=input_size,json=inputSize,proto3" json:"input_size,omitempty"` + RequestData string `protobuf:"bytes,4,opt,name=request_data,json=requestData,proto3" json:"request_data,omitempty"` +} + +func (x *QuerySmartContractRequest) Reset() { + *x = QuerySmartContractRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_qubic_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuerySmartContractRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuerySmartContractRequest) ProtoMessage() {} + +func (x *QuerySmartContractRequest) ProtoReflect() protoreflect.Message { + mi := &file_qubic_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuerySmartContractRequest.ProtoReflect.Descriptor instead. +func (*QuerySmartContractRequest) Descriptor() ([]byte, []int) { + return file_qubic_proto_rawDescGZIP(), []int{21} +} + +func (x *QuerySmartContractRequest) GetContractIndex() uint32 { + if x != nil { + return x.ContractIndex + } + return 0 +} + +func (x *QuerySmartContractRequest) GetInputType() uint32 { + if x != nil { + return x.InputType + } + return 0 +} + +func (x *QuerySmartContractRequest) GetInputSize() uint32 { + if x != nil { + return x.InputSize + } + return 0 +} + +func (x *QuerySmartContractRequest) GetRequestData() string { + if x != nil { + return x.RequestData + } + return "" +} + +type QuerySmartContractResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ResponseData string `protobuf:"bytes,5,opt,name=response_data,json=responseData,proto3" json:"response_data,omitempty"` +} + +func (x *QuerySmartContractResponse) Reset() { + *x = QuerySmartContractResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_qubic_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuerySmartContractResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuerySmartContractResponse) ProtoMessage() {} + +func (x *QuerySmartContractResponse) ProtoReflect() protoreflect.Message { + mi := &file_qubic_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuerySmartContractResponse.ProtoReflect.Descriptor instead. +func (*QuerySmartContractResponse) Descriptor() ([]byte, []int) { + return file_qubic_proto_rawDescGZIP(), []int{22} +} + +func (x *QuerySmartContractResponse) GetResponseData() string { + if x != nil { + return x.ResponseData + } + return "" +} + var File_qubic_proto protoreflect.FileDescriptor var file_qubic_proto_rawDesc = []byte{ @@ -1461,69 +1579,93 @@ var file_qubic_proto_rawDesc = []byte{ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x0f, 0x70, 0x6f, 0x73, 0x73, - 0x65, 0x73, 0x73, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x32, 0xa9, 0x07, 0x0a, 0x10, - 0x51, 0x75, 0x62, 0x69, 0x63, 0x4c, 0x69, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x75, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x26, - 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, - 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, - 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, - 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x9e, 0x01, 0x0a, 0x14, 0x42, 0x72, 0x6f, 0x61, - 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x30, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, - 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, - 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, - 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x3a, 0x01, 0x2a, - 0x22, 0x16, 0x2f, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x2d, 0x74, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x63, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, - 0x69, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x28, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, - 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x0c, 0x12, 0x0a, 0x2f, 0x74, 0x69, 0x63, 0x6b, 0x2d, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x6c, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2b, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, + 0x65, 0x73, 0x73, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x22, 0xa3, 0x01, 0x0a, 0x19, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x6d, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, + 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, + 0x61, 0x22, 0x41, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x6d, 0x61, 0x72, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x44, 0x61, 0x74, 0x61, 0x32, 0xc1, 0x08, 0x0a, 0x10, 0x51, 0x75, 0x62, 0x69, 0x63, 0x4c, 0x69, + 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x75, 0x0a, 0x0a, 0x47, 0x65, 0x74, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x26, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x89, 0x01, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, - 0x28, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, - 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x62, 0x69, - 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, - 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x61, - 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x7d, - 0x2f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4f, - 0x77, 0x6e, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x27, 0x2e, 0x71, 0x75, 0x62, + 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x27, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, + 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, + 0x12, 0x0e, 0x2f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, + 0x12, 0x95, 0x01, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x6d, 0x61, 0x72, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, + 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x53, 0x6d, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, + 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x53, 0x6d, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, + 0x3a, 0x01, 0x2a, 0x22, 0x13, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x6d, 0x61, 0x72, 0x74, + 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x9e, 0x01, 0x0a, 0x14, 0x42, 0x72, 0x6f, + 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x30, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, + 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, + 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, + 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, + 0x61, 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x3a, 0x01, + 0x2a, 0x22, 0x16, 0x2f, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x2d, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x63, 0x0a, 0x0b, 0x47, 0x65, 0x74, + 0x54, 0x69, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x28, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, + 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x74, 0x69, 0x63, 0x6b, 0x2d, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x6c, + 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2b, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, + 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x47, + 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x89, 0x01, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, + 0x12, 0x28, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, + 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x73, 0x73, + 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, - 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, - 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x41, - 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x7d, 0x2f, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x12, - 0x95, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x65, 0x64, - 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, - 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, - 0x73, 0x65, 0x73, 0x73, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, - 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, - 0x73, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x73, 0x73, 0x65, - 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x7d, 0x2f, 0x70, 0x6f, - 0x73, 0x73, 0x65, 0x73, 0x73, 0x65, 0x64, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2f, 0x71, 0x75, 0x62, 0x69, - 0x63, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x66, - 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, + 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x7d, 0x2f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, + 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x27, 0x2e, 0x71, 0x75, + 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, + 0x62, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, + 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x64, + 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, + 0x7b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x7d, 0x2f, 0x6f, 0x77, 0x6e, 0x65, 0x64, + 0x12, 0x95, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x65, + 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, + 0x68, 0x74, 0x74, 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, + 0x73, 0x73, 0x65, 0x73, 0x73, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x68, 0x74, 0x74, + 0x70, 0x2e, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x73, 0x73, 0x65, + 0x73, 0x73, 0x65, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x73, 0x73, + 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x7d, 0x2f, 0x70, + 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x65, 0x64, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x62, 0x69, 0x63, 0x2f, 0x71, 0x75, 0x62, + 0x69, 0x63, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x66, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1538,7 +1680,7 @@ func file_qubic_proto_rawDescGZIP() []byte { return file_qubic_proto_rawDescData } -var file_qubic_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_qubic_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_qubic_proto_goTypes = []interface{}{ (*Balance)(nil), // 0: qubic.http.qubic.pb.Balance (*GetBalanceRequest)(nil), // 1: qubic.http.qubic.pb.GetBalanceRequest @@ -1561,7 +1703,9 @@ var file_qubic_proto_goTypes = []interface{}{ (*PossessedAsset)(nil), // 18: qubic.http.qubic.pb.PossessedAsset (*PossessedAssetsRequest)(nil), // 19: qubic.http.qubic.pb.PossessedAssetsRequest (*PossessedAssetsResponse)(nil), // 20: qubic.http.qubic.pb.PossessedAssetsResponse - (*emptypb.Empty)(nil), // 21: google.protobuf.Empty + (*QuerySmartContractRequest)(nil), // 21: qubic.http.qubic.pb.QuerySmartContractRequest + (*QuerySmartContractResponse)(nil), // 22: qubic.http.qubic.pb.QuerySmartContractResponse + (*emptypb.Empty)(nil), // 23: google.protobuf.Empty } var file_qubic_proto_depIdxs = []int32{ 0, // 0: qubic.http.qubic.pb.GetBalanceResponse.balance:type_name -> qubic.http.qubic.pb.Balance @@ -1579,21 +1723,23 @@ var file_qubic_proto_depIdxs = []int32{ 8, // 12: qubic.http.qubic.pb.PossessedAsset.info:type_name -> qubic.http.qubic.pb.AssetInfo 18, // 13: qubic.http.qubic.pb.PossessedAssetsResponse.possessed_assets:type_name -> qubic.http.qubic.pb.PossessedAsset 1, // 14: qubic.http.qubic.pb.QubicLiveService.GetBalance:input_type -> qubic.http.qubic.pb.GetBalanceRequest - 3, // 15: qubic.http.qubic.pb.QubicLiveService.BroadcastTransaction:input_type -> qubic.http.qubic.pb.BroadcastTransactionRequest - 21, // 16: qubic.http.qubic.pb.QubicLiveService.GetTickInfo:input_type -> google.protobuf.Empty - 21, // 17: qubic.http.qubic.pb.QubicLiveService.GetBlockHeight:input_type -> google.protobuf.Empty - 11, // 18: qubic.http.qubic.pb.QubicLiveService.GetIssuedAssets:input_type -> qubic.http.qubic.pb.IssuedAssetsRequest - 15, // 19: qubic.http.qubic.pb.QubicLiveService.GetOwnedAssets:input_type -> qubic.http.qubic.pb.OwnedAssetsRequest - 19, // 20: qubic.http.qubic.pb.QubicLiveService.GetPossessedAssets:input_type -> qubic.http.qubic.pb.PossessedAssetsRequest - 2, // 21: qubic.http.qubic.pb.QubicLiveService.GetBalance:output_type -> qubic.http.qubic.pb.GetBalanceResponse - 4, // 22: qubic.http.qubic.pb.QubicLiveService.BroadcastTransaction:output_type -> qubic.http.qubic.pb.BroadcastTransactionResponse - 6, // 23: qubic.http.qubic.pb.QubicLiveService.GetTickInfo:output_type -> qubic.http.qubic.pb.GetTickInfoResponse - 7, // 24: qubic.http.qubic.pb.QubicLiveService.GetBlockHeight:output_type -> qubic.http.qubic.pb.GetBlockHeightResponse - 12, // 25: qubic.http.qubic.pb.QubicLiveService.GetIssuedAssets:output_type -> qubic.http.qubic.pb.IssuedAssetsResponse - 16, // 26: qubic.http.qubic.pb.QubicLiveService.GetOwnedAssets:output_type -> qubic.http.qubic.pb.OwnedAssetsResponse - 20, // 27: qubic.http.qubic.pb.QubicLiveService.GetPossessedAssets:output_type -> qubic.http.qubic.pb.PossessedAssetsResponse - 21, // [21:28] is the sub-list for method output_type - 14, // [14:21] is the sub-list for method input_type + 21, // 15: qubic.http.qubic.pb.QubicLiveService.QuerySmartContract:input_type -> qubic.http.qubic.pb.QuerySmartContractRequest + 3, // 16: qubic.http.qubic.pb.QubicLiveService.BroadcastTransaction:input_type -> qubic.http.qubic.pb.BroadcastTransactionRequest + 23, // 17: qubic.http.qubic.pb.QubicLiveService.GetTickInfo:input_type -> google.protobuf.Empty + 23, // 18: qubic.http.qubic.pb.QubicLiveService.GetBlockHeight:input_type -> google.protobuf.Empty + 11, // 19: qubic.http.qubic.pb.QubicLiveService.GetIssuedAssets:input_type -> qubic.http.qubic.pb.IssuedAssetsRequest + 15, // 20: qubic.http.qubic.pb.QubicLiveService.GetOwnedAssets:input_type -> qubic.http.qubic.pb.OwnedAssetsRequest + 19, // 21: qubic.http.qubic.pb.QubicLiveService.GetPossessedAssets:input_type -> qubic.http.qubic.pb.PossessedAssetsRequest + 2, // 22: qubic.http.qubic.pb.QubicLiveService.GetBalance:output_type -> qubic.http.qubic.pb.GetBalanceResponse + 22, // 23: qubic.http.qubic.pb.QubicLiveService.QuerySmartContract:output_type -> qubic.http.qubic.pb.QuerySmartContractResponse + 4, // 24: qubic.http.qubic.pb.QubicLiveService.BroadcastTransaction:output_type -> qubic.http.qubic.pb.BroadcastTransactionResponse + 6, // 25: qubic.http.qubic.pb.QubicLiveService.GetTickInfo:output_type -> qubic.http.qubic.pb.GetTickInfoResponse + 7, // 26: qubic.http.qubic.pb.QubicLiveService.GetBlockHeight:output_type -> qubic.http.qubic.pb.GetBlockHeightResponse + 12, // 27: qubic.http.qubic.pb.QubicLiveService.GetIssuedAssets:output_type -> qubic.http.qubic.pb.IssuedAssetsResponse + 16, // 28: qubic.http.qubic.pb.QubicLiveService.GetOwnedAssets:output_type -> qubic.http.qubic.pb.OwnedAssetsResponse + 20, // 29: qubic.http.qubic.pb.QubicLiveService.GetPossessedAssets:output_type -> qubic.http.qubic.pb.PossessedAssetsResponse + 22, // [22:30] is the sub-list for method output_type + 14, // [14:22] is the sub-list for method input_type 14, // [14:14] is the sub-list for extension type_name 14, // [14:14] is the sub-list for extension extendee 0, // [0:14] is the sub-list for field type_name @@ -1857,6 +2003,30 @@ func file_qubic_proto_init() { return nil } } + file_qubic_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuerySmartContractRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_qubic_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuerySmartContractResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1864,7 +2034,7 @@ func file_qubic_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_qubic_proto_rawDesc, NumEnums: 0, - NumMessages: 21, + NumMessages: 23, NumExtensions: 0, NumServices: 1, }, diff --git a/protobuff/qubic.pb.gw.go b/protobuff/qubic.pb.gw.go index 93b4d77..186d7d6 100644 --- a/protobuff/qubic.pb.gw.go +++ b/protobuff/qubic.pb.gw.go @@ -84,6 +84,40 @@ func local_request_QubicLiveService_GetBalance_0(ctx context.Context, marshaler } +func request_QubicLiveService_QuerySmartContract_0(ctx context.Context, marshaler runtime.Marshaler, client QubicLiveServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySmartContractRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QuerySmartContract(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_QubicLiveService_QuerySmartContract_0(ctx context.Context, marshaler runtime.Marshaler, server QubicLiveServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySmartContractRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QuerySmartContract(ctx, &protoReq) + return msg, metadata, err + +} + func request_QubicLiveService_BroadcastTransaction_0(ctx context.Context, marshaler runtime.Marshaler, client QubicLiveServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq BroadcastTransactionRequest var metadata runtime.ServerMetadata @@ -341,6 +375,31 @@ func RegisterQubicLiveServiceHandlerServer(ctx context.Context, mux *runtime.Ser }) + mux.Handle("POST", pattern_QubicLiveService_QuerySmartContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/qubic.http.qubic.pb.QubicLiveService/QuerySmartContract", runtime.WithHTTPPathPattern("/querySmartContract")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_QubicLiveService_QuerySmartContract_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_QubicLiveService_QuerySmartContract_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_QubicLiveService_BroadcastTransaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -554,6 +613,28 @@ func RegisterQubicLiveServiceHandlerClient(ctx context.Context, mux *runtime.Ser }) + mux.Handle("POST", pattern_QubicLiveService_QuerySmartContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/qubic.http.qubic.pb.QubicLiveService/QuerySmartContract", runtime.WithHTTPPathPattern("/querySmartContract")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_QubicLiveService_QuerySmartContract_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_QubicLiveService_QuerySmartContract_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_QubicLiveService_BroadcastTransaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -692,6 +773,8 @@ func RegisterQubicLiveServiceHandlerClient(ctx context.Context, mux *runtime.Ser var ( pattern_QubicLiveService_GetBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"balances", "id"}, "")) + pattern_QubicLiveService_QuerySmartContract_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"querySmartContract"}, "")) + pattern_QubicLiveService_BroadcastTransaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"broadcast-transaction"}, "")) pattern_QubicLiveService_GetTickInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"tick-info"}, "")) @@ -708,6 +791,8 @@ var ( var ( forward_QubicLiveService_GetBalance_0 = runtime.ForwardResponseMessage + forward_QubicLiveService_QuerySmartContract_0 = runtime.ForwardResponseMessage + forward_QubicLiveService_BroadcastTransaction_0 = runtime.ForwardResponseMessage forward_QubicLiveService_GetTickInfo_0 = runtime.ForwardResponseMessage diff --git a/protobuff/qubic.proto b/protobuff/qubic.proto index 05348c5..d33c04a 100644 --- a/protobuff/qubic.proto +++ b/protobuff/qubic.proto @@ -128,6 +128,17 @@ message PossessedAssetsResponse { repeated PossessedAsset possessed_assets = 1; } +message QuerySmartContractRequest { + uint32 contract_index = 1; + uint32 input_type = 2; + uint32 input_size = 3; + string request_data = 4; +} + +message QuerySmartContractResponse { + string response_data = 5; +} + service QubicLiveService { rpc GetBalance(GetBalanceRequest) returns (GetBalanceResponse) { option (google.api.http) = { @@ -135,6 +146,13 @@ service QubicLiveService { }; }; + rpc QuerySmartContract(QuerySmartContractRequest) returns (QuerySmartContractResponse) { + option (google.api.http) = { + post: "/querySmartContract" + body: "*" + }; + }; + rpc BroadcastTransaction(BroadcastTransactionRequest) returns (BroadcastTransactionResponse) { option (google.api.http) = { post: "/broadcast-transaction" diff --git a/protobuff/qubic_grpc.pb.go b/protobuff/qubic_grpc.pb.go index fded329..d8b0216 100644 --- a/protobuff/qubic_grpc.pb.go +++ b/protobuff/qubic_grpc.pb.go @@ -21,6 +21,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( QubicLiveService_GetBalance_FullMethodName = "/qubic.http.qubic.pb.QubicLiveService/GetBalance" + QubicLiveService_QuerySmartContract_FullMethodName = "/qubic.http.qubic.pb.QubicLiveService/QuerySmartContract" QubicLiveService_BroadcastTransaction_FullMethodName = "/qubic.http.qubic.pb.QubicLiveService/BroadcastTransaction" QubicLiveService_GetTickInfo_FullMethodName = "/qubic.http.qubic.pb.QubicLiveService/GetTickInfo" QubicLiveService_GetBlockHeight_FullMethodName = "/qubic.http.qubic.pb.QubicLiveService/GetBlockHeight" @@ -34,6 +35,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type QubicLiveServiceClient interface { GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceResponse, error) + QuerySmartContract(ctx context.Context, in *QuerySmartContractRequest, opts ...grpc.CallOption) (*QuerySmartContractResponse, error) BroadcastTransaction(ctx context.Context, in *BroadcastTransactionRequest, opts ...grpc.CallOption) (*BroadcastTransactionResponse, error) GetTickInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetTickInfoResponse, error) GetBlockHeight(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetBlockHeightResponse, error) @@ -59,6 +61,15 @@ func (c *qubicLiveServiceClient) GetBalance(ctx context.Context, in *GetBalanceR return out, nil } +func (c *qubicLiveServiceClient) QuerySmartContract(ctx context.Context, in *QuerySmartContractRequest, opts ...grpc.CallOption) (*QuerySmartContractResponse, error) { + out := new(QuerySmartContractResponse) + err := c.cc.Invoke(ctx, QubicLiveService_QuerySmartContract_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *qubicLiveServiceClient) BroadcastTransaction(ctx context.Context, in *BroadcastTransactionRequest, opts ...grpc.CallOption) (*BroadcastTransactionResponse, error) { out := new(BroadcastTransactionResponse) err := c.cc.Invoke(ctx, QubicLiveService_BroadcastTransaction_FullMethodName, in, out, opts...) @@ -118,6 +129,7 @@ func (c *qubicLiveServiceClient) GetPossessedAssets(ctx context.Context, in *Pos // for forward compatibility type QubicLiveServiceServer interface { GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceResponse, error) + QuerySmartContract(context.Context, *QuerySmartContractRequest) (*QuerySmartContractResponse, error) BroadcastTransaction(context.Context, *BroadcastTransactionRequest) (*BroadcastTransactionResponse, error) GetTickInfo(context.Context, *emptypb.Empty) (*GetTickInfoResponse, error) GetBlockHeight(context.Context, *emptypb.Empty) (*GetBlockHeightResponse, error) @@ -134,6 +146,9 @@ type UnimplementedQubicLiveServiceServer struct { func (UnimplementedQubicLiveServiceServer) GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBalance not implemented") } +func (UnimplementedQubicLiveServiceServer) QuerySmartContract(context.Context, *QuerySmartContractRequest) (*QuerySmartContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QuerySmartContract not implemented") +} func (UnimplementedQubicLiveServiceServer) BroadcastTransaction(context.Context, *BroadcastTransactionRequest) (*BroadcastTransactionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BroadcastTransaction not implemented") } @@ -183,6 +198,24 @@ func _QubicLiveService_GetBalance_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _QubicLiveService_QuerySmartContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySmartContractRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QubicLiveServiceServer).QuerySmartContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: QubicLiveService_QuerySmartContract_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QubicLiveServiceServer).QuerySmartContract(ctx, req.(*QuerySmartContractRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _QubicLiveService_BroadcastTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(BroadcastTransactionRequest) if err := dec(in); err != nil { @@ -302,6 +335,10 @@ var QubicLiveService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetBalance", Handler: _QubicLiveService_GetBalance_Handler, }, + { + MethodName: "QuerySmartContract", + Handler: _QubicLiveService_QuerySmartContract_Handler, + }, { MethodName: "BroadcastTransaction", Handler: _QubicLiveService_BroadcastTransaction_Handler,