grants

package
v0.0.0-...-eec4b17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthService        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowService          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterGrantsServiceServer

func RegisterGrantsServiceServer(s grpc1.Server, srv GrantsServiceServer)

Types

type ChainClient

type ChainClient interface {
	HasGrantedMsgGrantAllowanceAuthorization(appAddress string) (bool, error)

	HasFunds(address string) (bool, error)
	HasFeeGrant(userAddress string, granterAddress string) (bool, error)
}

type Database

type Database interface {
	GetApp(appID string) (*types.Application, bool, error)

	GetAppFeeGrantRequestsLimit(appID string) (uint64, error)
	GetAppFeeGrantRequestsCount(appID string) (uint64, error)

	SaveFeeGrantRequest(request types.FeeGrantRequest) error
	HasFeeGrantBeenGrantedToUser(appID string, user string) (bool, error)

	GetFeeGrantRequest(appID string, requestID string) (*types.FeeGrantRequest, bool, error)
}

type GetFeeAllowanceDetailsRequest

type GetFeeAllowanceDetailsRequest struct {
	// ID represents the ID of the fee allowance request to query
	RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
}

func (*GetFeeAllowanceDetailsRequest) Descriptor

func (*GetFeeAllowanceDetailsRequest) Descriptor() ([]byte, []int)

func (*GetFeeAllowanceDetailsRequest) GetRequestId

func (m *GetFeeAllowanceDetailsRequest) GetRequestId() string

func (*GetFeeAllowanceDetailsRequest) Marshal

func (m *GetFeeAllowanceDetailsRequest) Marshal() (dAtA []byte, err error)

func (*GetFeeAllowanceDetailsRequest) MarshalTo

func (m *GetFeeAllowanceDetailsRequest) MarshalTo(dAtA []byte) (int, error)

func (*GetFeeAllowanceDetailsRequest) MarshalToSizedBuffer

func (m *GetFeeAllowanceDetailsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetFeeAllowanceDetailsRequest) ProtoMessage

func (*GetFeeAllowanceDetailsRequest) ProtoMessage()

func (*GetFeeAllowanceDetailsRequest) Reset

func (m *GetFeeAllowanceDetailsRequest) Reset()

func (*GetFeeAllowanceDetailsRequest) Size

func (m *GetFeeAllowanceDetailsRequest) Size() (n int)

func (*GetFeeAllowanceDetailsRequest) String

func (*GetFeeAllowanceDetailsRequest) Unmarshal

func (m *GetFeeAllowanceDetailsRequest) Unmarshal(dAtA []byte) error

func (*GetFeeAllowanceDetailsRequest) XXX_DiscardUnknown

func (m *GetFeeAllowanceDetailsRequest) XXX_DiscardUnknown()

func (*GetFeeAllowanceDetailsRequest) XXX_Marshal

func (m *GetFeeAllowanceDetailsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetFeeAllowanceDetailsRequest) XXX_Merge

func (m *GetFeeAllowanceDetailsRequest) XXX_Merge(src proto.Message)

func (*GetFeeAllowanceDetailsRequest) XXX_Size

func (m *GetFeeAllowanceDetailsRequest) XXX_Size() int

func (*GetFeeAllowanceDetailsRequest) XXX_Unmarshal

func (m *GetFeeAllowanceDetailsRequest) XXX_Unmarshal(b []byte) error

type GetFeeAllowanceDetailsResponse

type GetFeeAllowanceDetailsResponse struct {
	// UserDesmosAddress represents the Desmos address of the user that
	// already has (or will be) granted the fee allowance
	UserDesmosAddress string `protobuf:"bytes,1,opt,name=user_desmos_address,json=userDesmosAddress,proto3" json:"user_desmos_address,omitempty"`
	// Allowance represents the fee allowance that has been granted to the user
	// with the specified ID
	Allowance *types.Any `protobuf:"bytes,2,opt,name=allowance,proto3" json:"allowance,omitempty"`
	// RequestTime represents the time at which the fee allowance has been
	// requested
	RequestTime time.Time `protobuf:"bytes,3,opt,name=request_time,json=requestTime,proto3,stdtime" json:"request_time"`
	// GrantTime represents the time at which the fee allowance has been granted.
	// If nil, it means that the allowance has not been granted yet
	GrantTime *time.Time `protobuf:"bytes,4,opt,name=grant_time,json=grantTime,proto3,stdtime" json:"grant_time,omitempty"`
}

func (*GetFeeAllowanceDetailsResponse) Descriptor

func (*GetFeeAllowanceDetailsResponse) Descriptor() ([]byte, []int)

func (*GetFeeAllowanceDetailsResponse) GetAllowance

func (m *GetFeeAllowanceDetailsResponse) GetAllowance() *types.Any

func (*GetFeeAllowanceDetailsResponse) GetGrantTime

func (m *GetFeeAllowanceDetailsResponse) GetGrantTime() *time.Time

func (*GetFeeAllowanceDetailsResponse) GetRequestTime

func (m *GetFeeAllowanceDetailsResponse) GetRequestTime() time.Time

func (*GetFeeAllowanceDetailsResponse) GetUserDesmosAddress

func (m *GetFeeAllowanceDetailsResponse) GetUserDesmosAddress() string

func (*GetFeeAllowanceDetailsResponse) Marshal

func (m *GetFeeAllowanceDetailsResponse) Marshal() (dAtA []byte, err error)

func (*GetFeeAllowanceDetailsResponse) MarshalTo

func (m *GetFeeAllowanceDetailsResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetFeeAllowanceDetailsResponse) MarshalToSizedBuffer

func (m *GetFeeAllowanceDetailsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetFeeAllowanceDetailsResponse) ProtoMessage

func (*GetFeeAllowanceDetailsResponse) ProtoMessage()

func (*GetFeeAllowanceDetailsResponse) Reset

func (m *GetFeeAllowanceDetailsResponse) Reset()

func (*GetFeeAllowanceDetailsResponse) Size

func (m *GetFeeAllowanceDetailsResponse) Size() (n int)

func (*GetFeeAllowanceDetailsResponse) String

func (*GetFeeAllowanceDetailsResponse) Unmarshal

func (m *GetFeeAllowanceDetailsResponse) Unmarshal(dAtA []byte) error

func (*GetFeeAllowanceDetailsResponse) XXX_DiscardUnknown

func (m *GetFeeAllowanceDetailsResponse) XXX_DiscardUnknown()

func (*GetFeeAllowanceDetailsResponse) XXX_Marshal

func (m *GetFeeAllowanceDetailsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetFeeAllowanceDetailsResponse) XXX_Merge

func (m *GetFeeAllowanceDetailsResponse) XXX_Merge(src proto.Message)

func (*GetFeeAllowanceDetailsResponse) XXX_Size

func (m *GetFeeAllowanceDetailsResponse) XXX_Size() int

func (*GetFeeAllowanceDetailsResponse) XXX_Unmarshal

func (m *GetFeeAllowanceDetailsResponse) XXX_Unmarshal(b []byte) error

type GrantsServiceClient

type GrantsServiceClient interface {
	// RequestFeeAllowance allows to request a new fee allowance for a given user
	RequestFeeAllowance(ctx context.Context, in *RequestFeeAllowanceRequest, opts ...grpc.CallOption) (*RequestFeeAllowanceResponse, error)
	// GetFeeAllowanceDetails allows to get the details of a fee allowance request
	GetFeeAllowanceDetails(ctx context.Context, in *GetFeeAllowanceDetailsRequest, opts ...grpc.CallOption) (*GetFeeAllowanceDetailsResponse, error)
}

GrantsServiceClient is the client API for GrantsService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewGrantsServiceClient

func NewGrantsServiceClient(cc grpc1.ClientConn) GrantsServiceClient

type GrantsServiceServer

type GrantsServiceServer interface {
	// RequestFeeAllowance allows to request a new fee allowance for a given user
	RequestFeeAllowance(context.Context, *RequestFeeAllowanceRequest) (*RequestFeeAllowanceResponse, error)
	// GetFeeAllowanceDetails allows to get the details of a fee allowance request
	GetFeeAllowanceDetails(context.Context, *GetFeeAllowanceDetailsRequest) (*GetFeeAllowanceDetailsResponse, error)
}

GrantsServiceServer is the server API for GrantsService service.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(client ChainClient, cdc codec.Codec, db Database) *Handler

NewHandler returns a new Handler instance

func (*Handler) HandleFeeGrantRequest

func (h *Handler) HandleFeeGrantRequest(req *RequestFeeGrantRequest) (*RequestFeeAllowanceResponse, error)

HandleFeeGrantRequest handles the request of a fee grant from the user having the given token

func (*Handler) HandleRequestFeeGrantDetailsRequest

func (h *Handler) HandleRequestFeeGrantDetailsRequest(req *RequestFeeGrantDetailsRequest) (*GetFeeAllowanceDetailsResponse, error)

type RequestFeeAllowanceRequest

type RequestFeeAllowanceRequest struct {
	// UserDesmosAddress represents the Desmos address of the user that
	// should be granted the fee allowance
	UserDesmosAddress string `protobuf:"bytes,1,opt,name=user_desmos_address,json=userDesmosAddress,proto3" json:"user_desmos_address,omitempty"`
	// Allowance represents the fee allowance that will be granted to the user.
	// IT can be any allowance type that implements AllowanceI
	Allowance *types.Any `protobuf:"bytes,2,opt,name=allowance,proto3" json:"allowance,omitempty"`
}

func (*RequestFeeAllowanceRequest) Descriptor

func (*RequestFeeAllowanceRequest) Descriptor() ([]byte, []int)

func (*RequestFeeAllowanceRequest) GetAllowance

func (m *RequestFeeAllowanceRequest) GetAllowance() *types.Any

func (*RequestFeeAllowanceRequest) GetUserDesmosAddress

func (m *RequestFeeAllowanceRequest) GetUserDesmosAddress() string

func (*RequestFeeAllowanceRequest) Marshal

func (m *RequestFeeAllowanceRequest) Marshal() (dAtA []byte, err error)

func (*RequestFeeAllowanceRequest) MarshalTo

func (m *RequestFeeAllowanceRequest) MarshalTo(dAtA []byte) (int, error)

func (*RequestFeeAllowanceRequest) MarshalToSizedBuffer

func (m *RequestFeeAllowanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RequestFeeAllowanceRequest) ProtoMessage

func (*RequestFeeAllowanceRequest) ProtoMessage()

func (*RequestFeeAllowanceRequest) Reset

func (m *RequestFeeAllowanceRequest) Reset()

func (*RequestFeeAllowanceRequest) Size

func (m *RequestFeeAllowanceRequest) Size() (n int)

func (*RequestFeeAllowanceRequest) String

func (m *RequestFeeAllowanceRequest) String() string

func (*RequestFeeAllowanceRequest) Unmarshal

func (m *RequestFeeAllowanceRequest) Unmarshal(dAtA []byte) error

func (*RequestFeeAllowanceRequest) XXX_DiscardUnknown

func (m *RequestFeeAllowanceRequest) XXX_DiscardUnknown()

func (*RequestFeeAllowanceRequest) XXX_Marshal

func (m *RequestFeeAllowanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RequestFeeAllowanceRequest) XXX_Merge

func (m *RequestFeeAllowanceRequest) XXX_Merge(src proto.Message)

func (*RequestFeeAllowanceRequest) XXX_Size

func (m *RequestFeeAllowanceRequest) XXX_Size() int

func (*RequestFeeAllowanceRequest) XXX_Unmarshal

func (m *RequestFeeAllowanceRequest) XXX_Unmarshal(b []byte) error

type RequestFeeAllowanceResponse

type RequestFeeAllowanceResponse struct {
	// ID represents the ID of the fee allowance request
	RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
}

func (*RequestFeeAllowanceResponse) Descriptor

func (*RequestFeeAllowanceResponse) Descriptor() ([]byte, []int)

func (*RequestFeeAllowanceResponse) GetRequestId

func (m *RequestFeeAllowanceResponse) GetRequestId() string

func (*RequestFeeAllowanceResponse) Marshal

func (m *RequestFeeAllowanceResponse) Marshal() (dAtA []byte, err error)

func (*RequestFeeAllowanceResponse) MarshalTo

func (m *RequestFeeAllowanceResponse) MarshalTo(dAtA []byte) (int, error)

func (*RequestFeeAllowanceResponse) MarshalToSizedBuffer

func (m *RequestFeeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RequestFeeAllowanceResponse) ProtoMessage

func (*RequestFeeAllowanceResponse) ProtoMessage()

func (*RequestFeeAllowanceResponse) Reset

func (m *RequestFeeAllowanceResponse) Reset()

func (*RequestFeeAllowanceResponse) Size

func (m *RequestFeeAllowanceResponse) Size() (n int)

func (*RequestFeeAllowanceResponse) String

func (m *RequestFeeAllowanceResponse) String() string

func (*RequestFeeAllowanceResponse) Unmarshal

func (m *RequestFeeAllowanceResponse) Unmarshal(dAtA []byte) error

func (*RequestFeeAllowanceResponse) XXX_DiscardUnknown

func (m *RequestFeeAllowanceResponse) XXX_DiscardUnknown()

func (*RequestFeeAllowanceResponse) XXX_Marshal

func (m *RequestFeeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RequestFeeAllowanceResponse) XXX_Merge

func (m *RequestFeeAllowanceResponse) XXX_Merge(src proto.Message)

func (*RequestFeeAllowanceResponse) XXX_Size

func (m *RequestFeeAllowanceResponse) XXX_Size() int

func (*RequestFeeAllowanceResponse) XXX_Unmarshal

func (m *RequestFeeAllowanceResponse) XXX_Unmarshal(b []byte) error

type RequestFeeGrantDetailsRequest

type RequestFeeGrantDetailsRequest struct {
	// AppID represents the ID of the application that is requesting the fee grant details
	AppID string

	// FeeGrantAllowanceRequestID represents the id of the fee grant request for which to get the details
	FeeGrantAllowanceRequestID string
}

func NewRequestFeeGrantDetailsRequest

func NewRequestFeeGrantDetailsRequest(appID string, feeGrantAllowanceRequestID string) *RequestFeeGrantDetailsRequest

type RequestFeeGrantRequest

type RequestFeeGrantRequest struct {
	// AppID represents the ID of the application that is requesting the fee grant
	AppID string

	// DesmosAddress is the address of the user requesting the fee grant
	DesmosAddress string

	// Allowance represents the allowance to be granted to the user
	Allowance *codectypes.Any
}

func NewRequestFeeGrantRequest

func NewRequestFeeGrantRequest(appID string, desmosAddress string, allowance *codectypes.Any) *RequestFeeGrantRequest

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(handler *Handler) *Server

func NewServerFromEnvVariables

func NewServerFromEnvVariables(chainClient ChainClient, cdc codec.Codec, db Database) *Server

func (*Server) GetFeeAllowanceDetails

func (s *Server) GetFeeAllowanceDetails(ctx context.Context, request *GetFeeAllowanceDetailsRequest) (*GetFeeAllowanceDetailsResponse, error)

GetFeeAllowanceDetails implements GrantsServiceServer

func (*Server) RequestFeeAllowance

func (s *Server) RequestFeeAllowance(ctx context.Context, request *RequestFeeAllowanceRequest) (*RequestFeeAllowanceResponse, error)

RequestFeeAllowance implements GrantsServiceServer

type UnimplementedGrantsServiceServer

type UnimplementedGrantsServiceServer struct {
}

UnimplementedGrantsServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedGrantsServiceServer) GetFeeAllowanceDetails

func (*UnimplementedGrantsServiceServer) RequestFeeAllowance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL