mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
NS: Add GetNameByAnyId method
This commit is contained in:
parent
2d65758ba3
commit
ef9e107496
5 changed files with 289 additions and 29 deletions
|
@ -55,6 +55,21 @@ func (mr *MockAnyNsClientServiceBaseMockRecorder) GetNameByAddress(ctx, in any)
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAddress", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).GetNameByAddress), ctx, in)
|
||||
}
|
||||
|
||||
// GetNameByAnyId mocks base method.
|
||||
func (m *MockAnyNsClientServiceBase) GetNameByAnyId(ctx context.Context, in *nameserviceproto.NameByAnyIdRequest) (*nameserviceproto.NameByAddressResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetNameByAnyId", ctx, in)
|
||||
ret0, _ := ret[0].(*nameserviceproto.NameByAddressResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetNameByAnyId indicates an expected call of GetNameByAnyId.
|
||||
func (mr *MockAnyNsClientServiceBaseMockRecorder) GetNameByAnyId(ctx, in any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAnyId", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).GetNameByAnyId), ctx, in)
|
||||
}
|
||||
|
||||
// Init mocks base method.
|
||||
func (m *MockAnyNsClientServiceBase) Init(a *app.App) error {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -181,6 +196,21 @@ func (mr *MockAnyNsClientServiceMockRecorder) GetNameByAddress(ctx, in any) *gom
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAddress", reflect.TypeOf((*MockAnyNsClientService)(nil).GetNameByAddress), ctx, in)
|
||||
}
|
||||
|
||||
// GetNameByAnyId mocks base method.
|
||||
func (m *MockAnyNsClientService) GetNameByAnyId(ctx context.Context, in *nameserviceproto.NameByAnyIdRequest) (*nameserviceproto.NameByAddressResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetNameByAnyId", ctx, in)
|
||||
ret0, _ := ret[0].(*nameserviceproto.NameByAddressResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetNameByAnyId indicates an expected call of GetNameByAnyId.
|
||||
func (mr *MockAnyNsClientServiceMockRecorder) GetNameByAnyId(ctx, in any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAnyId", reflect.TypeOf((*MockAnyNsClientService)(nil).GetNameByAnyId), ctx, in)
|
||||
}
|
||||
|
||||
// GetOperation mocks base method.
|
||||
func (m *MockAnyNsClientService) GetOperation(ctx context.Context, in *nameserviceproto.GetOperationStatusRequest) (*nameserviceproto.OperationResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
|
|
@ -26,6 +26,7 @@ type AnyNsClientServiceBase interface {
|
|||
IsNameAvailable(ctx context.Context, in *nsp.NameAvailableRequest) (out *nsp.NameAvailableResponse, err error)
|
||||
// reverse resolve
|
||||
GetNameByAddress(ctx context.Context, in *nsp.NameByAddressRequest) (out *nsp.NameByAddressResponse, err error)
|
||||
GetNameByAnyId(ctx context.Context, in *nsp.NameByAnyIdRequest) (out *nsp.NameByAddressResponse, err error)
|
||||
|
||||
app.Component
|
||||
}
|
||||
|
@ -125,6 +126,16 @@ func (s *service) GetNameByAddress(ctx context.Context, in *nsp.NameByAddressReq
|
|||
return
|
||||
}
|
||||
|
||||
func (s *service) GetNameByAnyId(ctx context.Context, in *nsp.NameByAnyIdRequest) (out *nsp.NameByAddressResponse, err error) {
|
||||
err = s.doClient(ctx, func(cl nsp.DRPCAnynsClient) error {
|
||||
if out, err = cl.GetNameByAnyId(ctx, in); err != nil {
|
||||
return rpcerr.Unwrap(err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// AA
|
||||
func (s *service) GetUserAccount(ctx context.Context, in *nsp.GetUserAccountRequest) (out *nsp.UserAccount, err error) {
|
||||
err = s.doClientAA(ctx, func(cl nsp.DRPCAnynsAccountAbstractionClient) error {
|
||||
|
|
|
@ -113,6 +113,50 @@ func (m *NameByAddressRequest) GetOwnerScwEthAddress() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
type NameByAnyIdRequest struct {
|
||||
AnyAddress string `protobuf:"bytes,1,opt,name=anyAddress,proto3" json:"anyAddress,omitempty"`
|
||||
}
|
||||
|
||||
func (m *NameByAnyIdRequest) Reset() { *m = NameByAnyIdRequest{} }
|
||||
func (m *NameByAnyIdRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*NameByAnyIdRequest) ProtoMessage() {}
|
||||
func (*NameByAnyIdRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_06bca2ea4304f305, []int{2}
|
||||
}
|
||||
func (m *NameByAnyIdRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *NameByAnyIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_NameByAnyIdRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *NameByAnyIdRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NameByAnyIdRequest.Merge(m, src)
|
||||
}
|
||||
func (m *NameByAnyIdRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *NameByAnyIdRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NameByAnyIdRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NameByAnyIdRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *NameByAnyIdRequest) GetAnyAddress() string {
|
||||
if m != nil {
|
||||
return m.AnyAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type NameAvailableResponse struct {
|
||||
Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"`
|
||||
// EOA -> SCW -> name
|
||||
|
@ -135,7 +179,7 @@ func (m *NameAvailableResponse) Reset() { *m = NameAvailableResponse{} }
|
|||
func (m *NameAvailableResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*NameAvailableResponse) ProtoMessage() {}
|
||||
func (*NameAvailableResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_06bca2ea4304f305, []int{2}
|
||||
return fileDescriptor_06bca2ea4304f305, []int{3}
|
||||
}
|
||||
func (m *NameAvailableResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -215,7 +259,7 @@ func (m *NameByAddressResponse) Reset() { *m = NameByAddressResponse{} }
|
|||
func (m *NameByAddressResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*NameByAddressResponse) ProtoMessage() {}
|
||||
func (*NameByAddressResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_06bca2ea4304f305, []int{3}
|
||||
return fileDescriptor_06bca2ea4304f305, []int{4}
|
||||
}
|
||||
func (m *NameByAddressResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -261,6 +305,7 @@ func (m *NameByAddressResponse) GetName() string {
|
|||
func init() {
|
||||
proto.RegisterType((*NameAvailableRequest)(nil), "NameAvailableRequest")
|
||||
proto.RegisterType((*NameByAddressRequest)(nil), "NameByAddressRequest")
|
||||
proto.RegisterType((*NameByAnyIdRequest)(nil), "NameByAnyIdRequest")
|
||||
proto.RegisterType((*NameAvailableResponse)(nil), "NameAvailableResponse")
|
||||
proto.RegisterType((*NameByAddressResponse)(nil), "NameByAddressResponse")
|
||||
}
|
||||
|
@ -270,32 +315,34 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_06bca2ea4304f305 = []byte{
|
||||
// 396 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4d, 0x6b, 0xea, 0x40,
|
||||
0x14, 0xcd, 0x3c, 0x3f, 0x9e, 0xce, 0x5b, 0xf8, 0x18, 0xf4, 0xbd, 0x10, 0x24, 0x48, 0x56, 0xae,
|
||||
0x22, 0x58, 0x5a, 0xba, 0x8d, 0xc5, 0x16, 0x29, 0xb4, 0x10, 0x77, 0xdd, 0x94, 0xd1, 0x5c, 0x6d,
|
||||
0x20, 0x4e, 0xd2, 0x4c, 0xd4, 0xfa, 0x2f, 0xfa, 0xb3, 0xba, 0x74, 0xd9, 0x4d, 0xa1, 0xe8, 0x6f,
|
||||
0xe8, 0xbe, 0x64, 0x32, 0xd1, 0x68, 0xb5, 0xd0, 0x8d, 0xce, 0x3d, 0xf7, 0x9c, 0x73, 0xe7, 0xdc,
|
||||
0x09, 0x3e, 0x65, 0x74, 0x02, 0x1c, 0xc2, 0x99, 0x3b, 0x84, 0x56, 0xe6, 0x1c, 0x84, 0x7e, 0xe4,
|
||||
0xb7, 0xc4, 0x2f, 0xcf, 0xe2, 0xa6, 0x80, 0xb4, 0xf3, 0x1f, 0xca, 0xee, 0x29, 0x4d, 0x94, 0x46,
|
||||
0x1b, 0x57, 0x6f, 0xe8, 0x04, 0xac, 0x19, 0x75, 0x3d, 0x3a, 0xf0, 0xc0, 0x86, 0xc7, 0x29, 0xf0,
|
||||
0x88, 0x68, 0xb8, 0x34, 0x9a, 0x7a, 0x5e, 0xdc, 0x53, 0x51, 0x03, 0x35, 0xcb, 0xf6, 0xa6, 0x36,
|
||||
0x2e, 0x13, 0x4d, 0x67, 0x61, 0x39, 0x4e, 0x08, 0x9c, 0xa7, 0x1a, 0x13, 0x13, 0x7f, 0xce, 0x20,
|
||||
0xec, 0x0f, 0xe7, 0xdd, 0xe8, 0x41, 0x36, 0xa5, 0xfa, 0x40, 0xc7, 0xf8, 0x40, 0xb8, 0xb6, 0x37,
|
||||
0x9c, 0x07, 0x3e, 0xe3, 0x40, 0xea, 0xb8, 0x4c, 0x53, 0x50, 0x18, 0x94, 0xec, 0x2d, 0x70, 0x64,
|
||||
0xce, 0xaf, 0x63, 0x73, 0x48, 0x13, 0x57, 0x04, 0x9a, 0x21, 0xe7, 0x04, 0x79, 0x1f, 0xde, 0x30,
|
||||
0x2d, 0x96, 0x66, 0x53, 0xf3, 0x19, 0xe6, 0x16, 0x26, 0x2a, 0xfe, 0xcd, 0x03, 0x3a, 0x84, 0x9e,
|
||||
0xa3, 0x16, 0x04, 0x23, 0x2d, 0x49, 0x03, 0xff, 0x89, 0x37, 0xdd, 0x7d, 0x0a, 0xdc, 0x10, 0xb8,
|
||||
0x5a, 0x6c, 0xa0, 0x66, 0xce, 0xce, 0x42, 0x86, 0x95, 0xc4, 0xce, 0xec, 0x4f, 0xc6, 0xae, 0xe2,
|
||||
0xc2, 0xc8, 0x9f, 0x32, 0x47, 0x46, 0x4e, 0x0a, 0x42, 0x70, 0x3e, 0x56, 0xcb, 0x80, 0xe2, 0xdc,
|
||||
0x7e, 0x43, 0xb8, 0x60, 0xb1, 0x05, 0xe3, 0xa4, 0x83, 0x2b, 0x3d, 0xbe, 0xb3, 0x45, 0x52, 0x33,
|
||||
0x0f, 0x3d, 0xa9, 0xf6, 0xcf, 0x3c, 0xb8, 0x6c, 0x43, 0x21, 0x17, 0xf8, 0xef, 0x15, 0x44, 0x3b,
|
||||
0x77, 0x92, 0x26, 0xfb, 0x6f, 0x2c, 0x4d, 0xbe, 0x5c, 0xdd, 0x50, 0xc8, 0x35, 0xfe, 0x6f, 0x39,
|
||||
0x13, 0x97, 0xc5, 0x7d, 0x1b, 0xc6, 0x2e, 0x8f, 0x20, 0xec, 0xbb, 0x63, 0x06, 0x0e, 0xd1, 0xcc,
|
||||
0x2c, 0x28, 0xad, 0x92, 0x9e, 0x46, 0xcc, 0xdb, 0x00, 0x42, 0x1a, 0xb9, 0x3e, 0xdb, 0x9a, 0x75,
|
||||
0xce, 0x5e, 0x56, 0x3a, 0x5a, 0xae, 0x74, 0xf4, 0xbe, 0xd2, 0xd1, 0xf3, 0x5a, 0x57, 0x96, 0x6b,
|
||||
0x5d, 0x79, 0x5d, 0xeb, 0xca, 0x5d, 0xfd, 0xbb, 0x4f, 0x7d, 0x50, 0x14, 0x7f, 0x27, 0x9f, 0x01,
|
||||
0x00, 0x00, 0xff, 0xff, 0xd0, 0xac, 0x32, 0x54, 0x48, 0x03, 0x00, 0x00,
|
||||
// 430 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0x6f, 0xd3, 0x40,
|
||||
0x10, 0xb5, 0xdb, 0xa6, 0xb4, 0x83, 0x44, 0xd1, 0xd0, 0x82, 0x65, 0x55, 0x56, 0xe4, 0x53, 0x4e,
|
||||
0xae, 0x54, 0x3e, 0xc4, 0x0d, 0x39, 0xa8, 0xa0, 0x08, 0x09, 0x24, 0xf7, 0xc6, 0x05, 0x6d, 0xe2,
|
||||
0x49, 0xb0, 0xe4, 0xac, 0x8d, 0xd7, 0x49, 0xf0, 0xbf, 0xe0, 0x17, 0xf0, 0x7b, 0x38, 0xe6, 0xc8,
|
||||
0x11, 0x25, 0xbf, 0x81, 0x3b, 0xf2, 0x7a, 0x1d, 0x6f, 0x3e, 0x25, 0x2e, 0xf6, 0xee, 0x9b, 0xf7,
|
||||
0x9e, 0xde, 0x8c, 0xc7, 0xf0, 0x92, 0xb3, 0x31, 0x09, 0xca, 0xa6, 0xd1, 0x80, 0x6e, 0xb4, 0x73,
|
||||
0x9a, 0x25, 0x79, 0x72, 0x23, 0x9f, 0x42, 0xc7, 0x3d, 0x09, 0xd9, 0xaf, 0xff, 0x53, 0xf6, 0x85,
|
||||
0xb1, 0x4a, 0xe9, 0xde, 0xc2, 0xe5, 0x47, 0x36, 0x26, 0x7f, 0xca, 0xa2, 0x98, 0xf5, 0x63, 0x0a,
|
||||
0xe8, 0xdb, 0x84, 0x44, 0x8e, 0x36, 0x9c, 0x0d, 0x27, 0x71, 0x5c, 0xd6, 0x2c, 0xb3, 0x6d, 0x76,
|
||||
0xce, 0x83, 0xd5, 0xdd, 0x7d, 0x57, 0x69, 0xba, 0x85, 0x1f, 0x86, 0x19, 0x09, 0x51, 0x6b, 0x3c,
|
||||
0xc0, 0x64, 0xc6, 0x29, 0xbb, 0x1f, 0xcc, 0xee, 0xf2, 0xaf, 0xaa, 0xa8, 0xd4, 0x3b, 0x2a, 0xee,
|
||||
0x0b, 0x40, 0xe5, 0xc3, 0x8b, 0x5e, 0x58, 0xbb, 0x38, 0x00, 0x8c, 0x17, 0xeb, 0x6a, 0x0d, 0x71,
|
||||
0xff, 0x9a, 0x70, 0xb5, 0x11, 0x59, 0xa4, 0x09, 0x17, 0x84, 0xd7, 0x70, 0xce, 0x6a, 0x50, 0x0a,
|
||||
0xcf, 0x82, 0x06, 0xd8, 0x93, 0xee, 0x68, 0x5f, 0x3a, 0xec, 0xc0, 0x85, 0x44, 0x35, 0xf2, 0xb1,
|
||||
0x24, 0x6f, 0xc2, 0x2b, 0xa6, 0xdf, 0xc4, 0x3e, 0xd1, 0x98, 0x0d, 0x8c, 0x16, 0x3c, 0x10, 0x29,
|
||||
0x1b, 0x50, 0x2f, 0xb4, 0x5a, 0x92, 0x51, 0x5f, 0xb1, 0x0d, 0x0f, 0xcb, 0xef, 0x73, 0xf7, 0x3d,
|
||||
0x8d, 0x32, 0x12, 0xd6, 0x69, 0xdb, 0xec, 0x1c, 0x07, 0x3a, 0xe4, 0xfa, 0x55, 0xdb, 0xda, 0xd4,
|
||||
0x55, 0xdb, 0x97, 0xd0, 0x1a, 0x26, 0x13, 0x1e, 0xaa, 0x96, 0xab, 0x0b, 0x22, 0x9c, 0x94, 0x6a,
|
||||
0xd5, 0xa0, 0x3c, 0xdf, 0xfe, 0x3c, 0x82, 0x96, 0xcf, 0x0b, 0x2e, 0xb0, 0x0b, 0x17, 0x3d, 0xb1,
|
||||
0x36, 0x45, 0xbc, 0xf2, 0x76, 0x2d, 0x82, 0xfd, 0xd4, 0xdb, 0x39, 0x6c, 0xd7, 0xc0, 0xb7, 0xf0,
|
||||
0xf8, 0x3d, 0xe5, 0x6b, 0x99, 0x94, 0xc9, 0xe6, 0x66, 0x28, 0x93, 0xad, 0xe8, 0xae, 0x81, 0x6f,
|
||||
0xe0, 0x51, 0x63, 0x52, 0xae, 0x01, 0x3e, 0xf1, 0xb6, 0x97, 0xe2, 0x80, 0xc1, 0x07, 0x78, 0xe6,
|
||||
0x87, 0xe3, 0x88, 0x97, 0xf5, 0x80, 0x46, 0x91, 0xc8, 0x29, 0xbb, 0x8f, 0x46, 0x9c, 0x42, 0xb4,
|
||||
0x3d, 0x1d, 0x54, 0x56, 0x55, 0xcd, 0x46, 0xef, 0x53, 0x4a, 0x19, 0xcb, 0xa3, 0x84, 0x37, 0x66,
|
||||
0xdd, 0x57, 0xbf, 0x16, 0x8e, 0x39, 0x5f, 0x38, 0xe6, 0x9f, 0x85, 0x63, 0xfe, 0x58, 0x3a, 0xc6,
|
||||
0x7c, 0xe9, 0x18, 0xbf, 0x97, 0x8e, 0xf1, 0xf9, 0xfa, 0xd0, 0x1f, 0xd6, 0x3f, 0x95, 0xaf, 0xe7,
|
||||
0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xb9, 0x86, 0xac, 0xbf, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *NameAvailableRequest) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -358,6 +405,36 @@ func (m *NameByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *NameByAnyIdRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *NameByAnyIdRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *NameByAnyIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.AnyAddress) > 0 {
|
||||
i -= len(m.AnyAddress)
|
||||
copy(dAtA[i:], m.AnyAddress)
|
||||
i = encodeVarintNameservice(dAtA, i, uint64(len(m.AnyAddress)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *NameAvailableResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
|
@ -501,6 +578,19 @@ func (m *NameByAddressRequest) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *NameByAnyIdRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.AnyAddress)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovNameservice(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *NameAvailableResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
|
@ -718,6 +808,88 @@ func (m *NameByAddressRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *NameByAnyIdRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowNameservice
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: NameByAnyIdRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: NameByAnyIdRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AnyAddress", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowNameservice
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthNameservice
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthNameservice
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.AnyAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipNameservice(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthNameservice
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
|
@ -42,6 +42,7 @@ type DRPCAnynsClient interface {
|
|||
|
||||
IsNameAvailable(ctx context.Context, in *NameAvailableRequest) (*NameAvailableResponse, error)
|
||||
GetNameByAddress(ctx context.Context, in *NameByAddressRequest) (*NameByAddressResponse, error)
|
||||
GetNameByAnyId(ctx context.Context, in *NameByAnyIdRequest) (*NameByAddressResponse, error)
|
||||
AdminNameRegisterSigned(ctx context.Context, in *NameRegisterRequestSigned) (*OperationResponse, error)
|
||||
}
|
||||
|
||||
|
@ -73,6 +74,15 @@ func (c *drpcAnynsClient) GetNameByAddress(ctx context.Context, in *NameByAddres
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcAnynsClient) GetNameByAnyId(ctx context.Context, in *NameByAnyIdRequest) (*NameByAddressResponse, error) {
|
||||
out := new(NameByAddressResponse)
|
||||
err := c.cc.Invoke(ctx, "/Anyns/GetNameByAnyId", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcAnynsClient) AdminNameRegisterSigned(ctx context.Context, in *NameRegisterRequestSigned) (*OperationResponse, error) {
|
||||
out := new(OperationResponse)
|
||||
err := c.cc.Invoke(ctx, "/Anyns/AdminNameRegisterSigned", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out)
|
||||
|
@ -85,6 +95,7 @@ func (c *drpcAnynsClient) AdminNameRegisterSigned(ctx context.Context, in *NameR
|
|||
type DRPCAnynsServer interface {
|
||||
IsNameAvailable(context.Context, *NameAvailableRequest) (*NameAvailableResponse, error)
|
||||
GetNameByAddress(context.Context, *NameByAddressRequest) (*NameByAddressResponse, error)
|
||||
GetNameByAnyId(context.Context, *NameByAnyIdRequest) (*NameByAddressResponse, error)
|
||||
AdminNameRegisterSigned(context.Context, *NameRegisterRequestSigned) (*OperationResponse, error)
|
||||
}
|
||||
|
||||
|
@ -98,13 +109,17 @@ func (s *DRPCAnynsUnimplementedServer) GetNameByAddress(context.Context, *NameBy
|
|||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCAnynsUnimplementedServer) GetNameByAnyId(context.Context, *NameByAnyIdRequest) (*NameByAddressResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCAnynsUnimplementedServer) AdminNameRegisterSigned(context.Context, *NameRegisterRequestSigned) (*OperationResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
type DRPCAnynsDescription struct{}
|
||||
|
||||
func (DRPCAnynsDescription) NumMethods() int { return 3 }
|
||||
func (DRPCAnynsDescription) NumMethods() int { return 4 }
|
||||
|
||||
func (DRPCAnynsDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
|
@ -127,6 +142,15 @@ func (DRPCAnynsDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver,
|
|||
)
|
||||
}, DRPCAnynsServer.GetNameByAddress, true
|
||||
case 2:
|
||||
return "/Anyns/GetNameByAnyId", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCAnynsServer).
|
||||
GetNameByAnyId(
|
||||
ctx,
|
||||
in1.(*NameByAnyIdRequest),
|
||||
)
|
||||
}, DRPCAnynsServer.GetNameByAnyId, true
|
||||
case 3:
|
||||
return "/Anyns/AdminNameRegisterSigned", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCAnynsServer).
|
||||
|
@ -176,6 +200,22 @@ func (x *drpcAnyns_GetNameByAddressStream) SendAndClose(m *NameByAddressResponse
|
|||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCAnyns_GetNameByAnyIdStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*NameByAddressResponse) error
|
||||
}
|
||||
|
||||
type drpcAnyns_GetNameByAnyIdStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcAnyns_GetNameByAnyIdStream) SendAndClose(m *NameByAddressResponse) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCAnyns_AdminNameRegisterSignedStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*OperationResponse) error
|
||||
|
|
|
@ -15,6 +15,10 @@ message NameByAddressRequest {
|
|||
string ownerScwEthAddress = 1;
|
||||
}
|
||||
|
||||
message NameByAnyIdRequest {
|
||||
string anyAddress = 1;
|
||||
}
|
||||
|
||||
message NameAvailableResponse {
|
||||
bool available = 1;
|
||||
|
||||
|
@ -51,6 +55,9 @@ service Anyns {
|
|||
// Reverse lookup: address -> name
|
||||
rpc GetNameByAddress(NameByAddressRequest) returns (NameByAddressResponse) {}
|
||||
|
||||
// Reverse lookup: ANY ID -> name
|
||||
rpc GetNameByAnyId(NameByAnyIdRequest) returns (NameByAddressResponse) {}
|
||||
|
||||
// Register new name for the user (on behalf of the user)
|
||||
// Anytype CAN only register names for users, but can not transfer or update them!
|
||||
rpc AdminNameRegisterSigned(NameRegisterRequestSigned) returns (OperationResponse) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue