looprpc: include static address in swap client

We remove the static address client and add its
rpcs into the SwapClient
Slyghtning 2 months ago
parent 7ff3318185
commit ed7074b265
No known key found for this signature in database
GPG Key ID: F82D456EA023C9BF

@ -21,11 +21,10 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// `AddressType` has to be one of:
//
//`AddressType` has to be one of:
//
//- `unknown`: Unknown address type
//- `p2tr`: Pay to taproot pubkey (`TAPROOT_PUBKEY` = 1)
// - `unknown`: Unknown address type
// - `p2tr`: Pay to taproot pubkey (`TAPROOT_PUBKEY` = 1)
type AddressType int32
const (
@ -4721,7 +4720,7 @@ var file_client_proto_rawDesc = []byte{
0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0c, 0x12,
0x20, 0x0a, 0x1c, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46,
0x45, 0x45, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10,
0x0d, 0x32, 0xc0, 0x0a, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x0d, 0x32, 0xd1, 0x0b, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x12, 0x39, 0x0a, 0x07, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x6f,
0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53,
@ -4805,20 +4804,19 @@ var file_client_proto_rawDesc = []byte{
0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73,
0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa6, 0x01, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0a,
0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f,
0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63,
0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65,
0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73,
0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e,
0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a,
0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68,
0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c,
0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77,
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b,
0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0b, 0x4c,
0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f,
0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70,
0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62,
0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -4934,8 +4932,8 @@ var file_client_proto_depIdxs = []int32{
40, // 40: looprpc.SwapClient.ListReservations:input_type -> looprpc.ListReservationsRequest
43, // 41: looprpc.SwapClient.InstantOut:input_type -> looprpc.InstantOutRequest
45, // 42: looprpc.SwapClient.InstantOutQuote:input_type -> looprpc.InstantOutQuoteRequest
47, // 43: looprpc.StaticAddressClient.NewAddress:input_type -> looprpc.NewAddressRequest
49, // 44: looprpc.StaticAddressClient.ListUnspent:input_type -> looprpc.ListUnspentRequest
47, // 43: looprpc.SwapClient.NewAddress:input_type -> looprpc.NewAddressRequest
49, // 44: looprpc.SwapClient.ListUnspent:input_type -> looprpc.ListUnspentRequest
9, // 45: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse
9, // 46: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse
11, // 47: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus
@ -4955,8 +4953,8 @@ var file_client_proto_depIdxs = []int32{
41, // 61: looprpc.SwapClient.ListReservations:output_type -> looprpc.ListReservationsResponse
44, // 62: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse
46, // 63: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse
48, // 64: looprpc.StaticAddressClient.NewAddress:output_type -> looprpc.NewAddressResponse
50, // 65: looprpc.StaticAddressClient.ListUnspent:output_type -> looprpc.ListUnspentResponse
48, // 64: looprpc.SwapClient.NewAddress:output_type -> looprpc.NewAddressResponse
50, // 65: looprpc.SwapClient.ListUnspent:output_type -> looprpc.ListUnspentResponse
45, // [45:66] is the sub-list for method output_type
24, // [24:45] is the sub-list for method input_type
24, // [24:24] is the sub-list for extension type_name
@ -5519,7 +5517,7 @@ func file_client_proto_init() {
NumEnums: 7,
NumMessages: 45,
NumExtensions: 0,
NumServices: 2,
NumServices: 1,
},
GoTypes: file_client_proto_goTypes,
DependencyIndexes: file_client_proto_depIdxs,

@ -127,6 +127,16 @@ service SwapClient {
*/
rpc InstantOutQuote (InstantOutQuoteRequest)
returns (InstantOutQuoteResponse);
/* loop: `static newaddress`
NewAddress requests a new static address for loop-ins from the server.
*/
rpc NewAddress (NewAddressRequest) returns (NewAddressResponse);
/* loop: `static listunspent`
ListUnspent returns a list of utxos behind a static address.
*/
rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse);
}
message LoopOutRequest {
@ -1387,17 +1397,6 @@ message InstantOutQuoteResponse {
int64 sweep_fee_sat = 2;
}
service StaticAddressClient {
/*
NewAddress requests a new static address for loop-ins from the server.
*/
rpc NewAddress (NewAddressRequest) returns (NewAddressResponse);
/*
ListUnspent returns a list of utxos behind a static address.
*/
rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse);
}
message NewAddressRequest {
/*
The client's public key for the 2-of-2 MuSig2 taproot static address.

@ -7,9 +7,6 @@
"tags": [
{
"name": "SwapClient"
},
{
"name": "StaticAddressClient"
}
],
"consumes": [

@ -93,6 +93,12 @@ type SwapClientClient interface {
//InstantOutQuote returns a quote for an instant out swap with the provided
//parameters.
InstantOutQuote(ctx context.Context, in *InstantOutQuoteRequest, opts ...grpc.CallOption) (*InstantOutQuoteResponse, error)
// loop: `static newaddress`
//NewAddress requests a new static address for loop-ins from the server.
NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error)
// loop: `static listunspent`
//ListUnspent returns a list of utxos behind a static address.
ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error)
}
type swapClientClient struct {
@ -297,6 +303,24 @@ func (c *swapClientClient) InstantOutQuote(ctx context.Context, in *InstantOutQu
return out, nil
}
func (c *swapClientClient) NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) {
out := new(NewAddressResponse)
err := c.cc.Invoke(ctx, "/looprpc.SwapClient/NewAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *swapClientClient) ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) {
out := new(ListUnspentResponse)
err := c.cc.Invoke(ctx, "/looprpc.SwapClient/ListUnspent", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// SwapClientServer is the server API for SwapClient service.
// All implementations must embed UnimplementedSwapClientServer
// for forward compatibility
@ -376,6 +400,12 @@ type SwapClientServer interface {
//InstantOutQuote returns a quote for an instant out swap with the provided
//parameters.
InstantOutQuote(context.Context, *InstantOutQuoteRequest) (*InstantOutQuoteResponse, error)
// loop: `static newaddress`
//NewAddress requests a new static address for loop-ins from the server.
NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error)
// loop: `static listunspent`
//ListUnspent returns a list of utxos behind a static address.
ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error)
mustEmbedUnimplementedSwapClientServer()
}
@ -440,6 +470,12 @@ func (UnimplementedSwapClientServer) InstantOut(context.Context, *InstantOutRequ
func (UnimplementedSwapClientServer) InstantOutQuote(context.Context, *InstantOutQuoteRequest) (*InstantOutQuoteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InstantOutQuote not implemented")
}
func (UnimplementedSwapClientServer) NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NewAddress not implemented")
}
func (UnimplementedSwapClientServer) ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUnspent not implemented")
}
func (UnimplementedSwapClientServer) mustEmbedUnimplementedSwapClientServer() {}
// UnsafeSwapClientServer may be embedded to opt out of forward compatibility for this service.
@ -798,6 +834,42 @@ func _SwapClient_InstantOutQuote_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
func _SwapClient_NewAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NewAddressRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SwapClientServer).NewAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/looprpc.SwapClient/NewAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SwapClientServer).NewAddress(ctx, req.(*NewAddressRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SwapClient_ListUnspent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUnspentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SwapClientServer).ListUnspent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/looprpc.SwapClient/ListUnspent",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SwapClientServer).ListUnspent(ctx, req.(*ListUnspentRequest))
}
return interceptor(ctx, in, info, handler)
}
// SwapClient_ServiceDesc is the grpc.ServiceDesc for SwapClient service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -877,6 +949,14 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{
MethodName: "InstantOutQuote",
Handler: _SwapClient_InstantOutQuote_Handler,
},
{
MethodName: "NewAddress",
Handler: _SwapClient_NewAddress_Handler,
},
{
MethodName: "ListUnspent",
Handler: _SwapClient_ListUnspent_Handler,
},
},
Streams: []grpc.StreamDesc{
{
@ -887,133 +967,3 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{
},
Metadata: "client.proto",
}
// StaticAddressClientClient is the client API for StaticAddressClient 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.
type StaticAddressClientClient interface {
//
//NewAddress requests a new static address for loop-ins from the server.
NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error)
//
//ListUnspent returns a list of utxos behind a static address.
ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error)
}
type staticAddressClientClient struct {
cc grpc.ClientConnInterface
}
func NewStaticAddressClientClient(cc grpc.ClientConnInterface) StaticAddressClientClient {
return &staticAddressClientClient{cc}
}
func (c *staticAddressClientClient) NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) {
out := new(NewAddressResponse)
err := c.cc.Invoke(ctx, "/looprpc.StaticAddressClient/NewAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *staticAddressClientClient) ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) {
out := new(ListUnspentResponse)
err := c.cc.Invoke(ctx, "/looprpc.StaticAddressClient/ListUnspent", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// StaticAddressClientServer is the server API for StaticAddressClient service.
// All implementations must embed UnimplementedStaticAddressClientServer
// for forward compatibility
type StaticAddressClientServer interface {
//
//NewAddress requests a new static address for loop-ins from the server.
NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error)
//
//ListUnspent returns a list of utxos behind a static address.
ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error)
mustEmbedUnimplementedStaticAddressClientServer()
}
// UnimplementedStaticAddressClientServer must be embedded to have forward compatible implementations.
type UnimplementedStaticAddressClientServer struct {
}
func (UnimplementedStaticAddressClientServer) NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NewAddress not implemented")
}
func (UnimplementedStaticAddressClientServer) ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUnspent not implemented")
}
func (UnimplementedStaticAddressClientServer) mustEmbedUnimplementedStaticAddressClientServer() {}
// UnsafeStaticAddressClientServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to StaticAddressClientServer will
// result in compilation errors.
type UnsafeStaticAddressClientServer interface {
mustEmbedUnimplementedStaticAddressClientServer()
}
func RegisterStaticAddressClientServer(s grpc.ServiceRegistrar, srv StaticAddressClientServer) {
s.RegisterService(&StaticAddressClient_ServiceDesc, srv)
}
func _StaticAddressClient_NewAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NewAddressRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StaticAddressClientServer).NewAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/looprpc.StaticAddressClient/NewAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StaticAddressClientServer).NewAddress(ctx, req.(*NewAddressRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StaticAddressClient_ListUnspent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUnspentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StaticAddressClientServer).ListUnspent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/looprpc.StaticAddressClient/ListUnspent",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StaticAddressClientServer).ListUnspent(ctx, req.(*ListUnspentRequest))
}
return interceptor(ctx, in, info, handler)
}
// StaticAddressClient_ServiceDesc is the grpc.ServiceDesc for StaticAddressClient service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var StaticAddressClient_ServiceDesc = grpc.ServiceDesc{
ServiceName: "looprpc.StaticAddressClient",
HandlerType: (*StaticAddressClientServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "NewAddress",
Handler: _StaticAddressClient_NewAddress_Handler,
},
{
MethodName: "ListUnspent",
Handler: _StaticAddressClient_ListUnspent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "client.proto",
}

@ -1,73 +0,0 @@
// Code generated by falafel 0.9.1. DO NOT EDIT.
// source: client.proto
package looprpc
import (
"context"
gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
"google.golang.org/protobuf/encoding/protojson"
)
func RegisterStaticAddressClientJSONCallbacks(registry map[string]func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error))) {
marshaler := &gateway.JSONPb{
MarshalOptions: protojson.MarshalOptions{
UseProtoNames: true,
EmitUnpopulated: true,
},
}
registry["looprpc.StaticAddressClient.NewAddress"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &NewAddressRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewStaticAddressClientClient(conn)
resp, err := client.NewAddress(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
registry["looprpc.StaticAddressClient.ListUnspent"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &ListUnspentRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewStaticAddressClientClient(conn)
resp, err := client.ListUnspent(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
}

@ -512,4 +512,54 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex
}
callback(string(respBytes), nil)
}
registry["looprpc.SwapClient.NewAddress"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &NewAddressRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewSwapClientClient(conn)
resp, err := client.NewAddress(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
registry["looprpc.SwapClient.ListUnspent"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &ListUnspentRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewSwapClientClient(conn)
resp, err := client.ListUnspent(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
}

Loading…
Cancel
Save