[wip] nitro bank, server

go mod update for nitro

[wip] nitro.Service

[wip] run protocgen

[wip] nitrobank account
This commit is contained in:
Roy Crihfield 2024-12-02 13:01:29 +08:00
parent 92ae93ef45
commit 4003a44d20
33 changed files with 2442 additions and 147 deletions

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/auction/v1/query.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Params_FullMethodName = "/cerc.auction.v1.Query/Params"
@ -32,6 +32,8 @@ const (
// QueryClient is the client API for Query service.
//
// 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.
//
// Query defines the gRPC querier interface for the auction module
type QueryClient interface {
// Params queries auction module params
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
@ -60,8 +62,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -69,8 +72,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
}
func (c *queryClient) Auctions(ctx context.Context, in *QueryAuctionsRequest, opts ...grpc.CallOption) (*QueryAuctionsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuctionsResponse)
err := c.cc.Invoke(ctx, Query_Auctions_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Auctions_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -78,8 +82,9 @@ func (c *queryClient) Auctions(ctx context.Context, in *QueryAuctionsRequest, op
}
func (c *queryClient) GetAuction(ctx context.Context, in *QueryGetAuctionRequest, opts ...grpc.CallOption) (*QueryGetAuctionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetAuctionResponse)
err := c.cc.Invoke(ctx, Query_GetAuction_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetAuction_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -87,8 +92,9 @@ func (c *queryClient) GetAuction(ctx context.Context, in *QueryGetAuctionRequest
}
func (c *queryClient) GetBid(ctx context.Context, in *QueryGetBidRequest, opts ...grpc.CallOption) (*QueryGetBidResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBidResponse)
err := c.cc.Invoke(ctx, Query_GetBid_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBid_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -96,8 +102,9 @@ func (c *queryClient) GetBid(ctx context.Context, in *QueryGetBidRequest, opts .
}
func (c *queryClient) GetBids(ctx context.Context, in *QueryGetBidsRequest, opts ...grpc.CallOption) (*QueryGetBidsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBidsResponse)
err := c.cc.Invoke(ctx, Query_GetBids_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBids_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -105,8 +112,9 @@ func (c *queryClient) GetBids(ctx context.Context, in *QueryGetBidsRequest, opts
}
func (c *queryClient) AuctionsByBidder(ctx context.Context, in *QueryAuctionsByBidderRequest, opts ...grpc.CallOption) (*QueryAuctionsByBidderResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuctionsByBidderResponse)
err := c.cc.Invoke(ctx, Query_AuctionsByBidder_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_AuctionsByBidder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -114,8 +122,9 @@ func (c *queryClient) AuctionsByBidder(ctx context.Context, in *QueryAuctionsByB
}
func (c *queryClient) AuctionsByOwner(ctx context.Context, in *QueryAuctionsByOwnerRequest, opts ...grpc.CallOption) (*QueryAuctionsByOwnerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuctionsByOwnerResponse)
err := c.cc.Invoke(ctx, Query_AuctionsByOwner_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_AuctionsByOwner_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -123,8 +132,9 @@ func (c *queryClient) AuctionsByOwner(ctx context.Context, in *QueryAuctionsByOw
}
func (c *queryClient) GetAuctionModuleBalance(ctx context.Context, in *QueryGetAuctionModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetAuctionModuleBalanceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetAuctionModuleBalanceResponse)
err := c.cc.Invoke(ctx, Query_GetAuctionModuleBalance_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetAuctionModuleBalance_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -133,7 +143,9 @@ func (c *queryClient) GetAuctionModuleBalance(ctx context.Context, in *QueryGetA
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
// for forward compatibility.
//
// Query defines the gRPC querier interface for the auction module
type QueryServer interface {
// Params queries auction module params
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
@ -154,9 +166,12 @@ type QueryServer interface {
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
@ -183,6 +198,7 @@ func (UnimplementedQueryServer) GetAuctionModuleBalance(context.Context, *QueryG
return nil, status.Errorf(codes.Unimplemented, "method GetAuctionModuleBalance not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@ -192,6 +208,13 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/auction/v1/tx.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_CreateAuction_FullMethodName = "/cerc.auction.v1.Msg/CreateAuction"
@ -29,6 +29,8 @@ const (
// MsgClient is the client API for Msg service.
//
// 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.
//
// Tx defines the gRPC tx interface
type MsgClient interface {
// CreateAuction is the command for creating an auction
CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error)
@ -52,8 +54,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCreateAuctionResponse)
err := c.cc.Invoke(ctx, Msg_CreateAuction_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CreateAuction_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -61,8 +64,9 @@ func (c *msgClient) CreateAuction(ctx context.Context, in *MsgCreateAuction, opt
}
func (c *msgClient) CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCommitBidResponse)
err := c.cc.Invoke(ctx, Msg_CommitBid_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CommitBid_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -70,8 +74,9 @@ func (c *msgClient) CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grp
}
func (c *msgClient) RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRevealBidResponse)
err := c.cc.Invoke(ctx, Msg_RevealBid_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_RevealBid_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -79,8 +84,9 @@ func (c *msgClient) RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grp
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -88,8 +94,9 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
}
func (c *msgClient) ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts ...grpc.CallOption) (*MsgReleaseFundsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgReleaseFundsResponse)
err := c.cc.Invoke(ctx, Msg_ReleaseFunds_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_ReleaseFunds_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -98,7 +105,9 @@ func (c *msgClient) ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
// for forward compatibility.
//
// Tx defines the gRPC tx interface
type MsgServer interface {
// CreateAuction is the command for creating an auction
CreateAuction(context.Context, *MsgCreateAuction) (*MsgCreateAuctionResponse, error)
@ -114,9 +123,12 @@ type MsgServer interface {
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) CreateAuction(context.Context, *MsgCreateAuction) (*MsgCreateAuctionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateAuction not implemented")
@ -134,6 +146,7 @@ func (UnimplementedMsgServer) ReleaseFunds(context.Context, *MsgReleaseFunds) (*
return nil, status.Errorf(codes.Unimplemented, "method ReleaseFunds not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@ -143,6 +156,13 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/bond/v1/query.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Params_FullMethodName = "/cerc.bond.v1.Query/Params"
@ -29,6 +29,8 @@ const (
// QueryClient is the client API for Query service.
//
// 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.
//
// Query defines the gRPC querier service for bond module
type QueryClient interface {
// Params queries bonds module params.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
@ -51,8 +53,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -60,8 +63,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
}
func (c *queryClient) Bonds(ctx context.Context, in *QueryBondsRequest, opts ...grpc.CallOption) (*QueryBondsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryBondsResponse)
err := c.cc.Invoke(ctx, Query_Bonds_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Bonds_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -69,8 +73,9 @@ func (c *queryClient) Bonds(ctx context.Context, in *QueryBondsRequest, opts ...
}
func (c *queryClient) GetBondById(ctx context.Context, in *QueryGetBondByIdRequest, opts ...grpc.CallOption) (*QueryGetBondByIdResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBondByIdResponse)
err := c.cc.Invoke(ctx, Query_GetBondById_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBondById_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -78,8 +83,9 @@ func (c *queryClient) GetBondById(ctx context.Context, in *QueryGetBondByIdReque
}
func (c *queryClient) GetBondsByOwner(ctx context.Context, in *QueryGetBondsByOwnerRequest, opts ...grpc.CallOption) (*QueryGetBondsByOwnerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBondsByOwnerResponse)
err := c.cc.Invoke(ctx, Query_GetBondsByOwner_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBondsByOwner_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -87,8 +93,9 @@ func (c *queryClient) GetBondsByOwner(ctx context.Context, in *QueryGetBondsByOw
}
func (c *queryClient) GetBondModuleBalance(ctx context.Context, in *QueryGetBondModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetBondModuleBalanceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBondModuleBalanceResponse)
err := c.cc.Invoke(ctx, Query_GetBondModuleBalance_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBondModuleBalance_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -97,7 +104,9 @@ func (c *queryClient) GetBondModuleBalance(ctx context.Context, in *QueryGetBond
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
// for forward compatibility.
//
// Query defines the gRPC querier service for bond module
type QueryServer interface {
// Params queries bonds module params.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
@ -112,9 +121,12 @@ type QueryServer interface {
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
@ -132,6 +144,7 @@ func (UnimplementedQueryServer) GetBondModuleBalance(context.Context, *QueryGetB
return nil, status.Errorf(codes.Unimplemented, "method GetBondModuleBalance not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@ -141,6 +154,13 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/bond/v1/tx.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_CreateBond_FullMethodName = "/cerc.bond.v1.Msg/CreateBond"
@ -29,6 +29,8 @@ const (
// MsgClient is the client API for Msg service.
//
// 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.
//
// Msg defines the bond Msg service.
type MsgClient interface {
// CreateBond defines a method for creating a new bond.
CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error)
@ -52,8 +54,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCreateBondResponse)
err := c.cc.Invoke(ctx, Msg_CreateBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CreateBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -61,8 +64,9 @@ func (c *msgClient) CreateBond(ctx context.Context, in *MsgCreateBond, opts ...g
}
func (c *msgClient) RefillBond(ctx context.Context, in *MsgRefillBond, opts ...grpc.CallOption) (*MsgRefillBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRefillBondResponse)
err := c.cc.Invoke(ctx, Msg_RefillBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_RefillBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -70,8 +74,9 @@ func (c *msgClient) RefillBond(ctx context.Context, in *MsgRefillBond, opts ...g
}
func (c *msgClient) WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgWithdrawBondResponse)
err := c.cc.Invoke(ctx, Msg_WithdrawBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_WithdrawBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -79,8 +84,9 @@ func (c *msgClient) WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts
}
func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCancelBondResponse)
err := c.cc.Invoke(ctx, Msg_CancelBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CancelBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -88,8 +94,9 @@ func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...g
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -98,7 +105,9 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
// for forward compatibility.
//
// Msg defines the bond Msg service.
type MsgServer interface {
// CreateBond defines a method for creating a new bond.
CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error)
@ -114,9 +123,12 @@ type MsgServer interface {
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateBond not implemented")
@ -134,6 +146,7 @@ func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@ -143,6 +156,13 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/onboarding/v1/query.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Participants_FullMethodName = "/cerc.onboarding.v1.Query/Participants"
@ -27,6 +27,8 @@ const (
// QueryClient is the client API for Query service.
//
// 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.
//
// Query defines the gRPC querier service for onboarding module
type QueryClient interface {
// Participants queries Participants list
Participants(ctx context.Context, in *QueryParticipantsRequest, opts ...grpc.CallOption) (*QueryParticipantsResponse, error)
@ -45,8 +47,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Participants(ctx context.Context, in *QueryParticipantsRequest, opts ...grpc.CallOption) (*QueryParticipantsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParticipantsResponse)
err := c.cc.Invoke(ctx, Query_Participants_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Participants_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -54,8 +57,9 @@ func (c *queryClient) Participants(ctx context.Context, in *QueryParticipantsReq
}
func (c *queryClient) GetParticipantByAddress(ctx context.Context, in *QueryGetParticipantByAddressRequest, opts ...grpc.CallOption) (*QueryGetParticipantByAddressResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetParticipantByAddressResponse)
err := c.cc.Invoke(ctx, Query_GetParticipantByAddress_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetParticipantByAddress_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -63,8 +67,9 @@ func (c *queryClient) GetParticipantByAddress(ctx context.Context, in *QueryGetP
}
func (c *queryClient) GetParticipantByNitroAddress(ctx context.Context, in *QueryGetParticipantByNitroAddressRequest, opts ...grpc.CallOption) (*QueryGetParticipantByNitroAddressResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetParticipantByNitroAddressResponse)
err := c.cc.Invoke(ctx, Query_GetParticipantByNitroAddress_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetParticipantByNitroAddress_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -73,7 +78,9 @@ func (c *queryClient) GetParticipantByNitroAddress(ctx context.Context, in *Quer
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
// for forward compatibility.
//
// Query defines the gRPC querier service for onboarding module
type QueryServer interface {
// Participants queries Participants list
Participants(context.Context, *QueryParticipantsRequest) (*QueryParticipantsResponse, error)
@ -84,9 +91,12 @@ type QueryServer interface {
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Participants(context.Context, *QueryParticipantsRequest) (*QueryParticipantsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Participants not implemented")
@ -98,6 +108,7 @@ func (UnimplementedQueryServer) GetParticipantByNitroAddress(context.Context, *Q
return nil, status.Errorf(codes.Unimplemented, "method GetParticipantByNitroAddress not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@ -107,6 +118,13 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/onboarding/v1/tx.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_OnboardParticipant_FullMethodName = "/cerc.onboarding.v1.Msg/OnboardParticipant"
@ -25,6 +25,8 @@ const (
// MsgClient is the client API for Msg service.
//
// 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.
//
// Msg defines the onboarding Msg service.
type MsgClient interface {
// OnboardParticipant defines a method for enrolling a new validator.
OnboardParticipant(ctx context.Context, in *MsgOnboardParticipant, opts ...grpc.CallOption) (*MsgOnboardParticipantResponse, error)
@ -39,8 +41,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) OnboardParticipant(ctx context.Context, in *MsgOnboardParticipant, opts ...grpc.CallOption) (*MsgOnboardParticipantResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgOnboardParticipantResponse)
err := c.cc.Invoke(ctx, Msg_OnboardParticipant_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_OnboardParticipant_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -49,21 +52,27 @@ func (c *msgClient) OnboardParticipant(ctx context.Context, in *MsgOnboardPartic
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
// for forward compatibility.
//
// Msg defines the onboarding Msg service.
type MsgServer interface {
// OnboardParticipant defines a method for enrolling a new validator.
OnboardParticipant(context.Context, *MsgOnboardParticipant) (*MsgOnboardParticipantResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) OnboardParticipant(context.Context, *MsgOnboardParticipant) (*MsgOnboardParticipantResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnboardParticipant not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@ -73,6 +82,13 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/registry/v1/query.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Params_FullMethodName = "/cerc.registry.v1.Query/Params"
@ -34,6 +34,8 @@ const (
// QueryClient is the client API for Query service.
//
// 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.
//
// Query defines the gRPC querier service for registry module
type QueryClient interface {
// Params queries the registry module params.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
@ -66,8 +68,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -75,8 +78,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
}
func (c *queryClient) Records(ctx context.Context, in *QueryRecordsRequest, opts ...grpc.CallOption) (*QueryRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryRecordsResponse)
err := c.cc.Invoke(ctx, Query_Records_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Records_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -84,8 +88,9 @@ func (c *queryClient) Records(ctx context.Context, in *QueryRecordsRequest, opts
}
func (c *queryClient) GetRecord(ctx context.Context, in *QueryGetRecordRequest, opts ...grpc.CallOption) (*QueryGetRecordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetRecordResponse)
err := c.cc.Invoke(ctx, Query_GetRecord_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -93,8 +98,9 @@ func (c *queryClient) GetRecord(ctx context.Context, in *QueryGetRecordRequest,
}
func (c *queryClient) GetRecordsByBondId(ctx context.Context, in *QueryGetRecordsByBondIdRequest, opts ...grpc.CallOption) (*QueryGetRecordsByBondIdResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetRecordsByBondIdResponse)
err := c.cc.Invoke(ctx, Query_GetRecordsByBondId_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetRecordsByBondId_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -102,8 +108,9 @@ func (c *queryClient) GetRecordsByBondId(ctx context.Context, in *QueryGetRecord
}
func (c *queryClient) NameRecords(ctx context.Context, in *QueryNameRecordsRequest, opts ...grpc.CallOption) (*QueryNameRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryNameRecordsResponse)
err := c.cc.Invoke(ctx, Query_NameRecords_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_NameRecords_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -111,8 +118,9 @@ func (c *queryClient) NameRecords(ctx context.Context, in *QueryNameRecordsReque
}
func (c *queryClient) Whois(ctx context.Context, in *QueryWhoisRequest, opts ...grpc.CallOption) (*QueryWhoisResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryWhoisResponse)
err := c.cc.Invoke(ctx, Query_Whois_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Whois_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -120,8 +128,9 @@ func (c *queryClient) Whois(ctx context.Context, in *QueryWhoisRequest, opts ...
}
func (c *queryClient) LookupLrn(ctx context.Context, in *QueryLookupLrnRequest, opts ...grpc.CallOption) (*QueryLookupLrnResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryLookupLrnResponse)
err := c.cc.Invoke(ctx, Query_LookupLrn_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_LookupLrn_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -129,8 +138,9 @@ func (c *queryClient) LookupLrn(ctx context.Context, in *QueryLookupLrnRequest,
}
func (c *queryClient) ResolveLrn(ctx context.Context, in *QueryResolveLrnRequest, opts ...grpc.CallOption) (*QueryResolveLrnResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryResolveLrnResponse)
err := c.cc.Invoke(ctx, Query_ResolveLrn_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_ResolveLrn_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -138,8 +148,9 @@ func (c *queryClient) ResolveLrn(ctx context.Context, in *QueryResolveLrnRequest
}
func (c *queryClient) GetRegistryModuleBalance(ctx context.Context, in *QueryGetRegistryModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetRegistryModuleBalanceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetRegistryModuleBalanceResponse)
err := c.cc.Invoke(ctx, Query_GetRegistryModuleBalance_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetRegistryModuleBalance_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -147,8 +158,9 @@ func (c *queryClient) GetRegistryModuleBalance(ctx context.Context, in *QueryGet
}
func (c *queryClient) Authorities(ctx context.Context, in *QueryAuthoritiesRequest, opts ...grpc.CallOption) (*QueryAuthoritiesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuthoritiesResponse)
err := c.cc.Invoke(ctx, Query_Authorities_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Authorities_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -157,7 +169,9 @@ func (c *queryClient) Authorities(ctx context.Context, in *QueryAuthoritiesReque
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
// for forward compatibility.
//
// Query defines the gRPC querier service for registry module
type QueryServer interface {
// Params queries the registry module params.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
@ -182,9 +196,12 @@ type QueryServer interface {
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
@ -217,6 +234,7 @@ func (UnimplementedQueryServer) Authorities(context.Context, *QueryAuthoritiesRe
return nil, status.Errorf(codes.Unimplemented, "method Authorities not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@ -226,6 +244,13 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/registry/v1/tx.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_SetRecord_FullMethodName = "/cerc.registry.v1.Msg/SetRecord"
@ -35,6 +35,8 @@ const (
// MsgClient is the client API for Msg service.
//
// 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.
//
// Msg is a service which exposes the registry functionality
type MsgClient interface {
// SetRecord records a new record with given payload and bond id
SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grpc.CallOption) (*MsgSetRecordResponse, error)
@ -70,8 +72,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grpc.CallOption) (*MsgSetRecordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgSetRecordResponse)
err := c.cc.Invoke(ctx, Msg_SetRecord_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_SetRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -79,8 +82,9 @@ func (c *msgClient) SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grp
}
func (c *msgClient) RenewRecord(ctx context.Context, in *MsgRenewRecord, opts ...grpc.CallOption) (*MsgRenewRecordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRenewRecordResponse)
err := c.cc.Invoke(ctx, Msg_RenewRecord_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_RenewRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -88,8 +92,9 @@ func (c *msgClient) RenewRecord(ctx context.Context, in *MsgRenewRecord, opts ..
}
func (c *msgClient) AssociateBond(ctx context.Context, in *MsgAssociateBond, opts ...grpc.CallOption) (*MsgAssociateBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgAssociateBondResponse)
err := c.cc.Invoke(ctx, Msg_AssociateBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_AssociateBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -97,8 +102,9 @@ func (c *msgClient) AssociateBond(ctx context.Context, in *MsgAssociateBond, opt
}
func (c *msgClient) DissociateBond(ctx context.Context, in *MsgDissociateBond, opts ...grpc.CallOption) (*MsgDissociateBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgDissociateBondResponse)
err := c.cc.Invoke(ctx, Msg_DissociateBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_DissociateBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -106,8 +112,9 @@ func (c *msgClient) DissociateBond(ctx context.Context, in *MsgDissociateBond, o
}
func (c *msgClient) DissociateRecords(ctx context.Context, in *MsgDissociateRecords, opts ...grpc.CallOption) (*MsgDissociateRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgDissociateRecordsResponse)
err := c.cc.Invoke(ctx, Msg_DissociateRecords_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_DissociateRecords_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -115,8 +122,9 @@ func (c *msgClient) DissociateRecords(ctx context.Context, in *MsgDissociateReco
}
func (c *msgClient) ReassociateRecords(ctx context.Context, in *MsgReassociateRecords, opts ...grpc.CallOption) (*MsgReassociateRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgReassociateRecordsResponse)
err := c.cc.Invoke(ctx, Msg_ReassociateRecords_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_ReassociateRecords_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -124,8 +132,9 @@ func (c *msgClient) ReassociateRecords(ctx context.Context, in *MsgReassociateRe
}
func (c *msgClient) SetName(ctx context.Context, in *MsgSetName, opts ...grpc.CallOption) (*MsgSetNameResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgSetNameResponse)
err := c.cc.Invoke(ctx, Msg_SetName_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_SetName_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -133,8 +142,9 @@ func (c *msgClient) SetName(ctx context.Context, in *MsgSetName, opts ...grpc.Ca
}
func (c *msgClient) DeleteName(ctx context.Context, in *MsgDeleteName, opts ...grpc.CallOption) (*MsgDeleteNameResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgDeleteNameResponse)
err := c.cc.Invoke(ctx, Msg_DeleteName_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_DeleteName_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -142,8 +152,9 @@ func (c *msgClient) DeleteName(ctx context.Context, in *MsgDeleteName, opts ...g
}
func (c *msgClient) ReserveAuthority(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgReserveAuthorityResponse)
err := c.cc.Invoke(ctx, Msg_ReserveAuthority_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_ReserveAuthority_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -151,8 +162,9 @@ func (c *msgClient) ReserveAuthority(ctx context.Context, in *MsgReserveAuthorit
}
func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBond, opts ...grpc.CallOption) (*MsgSetAuthorityBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgSetAuthorityBondResponse)
err := c.cc.Invoke(ctx, Msg_SetAuthorityBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_SetAuthorityBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -160,8 +172,9 @@ func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBon
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -170,7 +183,9 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
// for forward compatibility.
//
// Msg is a service which exposes the registry functionality
type MsgServer interface {
// SetRecord records a new record with given payload and bond id
SetRecord(context.Context, *MsgSetRecord) (*MsgSetRecordResponse, error)
@ -198,9 +213,12 @@ type MsgServer interface {
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) SetRecord(context.Context, *MsgSetRecord) (*MsgSetRecordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetRecord not implemented")
@ -236,6 +254,7 @@ func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@ -245,6 +264,13 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}

View File

@ -17,6 +17,7 @@ import (
"cosmossdk.io/server/v2/cometbft"
serverstore "cosmossdk.io/server/v2/store"
confixcmd "cosmossdk.io/tools/confix/cmd"
// "cosmossdk.io/x/accounts"
// "cosmossdk.io/x/accounts"
@ -33,6 +34,8 @@ import (
genutilv2cli "github.com/cosmos/cosmos-sdk/x/genutil/v2/cli"
"git.vdb.to/cerc-io/laconicd/app"
"git.vdb.to/cerc-io/laconicd/nitro"
// "git.vdb.to/cerc-io/laconicd/x/nitrobank"
)
// CommandDependencies is a struct that contains all the dependencies needed to initialize the root command.
@ -86,6 +89,7 @@ func InitRootCmd[T app.Tx](
&serverstore.Server[T]{},
&telemetry.Server[T]{},
&rest.Server[T]{},
&nitro.Server{},
)
}
@ -141,6 +145,13 @@ func InitRootCmd[T app.Tx](
return nil, err
}
// nitrobank := deps.ModuleManager.Modules()[nitrobank.ModuleName].(nitrobank.AppModule)
// accounts := deps.ModuleManager.Modules()[accounts.ModuleName]
nitroServer, err := nitro.New(logger, deps.GlobalConfig)
if err != nil {
return nil, err
}
// wire server commands
return serverv2.AddCommands[T](
rootCmd,
@ -153,6 +164,7 @@ func InitRootCmd[T app.Tx](
storeComponent,
telemetryServer,
restServer,
nitroServer,
)
}

171
go.mod
View File

@ -3,6 +3,9 @@ module git.vdb.to/cerc-io/laconicd
go 1.23.3
replace (
// Remove fjl/memsize as a dependency: https://github.com/ethereum/go-ethereum/pull/30253
// github.com/ethereum/go-ethereum => ../go-ethereum
github.com/ethereum/go-ethereum => github.com/ethereum/go-ethereum v1.14.6-0.20240802044403-e4675771eda5
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
@ -27,7 +30,6 @@ require (
cosmossdk.io/tools/confix v0.1.0
github.com/99designs/gqlgen v0.17.22
github.com/cometbft/cometbft v1.0.0-rc2.0.20241127125717-4ce33b646ac9
github.com/cosmos/cosmos-db v1.1.0 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v1.0.0
github.com/cosmos/go-bip39 v1.0.0
@ -44,13 +46,12 @@ require (
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/statechannels/go-nitro v0.1.2
github.com/statechannels/go-nitro v0.2.0
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.14.4
github.com/tidwall/sjson v1.2.5
github.com/vektah/gqlparser/v2 v2.5.11
go.uber.org/mock v0.5.0
golang.org/x/sync v0.9.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/grpc v1.68.0
google.golang.org/protobuf v1.35.2
@ -58,7 +59,7 @@ require (
)
require (
cosmossdk.io/systemtests v1.0.0-rc.1.0.20241128092904-215d5c16f64d
cosmossdk.io/systemtests v0.0.0-00010101000000-000000000000
cosmossdk.io/x/accounts v1.0.0-alpha.4
cosmossdk.io/x/accounts/defaults/base v0.0.0-00010101000000-000000000000
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91
@ -87,11 +88,14 @@ require (
github.com/DataDog/datadog-go v4.8.3+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.2.0 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/bytedance/sonic v1.12.4 // indirect
@ -108,87 +112,173 @@ require (
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v1.0.1 // indirect
github.com/cometbft/cometbft/api v1.0.0-rc2 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.1.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.3.1 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/creachadair/atomicfile v0.3.5 // indirect
github.com/creachadair/tomledit v0.0.26 // indirect
github.com/danieljoos/wincred v1.2.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/dgraph-io/badger/v4 v4.4.0 // indirect
github.com/dgraph-io/ristretto/v2 v2.0.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/pprof v0.0.0-20241017200806-017d972448fc // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.2 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.3.1 // indirect
github.com/huandu/skiplist v1.2.1 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/boxo v0.10.0 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.2.0 // indirect
github.com/libp2p/go-libp2p v0.37.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.4.1 // indirect
github.com/libp2p/go-libp2p-kad-dht v0.24.2 // indirect
github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
github.com/libp2p/go-msgio v0.3.0 // indirect
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/libp2p/go-reuseport v0.4.0 // indirect
github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
github.com/linxGnu/grocksdb v1.9.3 // indirect
github.com/lmittmann/tint v1.0.2 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mdp/qrterminal/v3 v3.2.0 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/highwayhash v1.0.3 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.13.0 // indirect
github.com/multiformats/go-multiaddr-dns v0.4.0 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onsi/ginkgo/v2 v2.20.2 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
github.com/pion/datachannel v1.5.9 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/ice/v2 v2.3.36 // indirect
github.com/pion/interceptor v0.1.37 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/mdns v0.0.12 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.14 // indirect
github.com/pion/rtp v1.8.9 // indirect
github.com/pion/sctp v1.8.33 // indirect
github.com/pion/sdp/v3 v3.0.9 // indirect
github.com/pion/srtp/v2 v2.0.20 // indirect
github.com/pion/stun v0.6.1 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/turn/v2 v2.1.6 // indirect
github.com/pion/webrtc/v3 v3.3.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
@ -196,63 +286,95 @@ require (
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.60.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.48.1 // indirect
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/tidwall/buntdb v1.2.10 // indirect
github.com/tidwall/grect v0.1.4 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/rtred v0.1.2 // indirect
github.com/tidwall/tinyqueue v0.1.1 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/urfave/cli/v2 v2.25.7 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/dig v1.18.0 // indirect
go.uber.org/fx v1.23.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.12.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.27.0 // indirect
gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
lukechampine.com/blake3 v1.3.0 // indirect
pgregory.net/rapid v1.1.0 // indirect
rsc.io/qr v0.2.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
replace github.com/statechannels/go-nitro v0.1.2 => github.com/cerc-io/go-nitro v0.1.3-ts-port-0.1.10
// github.com/statechannels/go-nitro v0.1.2 => github.com/cerc-io/go-nitro v0.1.3-ts-port-0.1.10
replace github.com/statechannels/go-nitro => ../go-nitro
// replace (
// cosmossdk.io/core v0.7.6 => github.com/roysc/cosmos-sdk/core v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/api v0.7.6 => github.com/roysc/cosmos-sdk/api v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/client/v2 => github.com/roysc/cosmos-sdk/client/v2 v2.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/store => github.com/roysc/cosmos-sdk/store v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/bank => github.com/roysc/cosmos-sdk/x/bank v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/mint => github.com/roysc/cosmos-sdk/x/mint v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/gov => github.com/roysc/cosmos-sdk/x/gov v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/staking => github.com/roysc/cosmos-sdk/x/staking v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/tx => github.com/roysc/cosmos-sdk/x/tx v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/epochs => github.com/roysc/cosmos-sdk/x/epochs v0.0.0-20241001191620-a3729c1ad6ba
// github.com/cosmos/cosmos-sdk => github.com/roysc/cosmos-sdk v1.0.0-dev
// cosmossdk.io/core v0.7.6 => github.com/roysc/cosmos-sdk/core v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/api v0.7.6 => github.com/roysc/cosmos-sdk/api v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/client/v2 => github.com/roysc/cosmos-sdk/client/v2 v2.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/store => github.com/roysc/cosmos-sdk/store v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/bank => github.com/roysc/cosmos-sdk/x/bank v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/mint => github.com/roysc/cosmos-sdk/x/mint v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/gov => github.com/roysc/cosmos-sdk/x/gov v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/staking => github.com/roysc/cosmos-sdk/x/staking v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/tx => github.com/roysc/cosmos-sdk/x/tx v0.0.0-20241001191620-a3729c1ad6ba
// cosmossdk.io/x/epochs => github.com/roysc/cosmos-sdk/x/epochs v0.0.0-20241001191620-a3729c1ad6ba
// github.com/cosmos/cosmos-sdk => github.com/roysc/cosmos-sdk v1.0.0-dev
// )
// dev
@ -288,10 +410,11 @@ replace (
cosmossdk.io/x/slashing => ../cosmos-sdk/x/slashing
cosmossdk.io/x/staking => ../cosmos-sdk/x/staking
cosmossdk.io/x/tx => ../cosmos-sdk/x/tx
github.com/cometbft/cometbft => ../cometbft
github.com/cosmos/cosmos-sdk => ../cosmos-sdk
github.com/cosmos/cosmos-sdk/tests => ../cosmos-sdk/tests
)
replace google.golang.org/protobuf => /Users/roy/clone/protobuf-go
replace (
github.com/cometbft/cometbft => ../cometbft
github.com/cosmos/cosmos-sdk => ../cosmos-sdk
)
// replace google.golang.org/protobuf => /Users/roy/clone/protobuf-go

513
go.sum

File diff suppressed because it is too large Load Diff

101
nitro/commands.go Normal file
View File

@ -0,0 +1,101 @@
package nitro
import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/statechannels/go-nitro/channel/state/outcome"
gonitrotypes "github.com/statechannels/go-nitro/types"
"git.vdb.to/cerc-io/laconicd/x/bond"
"git.vdb.to/cerc-io/laconicd/x/nitrobank"
)
const (
FlagAssetAddress = "asset"
// FlagEthKey = "eth-key"
)
// type CreateLedgerChannelRequest struct {
// Counterparty gonitrotypes.Address
// ChallengeDuration uint32
// outcome outcome.Exit
// }
// FundCmd opens and funds a new payment channel
// - broadcasts MsgOpenChannel to trigger multisig generation
// - submits a tx to the Ethereum chain to fund the channel
func (s *Server) FundCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "fund <amount>", // TODO: doc args?
Short: "Fund a payment channel",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
// TODO make nitro work with laconic address?
counterparty := gonitrotypes.LedgerAddress(bond.ModuleAccountAddress)
amount, ok := new(big.Int).SetString(args[1], 10)
if !ok {
return fmt.Errorf("invalid amount: %s", args[1])
}
// send message to trigger multisig generation
openChannelMsg := &nitrobank.MsgOpenChannel{
FromAddress: s.ScAddr.String(),
ToAddress: counterparty.String(),
Amount: amount.String(),
// ChallengeDuration: 0, // todo
}
err = tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), openChannelMsg)
if err != nil {
return err
}
assetStr, err := cmd.Flags().GetString(FlagAssetAddress)
if err != nil {
return err
}
asset := common.HexToAddress(assetStr)
exit := outcome.Exit{
outcome.SingleAssetExit{
Asset: asset,
Allocations: []outcome.Allocation{
{
Destination: gonitrotypes.AddressToDestination(counterparty),
Amount: amount,
},
},
},
}
r, err := s.CreateLedgerChannel(counterparty, 0, exit)
if err != nil {
return err
}
fmt.Println("objective response:", r)
// TODO can we use coin denom syntax for eth tokens? how do we map denoms to addresses?
// amount, err := sdk.ParseCoinsNormalized(args[1])
// if err != nil {
// return err
// }
return nil
},
}
cmd.Flags().String(FlagAssetAddress, "", "The address of the asset to fund the channel with")
// cmd.Flags().String(FlagEthKey, "", "The Ethereum signing key")
AddNitroFlags(cmd.Flags())
return cmd
}

36
nitro/config.go Normal file
View File

@ -0,0 +1,36 @@
package nitro
type Config struct {
// TODO: use keyring
Pk string `mapstructure:"pk" toml:"pk" comment:"pk specifies the private key used by the nitro node."`
// TODO: use keyring
EthPk string `mapstructure:"eth-pk" toml:"eth-pk" comment:"eth-pk specifies the private key to use when interacting with the Ethereum chain."`
EthUrl string `mapstructure:"eth-url" toml:"eth-url" comment:"eth-url specifies the URL of the Ethereum node to connect to."`
EthAuthToken string `mapstructure:"eth-auth-token" toml:"eth-auth-token" comment:"eth-auth-token specifies the bearer token used for auth in requests to the Ethereum chain's RPC endpoint."`
EthStartBlock uint64 `mapstructure:"eth-start-block" toml:"eth-start-block" comment:"eth-start-block specifies the Ethereum block number to start listening for Nitro Adjudicator events."`
NaAddress string `mapstructure:"na-address" toml:"na-address" comment:"na-address specifies the address of the Nitro Adjudicator contract."`
VpaAddress string `mapstructure:"vpa-address" toml:"vpa-address" comment:"vpa-address specifies the address of the Virtual Payment App contract."`
CaAddress string `mapstructure:"ca-address" toml:"ca-address" comment:"ca-address specifies the address of the Consensus App contract."`
BootPeers string `mapstructure:"boot-peers" toml:"boot-peers" comment:"boot-peers is a comma-delimited list of peer multiaddrs the messaging service will connect to when initialized."`
PublicIp string `mapstructure:"public-ip" toml:"public-ip" comment:"public-ip specifies the public IP address used for the message service."`
ExtMultiAddr string `mapstructure:"ext-multiaddr" toml:"ext-multiaddr" comment:"ext-multiaddr specifies an additional external multiaddr to advertise."`
MsgPort int `mapstructure:"msg-port" toml:"msg-port" comment:"msg-port specifies the TCP port for the message service."`
WsMsgPort int `mapstructure:"ws-msg-port" toml:"ws-msg-port" comment:"ws-msg-port specifies the WebSocket port for the message service."`
RpcPort int `mapstructure:"rpc-port" toml:"rpc-port" comment:"rpc-port specifies the TCP port for the RPC server."`
TlsCertFilepath string `mapstructure:"tls-cert-filepath" toml:"tls-cert-filepath" comment:"tls-cert-filepath specifies the filepath to the TLS certificate. If not specified, TLS will not be used with the RPC transport."`
TlsKeyFilepath string `mapstructure:"tls-key-filepath" toml:"tls-key-filepath" comment:"tls-key-filepath specifies the filepath to the TLS private key. If not specified, TLS will not be used with the RPC transport."`
}
func DefaultConfig() *Config {
return &Config{
EthUrl: "http://localhost:8545",
PublicIp: "127.0.0.1",
MsgPort: 3005,
WsMsgPort: 6005,
RpcPort: 4005,
// TlsCertFilepath: "./tls/statechannels.org.pem",
// TlsKeyFilepath: "./tls/statechannels.org_key.pem",
}
}

102
nitro/flags.go Normal file
View File

@ -0,0 +1,102 @@
package nitro
import (
"fmt"
"github.com/spf13/pflag"
)
// start flags are prefixed with the server name
// as the config in prefixed with the server name
// this allows viper to properly bind the flags
func prefix(f string) string {
return fmt.Sprintf("%s.%s", serverName, f)
}
var (
flag_pk = prefix("pk") // "pk"
flag_eth_pk = prefix("eth-pk") // "chainpk"
flag_eth_url = prefix("eth-url") // "chainurl"
flag_eth_start_block = prefix("eth-start-block") // "chainstartblock"
flag_eth_auth_token = prefix("eth-auth-token") // "chainauthtoken"
flag_eth_na_address = prefix("eth-na-address") // "naaddress"
flag_eth_vpa_address = prefix("eth-vpa-address") // "vpaaddress"
flag_eth_ca_address = prefix("eth-ca-address") // "caaddress"
// flag_bridge_address = prefix("bridge-address") // "bridgeaddress"
flag_public_ip = prefix("public-ip") // "publicip"
flag_msg_port = prefix("msg-port") // "msgport"
flag_ws_msg_port = prefix("ws-msg-port") // "wsmsgport"
flag_rpc_port = prefix("rpc-port") // "rpcport"
flag_boot_peers = prefix("boot-peers") // "bootpeers"
flag_ext_multiaddr = prefix("ext-multiaddr") // "extmultiaddr"
flag_tls_cert_filepath = prefix("tls-cert-filepath") // "tlscertfilepath"
flag_tls_key_filepath = prefix("tls-key-filepath") // "tlskeyfilepath"
// flag_gui_port = prefix("gui-port") // "guiport"
)
// func addFlags(cmd *cobra.Command) {
// flags := cmd.Flags()
func AddNitroFlags(flags *pflag.FlagSet) {
flags.String(flag_pk, "",
"name of private key used by the Nitro node",
// EnvVars: []string{"SC_PK"},
)
flags.String(flag_eth_url, "ws://127.0.0.1:8545",
"URL of the Ethereum node to connect to",
// EnvVars: []string{"CHAIN_URL"},
)
flags.String(flag_eth_auth_token, "",
"bearer token used for auth in requests to the Ethereum chain's RPC endpoint",
// EnvVars: []string{"CHAIN_AUTH_TOKEN"},
)
flags.String(flag_eth_pk, "",
"name of private key to use when interacting with the Ethereum chain",
// EnvVars: []string{"CHAIN_PK"},
)
flags.Uint64(flag_eth_start_block, 0,
"Ethereum block number to start listening for Nitro Adjudicator events",
// EnvVars: []string{"CHAIN_START_BLOCK"},
)
flags.String(flag_eth_na_address, "",
"Ethereum address of the Nitro Adjudicator contract",
)
flags.String(flag_eth_vpa_address, "",
"Ethereum address of the Virtual Payment App contract",
)
flags.String(flag_eth_ca_address, "",
"Ethereum address of the Consensus App contract",
)
// flags.String(flag_bridge_address, "",
// "Specifies the address of the bridge contract.",
// )
flags.String(flag_public_ip, "127.0.0.1",
"public IP address used for the message service",
// EnvVars: []string{"NITRO_PUBLIC_IP"},
)
flags.String(flag_ext_multiaddr, "",
"additional external multiaddr to advertise",
)
flags.Int(flag_msg_port, 3005,
"TCP port for the message service",
)
flags.Int(flag_ws_msg_port, 6005,
"WebSocket port for the message service",
)
flags.Int(flag_rpc_port, 4005,
"TCP port for the RPC server",
)
// flags.Int(flag_gui_port, 5005,
// "Specifies the tcp port for the Nitro Connect GUI.",
// )
flags.String(flag_boot_peers, "",
"comma-delimited list of peer multiaddrs the messaging service will connect to when initialized",
)
flags.String(flag_tls_cert_filepath, "", // "./tls/statechannels.org.pem",
"filepath to the TLS certificate; if not specified, TLS will not be used with the RPC transport",
)
flags.String(flag_tls_key_filepath, "", // "./tls/statechannels.org_key.pem",
"filepath to the TLS private key; if not specified, TLS will not be used with the RPC transport",
)
}

213
nitro/server.go Normal file
View File

@ -0,0 +1,213 @@
package nitro
import (
"context"
"encoding/hex"
"fmt"
"path/filepath"
"strings"
"cosmossdk.io/core/server"
"cosmossdk.io/log"
serverv2 "cosmossdk.io/server/v2"
"github.com/cosmos/cosmos-sdk/client"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/statechannels/go-nitro/node"
"github.com/statechannels/go-nitro/node/engine"
"github.com/statechannels/go-nitro/node/engine/chainservice"
p2pms "github.com/statechannels/go-nitro/node/engine/messageservice/p2p-message-service"
"github.com/statechannels/go-nitro/node/engine/store"
"github.com/statechannels/go-nitro/types"
)
// type ServerComponent[T transaction.Tx] interface {
// Name() string
// Start(context.Context) error
// Stop(context.Context) error
// }
const (
serverName = "nitro"
)
var (
_ serverv2.HasStartFlags = (*Server)(nil)
_ serverv2.HasCLICommands = (*Server)(nil)
_ serverv2.HasConfig = (*Server)(nil)
// _ serverv2.ConfigWriter = (*Server)(nil)
)
type Server struct {
*node.Node
logger log.Logger
config *Config
// name of Ethereum private key used for chain txs
EthKey string
// path to Nitro store directory
storeDir string
ScAddr types.PartyAddress
}
func New(logger log.Logger, cfg server.ConfigMap) (*Server, error) {
home, _ := cfg[serverv2.FlagHome].(string)
s := &Server{
logger: logger.With(log.ModuleKey, serverName),
storeDir: filepath.Join(home, "nitro")}
c := s.Config().(*Config)
if len(cfg) > 0 {
if err := serverv2.UnmarshalSubConfig(cfg, s.Name(), &c); err != nil {
return nil, fmt.Errorf("failed to unmarshal config: %w", err)
}
}
s.config = c
return s, nil
}
func (s *Server) init(ctx context.Context) error {
c := s.config
var clientCtx client.Context
if v := ctx.Value(client.ClientContextKey); v != nil {
clientCtx = v.(client.Context)
}
sckey, err := extractPrivKeyBytes(clientCtx.Keyring, c.Pk)
if err != nil {
return nil
}
ethkey, err := extractPrivKeyBytes(clientCtx.Keyring, c.EthPk)
if err != nil {
return err
}
// TODO inject signer or callback into nitro node instead of naked privkey
// signer.Sign(message)
// client case is simple signature
// for validator, multisignatures can be negotiated over abci txs, then loaded into signer
// Sign(message) only passes once validator's signature is prepared
storeOpts := store.StoreOpts{
PkBytes: sckey,
UseDurableStore: true,
DurableStoreFolder: s.storeDir,
}
messageOpts := p2pms.MessageOpts{
PkBytes: sckey,
TcpPort: c.MsgPort,
WsMsgPort: c.WsMsgPort,
BootPeers: strings.Split(c.BootPeers, ","),
PublicIp: c.PublicIp,
ExtMultiAddr: c.ExtMultiAddr,
}
chainOpts := chainservice.ChainOpts{
ChainUrl: c.EthUrl,
ChainStartBlockNum: c.EthStartBlock,
ChainAuthToken: c.EthAuthToken,
ChainPk: hex.EncodeToString(ethkey),
NaAddress: common.HexToAddress(c.NaAddress),
VpaAddress: common.HexToAddress(c.VpaAddress),
CaAddress: common.HexToAddress(c.CaAddress),
}
node, store, _, _, err := initNode(s.logger, chainOpts, storeOpts, messageOpts, &engine.PermissivePolicy{})
if err != nil {
return err
}
s.Node = node
s.ScAddr = *store.GetAddress()
return nil
}
func initNode(
logger log.Logger,
chainOpts chainservice.ChainOpts,
storeOpts store.StoreOpts,
messageOpts p2pms.MessageOpts,
policymaker engine.PolicyMaker,
) (
*node.Node,
store.Store,
*p2pms.P2PMessageService,
chainservice.ChainService,
error,
) {
ourStore, err := store.NewStore(storeOpts)
if err != nil {
return nil, nil, nil, nil, err
}
logger.Info("Initializing message service",
"tcp port", messageOpts.TcpPort,
"web socket port", messageOpts.WsMsgPort)
messageOpts.SCAddr = *ourStore.GetAddress()
messageService := p2pms.NewMessageService(messageOpts)
// Compare chainOpts.ChainStartBlock to lastBlockNum seen in store. The larger of the two
// gets passed as an argument when creating NewEthChainService
storeBlockNum, err := ourStore.GetLastBlockNumSeen()
if err != nil {
return nil, nil, nil, nil, err
}
if storeBlockNum > chainOpts.ChainStartBlockNum {
chainOpts.ChainStartBlockNum = storeBlockNum
}
logger.Info("Initializing chain service...")
ourChain, err := chainservice.NewL1ChainService(chainOpts)
if err != nil {
return nil, nil, nil, nil, err
}
node := node.New(
messageService,
ourChain,
ourStore,
policymaker,
)
return &node, ourStore, messageService, ourChain, nil
}
func (s *Server) Name() string {
return serverName
}
func (s *Server) Start(ctx context.Context) error {
return nil
}
func (s *Server) Stop(context.Context) error {
return nil
}
func (s *Server) StartCmdFlags() *pflag.FlagSet {
flags := pflag.NewFlagSet(s.Name(), pflag.ExitOnError)
AddNitroFlags(flags)
return flags
}
func (s *Server) Config() any {
if s.config == nil {
return DefaultConfig()
}
return s.config
}
// func (s *Server) WriteConfig(path string) error
func (s *Server) CLICommands() serverv2.CLIConfig {
return serverv2.CLIConfig{
Commands: []*cobra.Command{
// command to create payment channel
s.FundCmd(),
},
// Queries: []*cobra.Command{},
}
}

32
nitro/util.go Normal file
View File

@ -0,0 +1,32 @@
package nitro
import (
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)
// cosmos-sdk crypto/keyring/record.go:138
func extractPrivKeyFromLocal(rl *keyring.Record_Local) (cryptotypes.PrivKey, error) {
if rl.PrivKey == nil {
return nil, keyring.ErrPrivKeyNotAvailable
}
priv, ok := rl.PrivKey.GetCachedValue().(cryptotypes.PrivKey)
if !ok {
return nil, errorsmod.Wrap(keyring.ErrCastAny, "PrivKey")
}
return priv, nil
}
func extractPrivKeyBytes(kr keyring.Keyring, uid string) ([]byte, error) {
ethkr, err := kr.Key(uid)
if err != nil {
return nil, err
}
ethkey, err := extractPrivKeyFromLocal(ethkr.GetLocal())
if err != nil {
return nil, err
}
return ethkey.Bytes(), nil
}

View File

@ -0,0 +1,29 @@
syntax = "proto3";
package cerc.nitrobank.v1;
import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
// import "cosmos_proto/cosmos.proto";
import "cerc/nitrobank/v1/nitrobank.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/nitrobank";
message MsgInitAccount {
string nitro_address = 1;
}
message MsgInitAccountResponse {}
message MsgOpenChannel {
// Nitro address of payer
string from_address = 1;
// Nitro address of payee ("counterparty" module account)
string to_address = 2;
// Simplified outcome just includes the funding amount from payer
string amount = 3;
// TODO
// uint32 challenge_duration = 3;
}
message MsgOpenChannelResponse {}

View File

@ -15,12 +15,14 @@ import (
"cosmossdk.io/math"
"cosmossdk.io/systemtests"
accountstypes "cosmossdk.io/x/accounts/v1"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
bondtypes "git.vdb.to/cerc-io/laconicd/x/bond"
"git.vdb.to/cerc-io/laconicd/x/nitrobank"
registrytypes "git.vdb.to/cerc-io/laconicd/x/registry"
)
@ -131,6 +133,25 @@ func setupSuite(t *testing.T) *registryTestSuite {
require.NoError(t, err)
genesis, err = sjson.SetRawBytes(genesis, "app_state.registry", regStateBz)
require.NoError(t, err)
// add consensus-controlled module account(s)
bondinitmsg, err := codectypes.NewAnyWithValue(&nitrobank.MsgInitAccount{})
require.NoError(t, err)
var accountsState accountstypes.GenesisState
raw = gjson.Get(string(genesis), "app_state.accounts").String()
require.NoError(t, cdc.UnmarshalJSON([]byte(raw), &accountsState))
accountsState.InitAccountMsgs = []*accountstypes.MsgInit{
{
Sender: accountAddress,
AccountType: "nitrobank",
Message: bondinitmsg,
},
}
accountsStateBz, err := cdc.MarshalJSON(&accountsState)
require.NoError(t, err)
genesis, err = sjson.SetRawBytes(genesis, "app_state.accounts", accountsStateBz)
require.NoError(t, err)
return genesis
})
sut.StartChain(t)

View File

@ -1160,6 +1160,7 @@ func _Query_GetAuctionModuleBalance_Handler(srv interface{}, ctx context.Context
return interceptor(ctx, in, info, handler)
}
var Query_serviceDesc = _Query_serviceDesc
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.auction.v1.Query",
HandlerType: (*QueryServer)(nil),

View File

@ -765,6 +765,7 @@ func _Msg_ReleaseFunds_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
var Msg_serviceDesc = _Msg_serviceDesc
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.auction.v1.Msg",
HandlerType: (*MsgServer)(nil),

View File

@ -22,6 +22,7 @@ import (
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bondtypes "git.vdb.to/cerc-io/laconicd/x/bond"
"git.vdb.to/cerc-io/laconicd/x/nitrobank"
)
type BondsIndexes struct {
@ -55,6 +56,7 @@ type Keeper struct {
// External keepers
accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
nitroKeeper nitrobank.Keeper
// Track bond usage in other cosmos-sdk modules (more like a usage tracker).
usageKeepers []bondtypes.BondUsageKeeper
@ -140,6 +142,7 @@ func (k Keeper) HasBond(ctx context.Context, id string) (bool, error) {
// SaveBond - saves a bond to the store.
func (k Keeper) SaveBond(ctx context.Context, bond *bondtypes.Bond) error {
fmt.Println(">>> saving bond:", bond)
return k.Bonds.Set(ctx, bond.Id, *bond)
}
@ -204,7 +207,7 @@ func (k Keeper) CreateBond(ctx context.Context, ownerAddress sdk.AccAddress, coi
for _, coin := range coins {
balance := k.bankKeeper.HasBalance(ctx, ownerAddress, coin)
if !balance {
return nil, errorsmod.Wrap(sdkerrors.ErrInsufficientFunds, "failed to create bond; Insufficient funds")
return nil, errorsmod.Wrap(sdkerrors.ErrInsufficientFunds, "failed to create bond")
}
}
@ -231,7 +234,9 @@ func (k Keeper) CreateBond(ctx context.Context, ownerAddress sdk.AccAddress, coi
}
// Move funds into the bond account module.
err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, bondtypes.ModuleName, bond.Balance)
// err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, bondtypes.ModuleName, bond.Balance)
// Nitro: open a payment channel
err = k.nitroKeeper.EnsurePaymentChannel(ownerAddress, bondtypes.ModuleName, bond.Balance)
if err != nil {
return nil, err
}
@ -283,6 +288,7 @@ func (k Keeper) RefillBond(ctx context.Context, id string, ownerAddress sdk.AccA
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Max bond amount exceeded")
}
// Nitro: create voucher on existing payment channel with new balance
// Move funds into the bond account module.
err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, bondtypes.ModuleName, coins)
if err != nil {
@ -325,6 +331,7 @@ func (k Keeper) WithdrawBond(ctx context.Context, id string, ownerAddress sdk.Ac
return nil, errorsmod.Wrap(sdkerrors.ErrInsufficientFunds, "Insufficient bond balance")
}
// Nitro: create voucher with lower balance (?)
// Move funds from the bond into the account.
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, bondtypes.ModuleName, ownerAddress, coins)
if err != nil {
@ -369,6 +376,7 @@ func (k Keeper) CancelBond(ctx context.Context, id string, ownerAddress sdk.AccA
}
}
// Nitro: close payment channel, remaining funds just not sent
// Move funds from the bond into the account.
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, bondtypes.ModuleName, ownerAddress, bond.Balance)
if err != nil {
@ -430,6 +438,7 @@ func (k Keeper) TransferRentToModuleAccount(ctx context.Context, id, moduleAccou
return errorsmod.Wrap(sdkerrors.ErrInsufficientFunds, "Insufficient funds")
}
// Nitro: payment on module-module channel
// Move funds from bond module to record rent module.
err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, bondtypes.ModuleName, moduleAccount, rent)
if err != nil {

View File

@ -1,6 +1,9 @@
package bond
import "cosmossdk.io/collections"
import (
"cosmossdk.io/collections"
"github.com/cosmos/cosmos-sdk/types/address"
)
const (
ModuleName = "bond"
@ -16,3 +19,6 @@ var (
BondsPrefix = collections.NewPrefix(1)
BondOwnerIndexPrefix = collections.NewPrefix(2)
)
// ModuleAccountAddress defines the x/bond module address.
var ModuleAccountAddress = address.Module(ModuleName)

View File

@ -769,6 +769,7 @@ func _Query_GetBondModuleBalance_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
var Query_serviceDesc = _Query_serviceDesc
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.bond.v1.Query",
HandlerType: (*QueryServer)(nil),

View File

@ -781,6 +781,7 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
var Msg_serviceDesc = _Msg_serviceDesc
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.bond.v1.Msg",
HandlerType: (*MsgServer)(nil),

57
x/nitrobank/account.go Normal file
View File

@ -0,0 +1,57 @@
package nitrobank
import (
"context"
"cosmossdk.io/collections"
"cosmossdk.io/x/accounts/accountstd"
// "github.com/ethereum/go-ethereum/common"
nitro "git.vdb.to/cerc-io/laconicd/nitro/service"
)
var (
// EthAddressPrefix = collections.NewPrefix(0)
NitroAddressPrefix = collections.NewPrefix(2)
NamePrefix = collections.NewPrefix(1)
)
// Account represents a Nitro state channel participant
type Account struct {
// EthAddress collections.Item[[]byte]
// NitroAddress is the address corresponding to the Nitro node private key
NitroAddress collections.Item[[]byte]
// Name is the name of the module account
Name collections.Item[string]
nitroService nitro.Service
}
// NewAccount creates an empty ModuleAccount
func NewAccount(d accountstd.Dependencies) *Account {
return &Account{
// EthAddress: collections.NewItem(d.SchemaBuilder, EthAddressPrefix, "eth_address", collections.BytesValue),
NitroAddress: collections.NewItem(d.SchemaBuilder, NitroAddressPrefix, "nitro_address", collections.BytesValue),
Name: collections.NewItem(d.SchemaBuilder, NamePrefix, "name", collections.StringValue),
}
}
func (a Account) Init(ctx context.Context, msg *MsgInitAccount) (*MsgInitAccountResponse, error) {
// use Whoami to register account address as consensus-controlled
// addr := accountstd.Whoami(ctx)
// a.nitroService.SetConsensusAccount(addr)
return &MsgInitAccountResponse{}, nil
}
func (a Account) RegisterInitHandler(builder *accountstd.InitBuilder) {
accountstd.RegisterInitHandler(builder, a.Init)
}
func (a Account) OpenChannel(msg *MsgOpenChannel) (*MsgOpenChannelResponse, error) {
// produce a partial signature to open a ledger and payment channel between the requesting
// counterparty and this consensus controlled account
return nil, nil
}

15
x/nitrobank/keys.go Normal file
View File

@ -0,0 +1,15 @@
package nitrobank
// import "cosmossdk.io/collections"
const (
ModuleName = "nitrobank"
// StoreKey defines the primary module store key
StoreKey = ModuleName
)
// Store prefixes
var (
// ParamsPrefix = collections.NewPrefix(0)
)

1
x/nitrobank/msgs.go Normal file
View File

@ -0,0 +1 @@
package nitrobank

View File

@ -0,0 +1,42 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cerc/nitrobank/v1/nitrobank.proto
package nitrobank
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() { proto.RegisterFile("cerc/nitrobank/v1/nitrobank.proto", fileDescriptor_fe2352691716cd8e) }
var fileDescriptor_fe2352691716cd8e = []byte{
// 179 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8e, 0xb1, 0x0a, 0xc2, 0x30,
0x10, 0x86, 0xdb, 0xc5, 0xc1, 0x4d, 0x11, 0x84, 0x22, 0x01, 0x27, 0x27, 0x73, 0x14, 0x9f, 0x40,
0x1f, 0xc3, 0x2d, 0x4d, 0xcb, 0x11, 0x6c, 0xf3, 0x97, 0x26, 0x14, 0x1f, 0xc3, 0xc7, 0x72, 0xec,
0xe8, 0x28, 0xed, 0x8b, 0x48, 0x5a, 0x21, 0xdb, 0x7f, 0xff, 0x7d, 0x77, 0x7c, 0xeb, 0xa3, 0xae,
0x3a, 0x4d, 0xd6, 0xf8, 0x0e, 0x85, 0xb2, 0x0f, 0xea, 0xf3, 0x38, 0xc8, 0xb6, 0x83, 0xc7, 0x76,
0x13, 0x10, 0x19, 0xdb, 0x3e, 0xcf, 0xf6, 0x1a, 0xae, 0x81, 0xa3, 0xc6, 0x71, 0xb8, 0x68, 0x1c,
0x2f, 0x6c, 0xb6, 0x63, 0x30, 0xe6, 0x48, 0x21, 0xfd, 0xdb, 0x03, 0x03, 0x5c, 0x57, 0xa4, 0x5a,
0x43, 0xca, 0x5a, 0x78, 0xe5, 0x0d, 0xac, 0x5b, 0xb6, 0xb7, 0xeb, 0x7b, 0x14, 0xe9, 0x30, 0x8a,
0xf4, 0x3b, 0x8a, 0xf4, 0x35, 0x89, 0x64, 0x98, 0x44, 0xf2, 0x99, 0x44, 0x72, 0x3f, 0xb1, 0xf1,
0xb2, 0x2f, 0x0b, 0xe9, 0x41, 0x41, 0xe2, 0x6c, 0x40, 0xb5, 0xd2, 0xb0, 0x46, 0x97, 0xf4, 0x8c,
0xa2, 0xc5, 0x6a, 0xfe, 0x74, 0xf9, 0x05, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x33, 0xad, 0xad, 0xce,
0x00, 0x00, 0x00,
}

839
x/nitrobank/tx.pb.go Normal file
View File

@ -0,0 +1,839 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cerc/nitrobank/v1/tx.proto
package nitrobank
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type MsgInitAccount struct {
NitroAddress string `protobuf:"bytes,1,opt,name=nitro_address,json=nitroAddress,proto3" json:"nitro_address,omitempty"`
}
func (m *MsgInitAccount) Reset() { *m = MsgInitAccount{} }
func (m *MsgInitAccount) String() string { return proto.CompactTextString(m) }
func (*MsgInitAccount) ProtoMessage() {}
func (*MsgInitAccount) Descriptor() ([]byte, []int) {
return fileDescriptor_7647fae54567b5bd, []int{0}
}
func (m *MsgInitAccount) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgInitAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgInitAccount.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 *MsgInitAccount) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgInitAccount.Merge(m, src)
}
func (m *MsgInitAccount) XXX_Size() int {
return m.Size()
}
func (m *MsgInitAccount) XXX_DiscardUnknown() {
xxx_messageInfo_MsgInitAccount.DiscardUnknown(m)
}
var xxx_messageInfo_MsgInitAccount proto.InternalMessageInfo
func (m *MsgInitAccount) GetNitroAddress() string {
if m != nil {
return m.NitroAddress
}
return ""
}
type MsgInitAccountResponse struct {
}
func (m *MsgInitAccountResponse) Reset() { *m = MsgInitAccountResponse{} }
func (m *MsgInitAccountResponse) String() string { return proto.CompactTextString(m) }
func (*MsgInitAccountResponse) ProtoMessage() {}
func (*MsgInitAccountResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7647fae54567b5bd, []int{1}
}
func (m *MsgInitAccountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgInitAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgInitAccountResponse.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 *MsgInitAccountResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgInitAccountResponse.Merge(m, src)
}
func (m *MsgInitAccountResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgInitAccountResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgInitAccountResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgInitAccountResponse proto.InternalMessageInfo
type MsgOpenChannel struct {
// Nitro address of payer
FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"`
// Nitro address of payee ("counterparty" module account)
ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"`
// Simplified outcome just includes the funding amount from payer
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
}
func (m *MsgOpenChannel) Reset() { *m = MsgOpenChannel{} }
func (m *MsgOpenChannel) String() string { return proto.CompactTextString(m) }
func (*MsgOpenChannel) ProtoMessage() {}
func (*MsgOpenChannel) Descriptor() ([]byte, []int) {
return fileDescriptor_7647fae54567b5bd, []int{2}
}
func (m *MsgOpenChannel) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgOpenChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgOpenChannel.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 *MsgOpenChannel) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgOpenChannel.Merge(m, src)
}
func (m *MsgOpenChannel) XXX_Size() int {
return m.Size()
}
func (m *MsgOpenChannel) XXX_DiscardUnknown() {
xxx_messageInfo_MsgOpenChannel.DiscardUnknown(m)
}
var xxx_messageInfo_MsgOpenChannel proto.InternalMessageInfo
func (m *MsgOpenChannel) GetFromAddress() string {
if m != nil {
return m.FromAddress
}
return ""
}
func (m *MsgOpenChannel) GetToAddress() string {
if m != nil {
return m.ToAddress
}
return ""
}
func (m *MsgOpenChannel) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
type MsgOpenChannelResponse struct {
}
func (m *MsgOpenChannelResponse) Reset() { *m = MsgOpenChannelResponse{} }
func (m *MsgOpenChannelResponse) String() string { return proto.CompactTextString(m) }
func (*MsgOpenChannelResponse) ProtoMessage() {}
func (*MsgOpenChannelResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7647fae54567b5bd, []int{3}
}
func (m *MsgOpenChannelResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgOpenChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgOpenChannelResponse.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 *MsgOpenChannelResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgOpenChannelResponse.Merge(m, src)
}
func (m *MsgOpenChannelResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgOpenChannelResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgOpenChannelResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgOpenChannelResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgInitAccount)(nil), "cerc.nitrobank.v1.MsgInitAccount")
proto.RegisterType((*MsgInitAccountResponse)(nil), "cerc.nitrobank.v1.MsgInitAccountResponse")
proto.RegisterType((*MsgOpenChannel)(nil), "cerc.nitrobank.v1.MsgOpenChannel")
proto.RegisterType((*MsgOpenChannelResponse)(nil), "cerc.nitrobank.v1.MsgOpenChannelResponse")
}
func init() { proto.RegisterFile("cerc/nitrobank/v1/tx.proto", fileDescriptor_7647fae54567b5bd) }
var fileDescriptor_7647fae54567b5bd = []byte{
// 304 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4e, 0xf3, 0x30,
0x14, 0xc5, 0x9b, 0xef, 0x93, 0x2a, 0xd5, 0x14, 0x24, 0x22, 0x54, 0xaa, 0x0a, 0x2c, 0x5a, 0x06,
0x58, 0x88, 0x55, 0x21, 0x1e, 0x20, 0x30, 0x31, 0x20, 0xa4, 0x8e, 0x2c, 0xc8, 0x71, 0x8c, 0x31,
0x24, 0xf7, 0x46, 0xb1, 0x89, 0xfa, 0x18, 0x3c, 0x16, 0x63, 0x47, 0x46, 0x94, 0xbc, 0x08, 0xb2,
0x9b, 0x12, 0xfe, 0x6c, 0xd7, 0xe7, 0x1c, 0xdf, 0xdf, 0xd5, 0x21, 0x13, 0x21, 0x4b, 0xc1, 0x40,
0xdb, 0x12, 0x13, 0x0e, 0xcf, 0xac, 0x9a, 0x33, 0xbb, 0x8c, 0x8a, 0x12, 0x2d, 0x86, 0xbb, 0xce,
0x8b, 0xbe, 0xbc, 0xa8, 0x9a, 0x4f, 0xf6, 0x05, 0x9a, 0x1c, 0x0d, 0xcb, 0x8d, 0x72, 0xd1, 0xdc,
0xa8, 0x75, 0x76, 0xb2, 0xa7, 0x50, 0xa1, 0x1f, 0x99, 0x9b, 0x5a, 0xf5, 0x40, 0x21, 0xaa, 0x4c,
0x32, 0x5e, 0x68, 0xc6, 0x01, 0xd0, 0x72, 0xab, 0x11, 0x4c, 0xeb, 0x4e, 0xff, 0xb2, 0x3b, 0x98,
0x8f, 0xcc, 0x2e, 0xc8, 0xce, 0x8d, 0x51, 0xd7, 0xa0, 0x6d, 0x2c, 0x04, 0xbe, 0x80, 0x0d, 0x8f,
0xc9, 0xb6, 0x0f, 0xdd, 0xf3, 0x34, 0x2d, 0xa5, 0x31, 0xe3, 0xe0, 0x28, 0x38, 0x1d, 0x2c, 0x86,
0x5e, 0x8c, 0xd7, 0xda, 0x6c, 0x4c, 0x46, 0x3f, 0xbf, 0x2d, 0xa4, 0x29, 0x10, 0x8c, 0x9c, 0x3d,
0xf9, 0x85, 0xb7, 0x85, 0x84, 0xab, 0x47, 0x0e, 0x20, 0xb3, 0x70, 0x4a, 0x86, 0x0f, 0x25, 0xe6,
0xbf, 0xf6, 0x6d, 0x39, 0xad, 0x5d, 0x17, 0x1e, 0x12, 0x62, 0x3b, 0xe0, 0x3f, 0x1f, 0x18, 0xd8,
0x0d, 0x2d, 0x1c, 0x91, 0x3e, 0xcf, 0x1d, 0x65, 0xfc, 0xdf, 0x5b, 0xed, 0xab, 0xbd, 0xe2, 0x1b,
0x6b, 0x73, 0xc5, 0x65, 0xfc, 0x56, 0xd3, 0x60, 0x55, 0xd3, 0xe0, 0xa3, 0xa6, 0xc1, 0x6b, 0x43,
0x7b, 0xab, 0x86, 0xf6, 0xde, 0x1b, 0xda, 0xbb, 0x3b, 0x51, 0xda, 0x46, 0x55, 0x9a, 0x44, 0x16,
0x99, 0xab, 0xe7, 0x4c, 0x23, 0xcb, 0xb8, 0x40, 0xd0, 0x22, 0x65, 0xcb, 0xae, 0x9f, 0xa4, 0xef,
0x0b, 0x3a, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x6e, 0x50, 0x5b, 0xc1, 0x01, 0x00, 0x00,
}
func (m *MsgInitAccount) 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 *MsgInitAccount) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgInitAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NitroAddress) > 0 {
i -= len(m.NitroAddress)
copy(dAtA[i:], m.NitroAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.NitroAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgInitAccountResponse) 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 *MsgInitAccountResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgInitAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgOpenChannel) 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 *MsgOpenChannel) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgOpenChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Amount) > 0 {
i -= len(m.Amount)
copy(dAtA[i:], m.Amount)
i = encodeVarintTx(dAtA, i, uint64(len(m.Amount)))
i--
dAtA[i] = 0x1a
}
if len(m.ToAddress) > 0 {
i -= len(m.ToAddress)
copy(dAtA[i:], m.ToAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress)))
i--
dAtA[i] = 0x12
}
if len(m.FromAddress) > 0 {
i -= len(m.FromAddress)
copy(dAtA[i:], m.FromAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgOpenChannelResponse) 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 *MsgOpenChannelResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgOpenChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *MsgInitAccount) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.NitroAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgInitAccountResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgOpenChannel) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.FromAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.ToAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Amount)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgOpenChannelResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgInitAccount) 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 ErrIntOverflowTx
}
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: MsgInitAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgInitAccount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NitroAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NitroAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgInitAccountResponse) 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 ErrIntOverflowTx
}
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: MsgInitAccountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgInitAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgOpenChannel) 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 ErrIntOverflowTx
}
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: MsgOpenChannel: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgOpenChannel: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FromAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ToAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Amount = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgOpenChannelResponse) 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 ErrIntOverflowTx
}
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: MsgOpenChannelResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgOpenChannelResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -510,6 +510,7 @@ func _Query_GetParticipantByNitroAddress_Handler(srv interface{}, ctx context.Co
return interceptor(ctx, in, info, handler)
}
var Query_serviceDesc = _Query_serviceDesc
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.onboarding.v1.Query",
HandlerType: (*QueryServer)(nil),

View File

@ -252,6 +252,7 @@ func _Msg_OnboardParticipant_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
var Msg_serviceDesc = _Msg_serviceDesc
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.onboarding.v1.Msg",
HandlerType: (*MsgServer)(nil),

View File

@ -1827,6 +1827,7 @@ func _Query_Authorities_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
var Query_serviceDesc = _Query_serviceDesc
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.registry.v1.Query",
HandlerType: (*QueryServer)(nil),

View File

@ -1652,6 +1652,7 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
var Msg_serviceDesc = _Msg_serviceDesc
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.registry.v1.Msg",
HandlerType: (*MsgServer)(nil),