mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-11 10:18:08 +09:00
Merge pull request #119 from anyproto/feat/move-ns-client
Add nameservice folder: protos + client
This commit is contained in:
commit
fa0493ad9c
7 changed files with 4922 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -26,6 +26,7 @@ proto:
|
||||||
protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. coordinator/coordinatorproto/protos/*.proto
|
protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. coordinator/coordinatorproto/protos/*.proto
|
||||||
protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. consensus/consensusproto/protos/*.proto
|
protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. consensus/consensusproto/protos/*.proto
|
||||||
protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. identityrepo/identityrepoproto/protos/*.proto
|
protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. identityrepo/identityrepoproto/protos/*.proto
|
||||||
|
protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. nameservice/nameserviceproto/protos/*.proto
|
||||||
|
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
|
|
1066
nameservice/nameserviceproto/nameservice.pb.go
Normal file
1066
nameservice/nameserviceproto/nameservice.pb.go
Normal file
File diff suppressed because it is too large
Load diff
3185
nameservice/nameserviceproto/nameservice_aa.pb.go
Normal file
3185
nameservice/nameserviceproto/nameservice_aa.pb.go
Normal file
File diff suppressed because it is too large
Load diff
313
nameservice/nameserviceproto/nameservice_aa_drpc.pb.go
Normal file
313
nameservice/nameserviceproto/nameservice_aa_drpc.pb.go
Normal file
|
@ -0,0 +1,313 @@
|
||||||
|
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
||||||
|
// protoc-gen-go-drpc version: v0.0.33
|
||||||
|
// source: nameservice/nameserviceproto/protos/nameservice_aa.proto
|
||||||
|
|
||||||
|
package nameserviceproto
|
||||||
|
|
||||||
|
import (
|
||||||
|
bytes "bytes"
|
||||||
|
context "context"
|
||||||
|
errors "errors"
|
||||||
|
jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||||
|
proto "github.com/gogo/protobuf/proto"
|
||||||
|
drpc "storj.io/drpc"
|
||||||
|
drpcerr "storj.io/drpc/drpcerr"
|
||||||
|
)
|
||||||
|
|
||||||
|
type drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto struct{}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto) Marshal(msg drpc.Message) ([]byte, error) {
|
||||||
|
return proto.Marshal(msg.(proto.Message))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto) Unmarshal(buf []byte, msg drpc.Message) error {
|
||||||
|
return proto.Unmarshal(buf, msg.(proto.Message))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return buf.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
|
||||||
|
return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message))
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstractionClient interface {
|
||||||
|
DRPCConn() drpc.Conn
|
||||||
|
|
||||||
|
GetOperation(ctx context.Context, in *GetOperationStatusRequest) (*OperationResponse, error)
|
||||||
|
AdminFundUserAccount(ctx context.Context, in *AdminFundUserAccountRequestSigned) (*OperationResponse, error)
|
||||||
|
AdminFundGasOperations(ctx context.Context, in *AdminFundGasOperationsRequestSigned) (*OperationResponse, error)
|
||||||
|
GetUserAccount(ctx context.Context, in *GetUserAccountRequest) (*UserAccount, error)
|
||||||
|
GetDataNameRegister(ctx context.Context, in *NameRegisterRequest) (*GetDataNameRegisterResponse, error)
|
||||||
|
CreateUserOperation(ctx context.Context, in *CreateUserOperationRequestSigned) (*OperationResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsAccountAbstractionClient struct {
|
||||||
|
cc drpc.Conn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDRPCAnynsAccountAbstractionClient(cc drpc.Conn) DRPCAnynsAccountAbstractionClient {
|
||||||
|
return &drpcAnynsAccountAbstractionClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsAccountAbstractionClient) DRPCConn() drpc.Conn { return c.cc }
|
||||||
|
|
||||||
|
func (c *drpcAnynsAccountAbstractionClient) GetOperation(ctx context.Context, in *GetOperationStatusRequest) (*OperationResponse, error) {
|
||||||
|
out := new(OperationResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/GetOperation", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsAccountAbstractionClient) AdminFundUserAccount(ctx context.Context, in *AdminFundUserAccountRequestSigned) (*OperationResponse, error) {
|
||||||
|
out := new(OperationResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/AdminFundUserAccount", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsAccountAbstractionClient) AdminFundGasOperations(ctx context.Context, in *AdminFundGasOperationsRequestSigned) (*OperationResponse, error) {
|
||||||
|
out := new(OperationResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/AdminFundGasOperations", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsAccountAbstractionClient) GetUserAccount(ctx context.Context, in *GetUserAccountRequest) (*UserAccount, error) {
|
||||||
|
out := new(UserAccount)
|
||||||
|
err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/GetUserAccount", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsAccountAbstractionClient) GetDataNameRegister(ctx context.Context, in *NameRegisterRequest) (*GetDataNameRegisterResponse, error) {
|
||||||
|
out := new(GetDataNameRegisterResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/GetDataNameRegister", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsAccountAbstractionClient) CreateUserOperation(ctx context.Context, in *CreateUserOperationRequestSigned) (*OperationResponse, error) {
|
||||||
|
out := new(OperationResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/CreateUserOperation", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstractionServer interface {
|
||||||
|
GetOperation(context.Context, *GetOperationStatusRequest) (*OperationResponse, error)
|
||||||
|
AdminFundUserAccount(context.Context, *AdminFundUserAccountRequestSigned) (*OperationResponse, error)
|
||||||
|
AdminFundGasOperations(context.Context, *AdminFundGasOperationsRequestSigned) (*OperationResponse, error)
|
||||||
|
GetUserAccount(context.Context, *GetUserAccountRequest) (*UserAccount, error)
|
||||||
|
GetDataNameRegister(context.Context, *NameRegisterRequest) (*GetDataNameRegisterResponse, error)
|
||||||
|
CreateUserOperation(context.Context, *CreateUserOperationRequestSigned) (*OperationResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstractionUnimplementedServer struct{}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsAccountAbstractionUnimplementedServer) GetOperation(context.Context, *GetOperationStatusRequest) (*OperationResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsAccountAbstractionUnimplementedServer) AdminFundUserAccount(context.Context, *AdminFundUserAccountRequestSigned) (*OperationResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsAccountAbstractionUnimplementedServer) AdminFundGasOperations(context.Context, *AdminFundGasOperationsRequestSigned) (*OperationResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsAccountAbstractionUnimplementedServer) GetUserAccount(context.Context, *GetUserAccountRequest) (*UserAccount, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsAccountAbstractionUnimplementedServer) GetDataNameRegister(context.Context, *NameRegisterRequest) (*GetDataNameRegisterResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsAccountAbstractionUnimplementedServer) CreateUserOperation(context.Context, *CreateUserOperationRequestSigned) (*OperationResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstractionDescription struct{}
|
||||||
|
|
||||||
|
func (DRPCAnynsAccountAbstractionDescription) NumMethods() int { return 6 }
|
||||||
|
|
||||||
|
func (DRPCAnynsAccountAbstractionDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||||
|
switch n {
|
||||||
|
case 0:
|
||||||
|
return "/AnynsAccountAbstraction/GetOperation", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsAccountAbstractionServer).
|
||||||
|
GetOperation(
|
||||||
|
ctx,
|
||||||
|
in1.(*GetOperationStatusRequest),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsAccountAbstractionServer.GetOperation, true
|
||||||
|
case 1:
|
||||||
|
return "/AnynsAccountAbstraction/AdminFundUserAccount", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsAccountAbstractionServer).
|
||||||
|
AdminFundUserAccount(
|
||||||
|
ctx,
|
||||||
|
in1.(*AdminFundUserAccountRequestSigned),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsAccountAbstractionServer.AdminFundUserAccount, true
|
||||||
|
case 2:
|
||||||
|
return "/AnynsAccountAbstraction/AdminFundGasOperations", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsAccountAbstractionServer).
|
||||||
|
AdminFundGasOperations(
|
||||||
|
ctx,
|
||||||
|
in1.(*AdminFundGasOperationsRequestSigned),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsAccountAbstractionServer.AdminFundGasOperations, true
|
||||||
|
case 3:
|
||||||
|
return "/AnynsAccountAbstraction/GetUserAccount", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsAccountAbstractionServer).
|
||||||
|
GetUserAccount(
|
||||||
|
ctx,
|
||||||
|
in1.(*GetUserAccountRequest),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsAccountAbstractionServer.GetUserAccount, true
|
||||||
|
case 4:
|
||||||
|
return "/AnynsAccountAbstraction/GetDataNameRegister", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsAccountAbstractionServer).
|
||||||
|
GetDataNameRegister(
|
||||||
|
ctx,
|
||||||
|
in1.(*NameRegisterRequest),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsAccountAbstractionServer.GetDataNameRegister, true
|
||||||
|
case 5:
|
||||||
|
return "/AnynsAccountAbstraction/CreateUserOperation", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsAccountAbstractionServer).
|
||||||
|
CreateUserOperation(
|
||||||
|
ctx,
|
||||||
|
in1.(*CreateUserOperationRequestSigned),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsAccountAbstractionServer.CreateUserOperation, true
|
||||||
|
default:
|
||||||
|
return "", nil, nil, nil, false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DRPCRegisterAnynsAccountAbstraction(mux drpc.Mux, impl DRPCAnynsAccountAbstractionServer) error {
|
||||||
|
return mux.Register(impl, DRPCAnynsAccountAbstractionDescription{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstraction_GetOperationStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*OperationResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsAccountAbstraction_GetOperationStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnynsAccountAbstraction_GetOperationStream) SendAndClose(m *OperationResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstraction_AdminFundUserAccountStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*OperationResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsAccountAbstraction_AdminFundUserAccountStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnynsAccountAbstraction_AdminFundUserAccountStream) SendAndClose(m *OperationResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstraction_AdminFundGasOperationsStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*OperationResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsAccountAbstraction_AdminFundGasOperationsStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnynsAccountAbstraction_AdminFundGasOperationsStream) SendAndClose(m *OperationResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstraction_GetUserAccountStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*UserAccount) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsAccountAbstraction_GetUserAccountStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnynsAccountAbstraction_GetUserAccountStream) SendAndClose(m *UserAccount) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstraction_GetDataNameRegisterStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*GetDataNameRegisterResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsAccountAbstraction_GetDataNameRegisterStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnynsAccountAbstraction_GetDataNameRegisterStream) SendAndClose(m *GetDataNameRegisterResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsAccountAbstraction_CreateUserOperationStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*OperationResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsAccountAbstraction_CreateUserOperationStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnynsAccountAbstraction_CreateUserOperationStream) SendAndClose(m *OperationResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
153
nameservice/nameserviceproto/nameservice_drpc.pb.go
Normal file
153
nameservice/nameserviceproto/nameservice_drpc.pb.go
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
||||||
|
// protoc-gen-go-drpc version: v0.0.33
|
||||||
|
// source: nameservice/nameserviceproto/protos/nameservice.proto
|
||||||
|
|
||||||
|
package nameserviceproto
|
||||||
|
|
||||||
|
import (
|
||||||
|
bytes "bytes"
|
||||||
|
context "context"
|
||||||
|
errors "errors"
|
||||||
|
jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||||
|
proto "github.com/gogo/protobuf/proto"
|
||||||
|
drpc "storj.io/drpc"
|
||||||
|
drpcerr "storj.io/drpc/drpcerr"
|
||||||
|
)
|
||||||
|
|
||||||
|
type drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto struct{}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto) Marshal(msg drpc.Message) ([]byte, error) {
|
||||||
|
return proto.Marshal(msg.(proto.Message))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto) Unmarshal(buf []byte, msg drpc.Message) error {
|
||||||
|
return proto.Unmarshal(buf, msg.(proto.Message))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return buf.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
|
||||||
|
return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message))
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsClient interface {
|
||||||
|
DRPCConn() drpc.Conn
|
||||||
|
|
||||||
|
IsNameAvailable(ctx context.Context, in *NameAvailableRequest) (*NameAvailableResponse, error)
|
||||||
|
GetNameByAddress(ctx context.Context, in *NameByAddressRequest) (*NameByAddressResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnynsClient struct {
|
||||||
|
cc drpc.Conn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDRPCAnynsClient(cc drpc.Conn) DRPCAnynsClient {
|
||||||
|
return &drpcAnynsClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsClient) DRPCConn() drpc.Conn { return c.cc }
|
||||||
|
|
||||||
|
func (c *drpcAnynsClient) IsNameAvailable(ctx context.Context, in *NameAvailableRequest) (*NameAvailableResponse, error) {
|
||||||
|
out := new(NameAvailableResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/Anyns/IsNameAvailable", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcAnynsClient) GetNameByAddress(ctx context.Context, in *NameByAddressRequest) (*NameByAddressResponse, error) {
|
||||||
|
out := new(NameByAddressResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/Anyns/GetNameByAddress", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsServer interface {
|
||||||
|
IsNameAvailable(context.Context, *NameAvailableRequest) (*NameAvailableResponse, error)
|
||||||
|
GetNameByAddress(context.Context, *NameByAddressRequest) (*NameByAddressResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsUnimplementedServer struct{}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsUnimplementedServer) IsNameAvailable(context.Context, *NameAvailableRequest) (*NameAvailableResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DRPCAnynsUnimplementedServer) GetNameByAddress(context.Context, *NameByAddressRequest) (*NameByAddressResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnynsDescription struct{}
|
||||||
|
|
||||||
|
func (DRPCAnynsDescription) NumMethods() int { return 2 }
|
||||||
|
|
||||||
|
func (DRPCAnynsDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||||
|
switch n {
|
||||||
|
case 0:
|
||||||
|
return "/Anyns/IsNameAvailable", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsServer).
|
||||||
|
IsNameAvailable(
|
||||||
|
ctx,
|
||||||
|
in1.(*NameAvailableRequest),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsServer.IsNameAvailable, true
|
||||||
|
case 1:
|
||||||
|
return "/Anyns/GetNameByAddress", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCAnynsServer).
|
||||||
|
GetNameByAddress(
|
||||||
|
ctx,
|
||||||
|
in1.(*NameByAddressRequest),
|
||||||
|
)
|
||||||
|
}, DRPCAnynsServer.GetNameByAddress, true
|
||||||
|
default:
|
||||||
|
return "", nil, nil, nil, false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DRPCRegisterAnyns(mux drpc.Mux, impl DRPCAnynsServer) error {
|
||||||
|
return mux.Register(impl, DRPCAnynsDescription{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnyns_IsNameAvailableStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*NameAvailableResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnyns_IsNameAvailableStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnyns_IsNameAvailableStream) SendAndClose(m *NameAvailableResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCAnyns_GetNameByAddressStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*NameByAddressResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcAnyns_GetNameByAddressStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcAnyns_GetNameByAddressStream) SendAndClose(m *NameByAddressResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
46
nameservice/nameserviceproto/protos/nameservice.proto
Normal file
46
nameservice/nameserviceproto/protos/nameservice.proto
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
option go_package = "nameservice/nameserviceproto";
|
||||||
|
|
||||||
|
//import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
message NameAvailableRequest {
|
||||||
|
// Name including .any suffix
|
||||||
|
string fullName = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message NameByAddressRequest {
|
||||||
|
// An Ethereum address that owns that name
|
||||||
|
string ownerEthAddress = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message NameAvailableResponse {
|
||||||
|
bool available = 1;
|
||||||
|
|
||||||
|
// An Ethereum address that owns that name
|
||||||
|
// This field is non-empty only if name is "already registered"
|
||||||
|
string ownerEthAddress = 2;
|
||||||
|
|
||||||
|
// A content hash attached to this name
|
||||||
|
// This field is non-empty only if name is "already registered"
|
||||||
|
string ownerAnyAddress = 3;
|
||||||
|
|
||||||
|
// A SpaceID attached to this name
|
||||||
|
// This field is non-empty only if name is "already registered"
|
||||||
|
string spaceId = 4;
|
||||||
|
|
||||||
|
// doestn't work with marashalling/unmarshalling
|
||||||
|
//google.protobuf.Timestamp nameExpires = 5 [(gogoproto.stdtime) = true];
|
||||||
|
int64 nameExpires = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message NameByAddressResponse {
|
||||||
|
bool found = 1;
|
||||||
|
|
||||||
|
string name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
service Anyns {
|
||||||
|
// Check if name is free or get the attached information if not
|
||||||
|
rpc IsNameAvailable(NameAvailableRequest) returns (NameAvailableResponse) {}
|
||||||
|
rpc GetNameByAddress(NameByAddressRequest) returns (NameByAddressResponse) {}
|
||||||
|
}
|
158
nameservice/nameserviceproto/protos/nameservice_aa.proto
Normal file
158
nameservice/nameserviceproto/protos/nameservice_aa.proto
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
option go_package = "nameservice/nameserviceproto";
|
||||||
|
|
||||||
|
message UserAccount {
|
||||||
|
// An Ethereum address that owns that account
|
||||||
|
string ownerEthAddress = 1;
|
||||||
|
|
||||||
|
// This smart contract really controls all names
|
||||||
|
// you can ask .owner() method to get 'ownerEthAddress'
|
||||||
|
string ownerSmartContracWalletAddress = 2;
|
||||||
|
|
||||||
|
// The ownerSmartContracWalletAddress field is calculated automatically
|
||||||
|
// from ownerEthAddress even if SCW is not deployed yet
|
||||||
|
// SCW is deployed automatically after first operation
|
||||||
|
bool ownerSmartContracWalletDeployed = 3;
|
||||||
|
|
||||||
|
// Number of names that the user can buy. We will mint him tokens that he can use to buy names
|
||||||
|
// (one token per name)
|
||||||
|
uint64 namesCountLeft = 4;
|
||||||
|
|
||||||
|
// Number of gas operations: update name, add new data, etc
|
||||||
|
uint64 operationsCountLeft = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AdminFundUserAccountRequest {
|
||||||
|
// An Ethereum address that owns that name
|
||||||
|
string ownerEthAddress = 1;
|
||||||
|
|
||||||
|
// Number of names that user can buy. We will mint him tokens that he can use to buy names
|
||||||
|
// (one token per name)
|
||||||
|
uint64 namesCount = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AdminFundUserAccountRequestSigned {
|
||||||
|
// AdminFundUserAccountRequest struct
|
||||||
|
bytes payload = 1;
|
||||||
|
|
||||||
|
// payload signed by Admin of this service
|
||||||
|
bytes signature = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AdminFundGasOperationsRequest {
|
||||||
|
// An Ethereum address that owns that name
|
||||||
|
string ownerEthAddress = 1;
|
||||||
|
|
||||||
|
string ownerAnyID = 2;
|
||||||
|
|
||||||
|
// Number of gas operations: update name, add new data, etc
|
||||||
|
uint64 operationsCount = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AdminFundGasOperationsRequestSigned {
|
||||||
|
// AdminFundGasOperationsRequest struct
|
||||||
|
bytes payload = 1;
|
||||||
|
|
||||||
|
// payload signed by Admin of this service
|
||||||
|
bytes signature = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// no signature required here
|
||||||
|
message GetUserAccountRequest {
|
||||||
|
// An Ethereum address that owns that account
|
||||||
|
string ownerEthAddress = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDataNameRegisterResponse {
|
||||||
|
bytes data = 1;
|
||||||
|
|
||||||
|
bytes context = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateUserOperationRequest {
|
||||||
|
bytes data = 1;
|
||||||
|
|
||||||
|
// "data" signed with Ethereum private key
|
||||||
|
bytes signedData = 2;
|
||||||
|
|
||||||
|
bytes context = 3;
|
||||||
|
|
||||||
|
string ownerEthAddress = 4;
|
||||||
|
|
||||||
|
string ownerAnyID = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateUserOperationRequestSigned {
|
||||||
|
// CreateUserOperationRequest struct
|
||||||
|
bytes payload = 1;
|
||||||
|
|
||||||
|
// payload signed with Anytype identity
|
||||||
|
bytes signature = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message NameRegisterRequest {
|
||||||
|
string fullName = 1;
|
||||||
|
|
||||||
|
// A content hash attached to this name
|
||||||
|
string ownerAnyAddress = 2;
|
||||||
|
|
||||||
|
// An Ethereum address that owns that name
|
||||||
|
string ownerEthAddress = 3;
|
||||||
|
|
||||||
|
// A SpaceID attached to this name
|
||||||
|
string spaceId = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetOperationStatusRequest {
|
||||||
|
string operationId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OperationState {
|
||||||
|
Unknown = 0;
|
||||||
|
|
||||||
|
Pending = 1;
|
||||||
|
PendingOrNotFound = 2;
|
||||||
|
Completed = 3;
|
||||||
|
Error = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OperationResponse {
|
||||||
|
string operationId = 1;
|
||||||
|
|
||||||
|
OperationState operationState = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
service AnynsAccountAbstraction {
|
||||||
|
// COMMON METHODS:
|
||||||
|
rpc GetOperation(GetOperationStatusRequest) returns (OperationResponse) {}
|
||||||
|
|
||||||
|
// ADMIN METHODS:
|
||||||
|
// Will send "access tokens" to the user's account (to his SmartContractWallet).
|
||||||
|
// User will be able to use these "access tokens" to register his name later directly.
|
||||||
|
//
|
||||||
|
// Blocking, will send TX to EVM chain
|
||||||
|
// If finished without error -> please use GetUserAccount to get updated info
|
||||||
|
rpc AdminFundUserAccount(AdminFundUserAccountRequestSigned) returns (OperationResponse) {}
|
||||||
|
|
||||||
|
// Each operation is a single blockchain TX like "name update".
|
||||||
|
// User will be able to send operations without having any gas in his wallet later
|
||||||
|
rpc AdminFundGasOperations(AdminFundGasOperationsRequestSigned) returns (OperationResponse) {}
|
||||||
|
|
||||||
|
// USER METHODS:
|
||||||
|
// Use it to:
|
||||||
|
// 1 - get your SmartContractWallet address
|
||||||
|
// 2 - get how many operations you still have
|
||||||
|
rpc GetUserAccount(GetUserAccountRequest) returns (UserAccount) {}
|
||||||
|
|
||||||
|
// Example usage:
|
||||||
|
// 1. get data + context
|
||||||
|
// 2. sign it with your Ethereum private key
|
||||||
|
// 3. send it using CreateUserOperation
|
||||||
|
// 4. check operation status using GetOperation
|
||||||
|
rpc GetDataNameRegister(NameRegisterRequest) returns (GetDataNameRegisterResponse) {}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//rpc GetDataNameUpdate(NameUpdateRequest) returns (GetDataNameRegisterResponse) {}
|
||||||
|
|
||||||
|
rpc CreateUserOperation(CreateUserOperationRequestSigned) returns (OperationResponse) {}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue