mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
swapserverrpc: static address loop-ins
This commit is contained in:
parent
f2c9fb8a68
commit
4bf2a9b834
3 changed files with 1751 additions and 277 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -689,6 +689,26 @@ service StaticAddressServer {
|
|||
// the partial sigs for the client's selected deposits.
|
||||
rpc ServerWithdrawDeposits (ServerWithdrawRequest)
|
||||
returns (ServerWithdrawResponse);
|
||||
|
||||
// ServerStaticAddressLoopIn initiates a static address loop-in swap. The
|
||||
// server will respond with htlc details that the client can use to
|
||||
// construct and sign the htlc tx.
|
||||
rpc ServerStaticAddressLoopIn (ServerStaticAddressLoopInRequest)
|
||||
returns (ServerStaticAddressLoopInResponse);
|
||||
|
||||
// PushStaticAddressHtlcSigs pushes the client's htlc tx sigs to the server.
|
||||
rpc PushStaticAddressHtlcSigs (PushStaticAddressHtlcSigsRequest)
|
||||
returns (PushStaticAddressHtlcSigsResponse);
|
||||
|
||||
// FetchSweeplessSweepTx fetches the sweepless sweep tx for the client to
|
||||
// to sign it.
|
||||
rpc FetchSweeplessSweepTx (FetchSweeplessSweepTxRequest)
|
||||
returns (FetchSweeplessSweepTxResponse);
|
||||
|
||||
// PushStaticAddressSweeplessSigs pushes the client's sweepless sweep tx
|
||||
// sigs to the server.
|
||||
rpc PushStaticAddressSweeplessSigs (PushStaticAddressSweeplessSigsRequest)
|
||||
returns (PushStaticAddressSweeplessSigsResponse);
|
||||
}
|
||||
|
||||
message ServerNewAddressRequest {
|
||||
|
|
@ -733,3 +753,157 @@ message ServerWithdrawResponse {
|
|||
// The nonces that the server used to generate the sweepless sweep sigs.
|
||||
repeated bytes server_nonces = 2;
|
||||
}
|
||||
|
||||
message ServerStaticAddressLoopInRequest {
|
||||
// The client's public key for the htlc output.
|
||||
bytes htlc_client_pub_key = 1;
|
||||
|
||||
// The hashed swap invoice preimage of the swap.
|
||||
bytes swap_hash = 2;
|
||||
|
||||
// The deposit outpoints the client wishes to loop in. They implicitly state
|
||||
// the swap amount.
|
||||
repeated string deposit_outpoints = 3;
|
||||
|
||||
// The swap invoice that the client wants the server to pay.
|
||||
string swap_invoice = 4;
|
||||
|
||||
// An optional last hop the client wants to receive the invoice payment
|
||||
// from.
|
||||
bytes last_hop = 5;
|
||||
|
||||
// The protocol version that the client adheres to.
|
||||
StaticAddressProtocolVersion protocol_version = 6;
|
||||
|
||||
// The user agent string that identifies the software running on the user's
|
||||
// side. This can be changed in the user's client software but it _SHOULD_
|
||||
// conform to the following pattern:
|
||||
// Agent-Name/semver-version(/additional-info)
|
||||
// Examples:
|
||||
// loopd/v0.10.0-beta/commit=3b635821
|
||||
// litd/v0.2.0-alpha/commit=326d754
|
||||
// loopd/v0.10.0-beta/commit=3b635823,initiator=easy-autoloop
|
||||
string user_agent = 7;
|
||||
|
||||
// The swap payment timeout allows the user to specify an upper limit for
|
||||
// the amount of time the server is allowed to take to fulfill the off-chain
|
||||
// swap payment. If the timeout is reached the swap will be aborted on the
|
||||
// server side and the client can retry the swap with different parameters.
|
||||
uint32 payment_timeout_seconds = 8;
|
||||
}
|
||||
|
||||
message ServerStaticAddressLoopInResponse {
|
||||
// The server's public key for the htlc output.
|
||||
bytes htlc_server_pub_key = 1;
|
||||
|
||||
// The cltv expiry height for the htlc. This is the height at which the
|
||||
// htlc will expire and the client is free to claim the funds back.
|
||||
int32 htlc_expiry = 2;
|
||||
|
||||
// The info the server used to generate the standard fee partial htlc tx
|
||||
// sigs.
|
||||
ServerHtlcSigningInfo standard_htlc_info = 3;
|
||||
|
||||
// The info the server used to generate the high fee partial htlc tx sigs.
|
||||
ServerHtlcSigningInfo high_fee_htlc_info = 4;
|
||||
|
||||
// The info the server used to generate the extreme fee partial htlc tx
|
||||
// sigs.
|
||||
ServerHtlcSigningInfo extreme_fee_htlc_info = 5;
|
||||
}
|
||||
|
||||
message ServerHtlcSigningInfo {
|
||||
// The nonces that the server used to generate the partial htlc tx sigs.
|
||||
repeated bytes nonces = 1;
|
||||
|
||||
// The fee rate in sat/kw that the server wants to use for the htlc tx.
|
||||
uint64 fee_rate = 2;
|
||||
}
|
||||
|
||||
message PushStaticAddressHtlcSigsRequest {
|
||||
// The swap hash that the client wants to push the htlc sigs for.
|
||||
bytes swap_hash = 1;
|
||||
|
||||
// The nonces that the client used to generate the htlc sigs.
|
||||
ClientHtlcSigningInfo standard_htlc_info = 2;
|
||||
|
||||
// The nonces that the client used to generate the high fee htlc sigs.
|
||||
ClientHtlcSigningInfo high_fee_htlc_info = 3;
|
||||
|
||||
// The nonces that the client used to generate the extreme fee htlc sigs.
|
||||
ClientHtlcSigningInfo extreme_fee_htlc_info = 4;
|
||||
}
|
||||
|
||||
message ClientHtlcSigningInfo {
|
||||
// The nonces that the client used to generate the partial htlc tx sigs.
|
||||
repeated bytes nonces = 1;
|
||||
|
||||
// The musig2 htlc sigs that the client generated for the htlc tx.
|
||||
repeated bytes sigs = 2;
|
||||
}
|
||||
|
||||
message PushStaticAddressHtlcSigsResponse {
|
||||
}
|
||||
|
||||
message FetchSweeplessSweepTxRequest {
|
||||
// The swap hash of the swap that the client wants to fetch the sweepless
|
||||
// sweep tx for.
|
||||
bytes swap_hash = 1;
|
||||
}
|
||||
|
||||
message FetchSweeplessSweepTxResponse {
|
||||
// The address that the server wants to sweep the static address deposits
|
||||
// to.
|
||||
string sweep_addr = 1;
|
||||
|
||||
// The info the server used to generate the standard fee partial sweepless
|
||||
// tx sigs.
|
||||
ServerSweeplessSigningInfo standard_fee_info = 2;
|
||||
|
||||
// The info the server used to generate the high fee partial sweepless tx
|
||||
// sigs.
|
||||
ServerSweeplessSigningInfo high_fee_info = 3;
|
||||
|
||||
// The info the server used to generate the extreme fee partial sweepless tx
|
||||
// sigs.
|
||||
ServerSweeplessSigningInfo extreme_fee_info = 4;
|
||||
}
|
||||
|
||||
message ServerSweeplessSigningInfo {
|
||||
// The nonces that the server used to generate the partial sweepless tx
|
||||
// sigs.
|
||||
repeated bytes nonces = 1;
|
||||
|
||||
// The fee rate in sat/kw that the server wants to use for the sweepless tx.
|
||||
uint64 fee_rate = 2;
|
||||
}
|
||||
|
||||
message PushStaticAddressSweeplessSigsRequest {
|
||||
// The swap hash of the swap that the client wants to push the sweepless
|
||||
// sigs for.
|
||||
bytes swap_hash = 1;
|
||||
|
||||
// The info the client used to generate the standard fee partial sweepless
|
||||
// tx sigs.
|
||||
ClientSweeplessSigningInfo standard_signing_info = 2;
|
||||
|
||||
// The info the client used to generate the high fee partial sweepless tx
|
||||
// sigs.
|
||||
ClientSweeplessSigningInfo high_fee_signing_info = 3;
|
||||
|
||||
// The info the client used to generate the extreme fee partial sweepless
|
||||
// tx sigs.
|
||||
ClientSweeplessSigningInfo extreme_fee_signing_info = 4;
|
||||
}
|
||||
|
||||
message ClientSweeplessSigningInfo {
|
||||
// The nonces that the client used to generate the partial sweepless tx
|
||||
// sigs.
|
||||
repeated bytes nonces = 1;
|
||||
|
||||
// The musig2 htlc sigs that the client generated for the sweepless tx.
|
||||
repeated bytes sigs = 2;
|
||||
}
|
||||
|
||||
message PushStaticAddressSweeplessSigsResponse {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -774,6 +774,18 @@ type StaticAddressServerClient interface {
|
|||
// haven't timed out yet to the client's wallet. The server will generate
|
||||
// the partial sigs for the client's selected deposits.
|
||||
ServerWithdrawDeposits(ctx context.Context, in *ServerWithdrawRequest, opts ...grpc.CallOption) (*ServerWithdrawResponse, error)
|
||||
// ServerStaticAddressLoopIn initiates a static address loop-in swap. The
|
||||
// server will respond with htlc details that the client can use to
|
||||
// construct and sign the htlc tx.
|
||||
ServerStaticAddressLoopIn(ctx context.Context, in *ServerStaticAddressLoopInRequest, opts ...grpc.CallOption) (*ServerStaticAddressLoopInResponse, error)
|
||||
// PushStaticAddressHtlcSigs pushes the client's htlc tx sigs to the server.
|
||||
PushStaticAddressHtlcSigs(ctx context.Context, in *PushStaticAddressHtlcSigsRequest, opts ...grpc.CallOption) (*PushStaticAddressHtlcSigsResponse, error)
|
||||
// FetchSweeplessSweepTx fetches the sweepless sweep tx for the client to
|
||||
// to sign it.
|
||||
FetchSweeplessSweepTx(ctx context.Context, in *FetchSweeplessSweepTxRequest, opts ...grpc.CallOption) (*FetchSweeplessSweepTxResponse, error)
|
||||
// PushStaticAddressSweeplessSigs pushes the client's sweepless sweep tx
|
||||
// sigs to the server.
|
||||
PushStaticAddressSweeplessSigs(ctx context.Context, in *PushStaticAddressSweeplessSigsRequest, opts ...grpc.CallOption) (*PushStaticAddressSweeplessSigsResponse, error)
|
||||
}
|
||||
|
||||
type staticAddressServerClient struct {
|
||||
|
|
@ -802,6 +814,42 @@ func (c *staticAddressServerClient) ServerWithdrawDeposits(ctx context.Context,
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staticAddressServerClient) ServerStaticAddressLoopIn(ctx context.Context, in *ServerStaticAddressLoopInRequest, opts ...grpc.CallOption) (*ServerStaticAddressLoopInResponse, error) {
|
||||
out := new(ServerStaticAddressLoopInResponse)
|
||||
err := c.cc.Invoke(ctx, "/looprpc.StaticAddressServer/ServerStaticAddressLoopIn", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staticAddressServerClient) PushStaticAddressHtlcSigs(ctx context.Context, in *PushStaticAddressHtlcSigsRequest, opts ...grpc.CallOption) (*PushStaticAddressHtlcSigsResponse, error) {
|
||||
out := new(PushStaticAddressHtlcSigsResponse)
|
||||
err := c.cc.Invoke(ctx, "/looprpc.StaticAddressServer/PushStaticAddressHtlcSigs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staticAddressServerClient) FetchSweeplessSweepTx(ctx context.Context, in *FetchSweeplessSweepTxRequest, opts ...grpc.CallOption) (*FetchSweeplessSweepTxResponse, error) {
|
||||
out := new(FetchSweeplessSweepTxResponse)
|
||||
err := c.cc.Invoke(ctx, "/looprpc.StaticAddressServer/FetchSweeplessSweepTx", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staticAddressServerClient) PushStaticAddressSweeplessSigs(ctx context.Context, in *PushStaticAddressSweeplessSigsRequest, opts ...grpc.CallOption) (*PushStaticAddressSweeplessSigsResponse, error) {
|
||||
out := new(PushStaticAddressSweeplessSigsResponse)
|
||||
err := c.cc.Invoke(ctx, "/looprpc.StaticAddressServer/PushStaticAddressSweeplessSigs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// StaticAddressServerServer is the server API for StaticAddressServer service.
|
||||
// All implementations must embed UnimplementedStaticAddressServerServer
|
||||
// for forward compatibility
|
||||
|
|
@ -814,6 +862,18 @@ type StaticAddressServerServer interface {
|
|||
// haven't timed out yet to the client's wallet. The server will generate
|
||||
// the partial sigs for the client's selected deposits.
|
||||
ServerWithdrawDeposits(context.Context, *ServerWithdrawRequest) (*ServerWithdrawResponse, error)
|
||||
// ServerStaticAddressLoopIn initiates a static address loop-in swap. The
|
||||
// server will respond with htlc details that the client can use to
|
||||
// construct and sign the htlc tx.
|
||||
ServerStaticAddressLoopIn(context.Context, *ServerStaticAddressLoopInRequest) (*ServerStaticAddressLoopInResponse, error)
|
||||
// PushStaticAddressHtlcSigs pushes the client's htlc tx sigs to the server.
|
||||
PushStaticAddressHtlcSigs(context.Context, *PushStaticAddressHtlcSigsRequest) (*PushStaticAddressHtlcSigsResponse, error)
|
||||
// FetchSweeplessSweepTx fetches the sweepless sweep tx for the client to
|
||||
// to sign it.
|
||||
FetchSweeplessSweepTx(context.Context, *FetchSweeplessSweepTxRequest) (*FetchSweeplessSweepTxResponse, error)
|
||||
// PushStaticAddressSweeplessSigs pushes the client's sweepless sweep tx
|
||||
// sigs to the server.
|
||||
PushStaticAddressSweeplessSigs(context.Context, *PushStaticAddressSweeplessSigsRequest) (*PushStaticAddressSweeplessSigsResponse, error)
|
||||
mustEmbedUnimplementedStaticAddressServerServer()
|
||||
}
|
||||
|
||||
|
|
@ -827,6 +887,18 @@ func (UnimplementedStaticAddressServerServer) ServerNewAddress(context.Context,
|
|||
func (UnimplementedStaticAddressServerServer) ServerWithdrawDeposits(context.Context, *ServerWithdrawRequest) (*ServerWithdrawResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ServerWithdrawDeposits not implemented")
|
||||
}
|
||||
func (UnimplementedStaticAddressServerServer) ServerStaticAddressLoopIn(context.Context, *ServerStaticAddressLoopInRequest) (*ServerStaticAddressLoopInResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ServerStaticAddressLoopIn not implemented")
|
||||
}
|
||||
func (UnimplementedStaticAddressServerServer) PushStaticAddressHtlcSigs(context.Context, *PushStaticAddressHtlcSigsRequest) (*PushStaticAddressHtlcSigsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PushStaticAddressHtlcSigs not implemented")
|
||||
}
|
||||
func (UnimplementedStaticAddressServerServer) FetchSweeplessSweepTx(context.Context, *FetchSweeplessSweepTxRequest) (*FetchSweeplessSweepTxResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FetchSweeplessSweepTx not implemented")
|
||||
}
|
||||
func (UnimplementedStaticAddressServerServer) PushStaticAddressSweeplessSigs(context.Context, *PushStaticAddressSweeplessSigsRequest) (*PushStaticAddressSweeplessSigsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PushStaticAddressSweeplessSigs not implemented")
|
||||
}
|
||||
func (UnimplementedStaticAddressServerServer) mustEmbedUnimplementedStaticAddressServerServer() {}
|
||||
|
||||
// UnsafeStaticAddressServerServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
|
@ -876,6 +948,78 @@ func _StaticAddressServer_ServerWithdrawDeposits_Handler(srv interface{}, ctx co
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StaticAddressServer_ServerStaticAddressLoopIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ServerStaticAddressLoopInRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StaticAddressServerServer).ServerStaticAddressLoopIn(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/looprpc.StaticAddressServer/ServerStaticAddressLoopIn",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StaticAddressServerServer).ServerStaticAddressLoopIn(ctx, req.(*ServerStaticAddressLoopInRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StaticAddressServer_PushStaticAddressHtlcSigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PushStaticAddressHtlcSigsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StaticAddressServerServer).PushStaticAddressHtlcSigs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/looprpc.StaticAddressServer/PushStaticAddressHtlcSigs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StaticAddressServerServer).PushStaticAddressHtlcSigs(ctx, req.(*PushStaticAddressHtlcSigsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StaticAddressServer_FetchSweeplessSweepTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FetchSweeplessSweepTxRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StaticAddressServerServer).FetchSweeplessSweepTx(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/looprpc.StaticAddressServer/FetchSweeplessSweepTx",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StaticAddressServerServer).FetchSweeplessSweepTx(ctx, req.(*FetchSweeplessSweepTxRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StaticAddressServer_PushStaticAddressSweeplessSigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PushStaticAddressSweeplessSigsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StaticAddressServerServer).PushStaticAddressSweeplessSigs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/looprpc.StaticAddressServer/PushStaticAddressSweeplessSigs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StaticAddressServerServer).PushStaticAddressSweeplessSigs(ctx, req.(*PushStaticAddressSweeplessSigsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// StaticAddressServer_ServiceDesc is the grpc.ServiceDesc for StaticAddressServer service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
|
@ -891,6 +1035,22 @@ var StaticAddressServer_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "ServerWithdrawDeposits",
|
||||
Handler: _StaticAddressServer_ServerWithdrawDeposits_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ServerStaticAddressLoopIn",
|
||||
Handler: _StaticAddressServer_ServerStaticAddressLoopIn_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PushStaticAddressHtlcSigs",
|
||||
Handler: _StaticAddressServer_PushStaticAddressHtlcSigs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "FetchSweeplessSweepTx",
|
||||
Handler: _StaticAddressServer_FetchSweeplessSweepTx_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PushStaticAddressSweeplessSigs",
|
||||
Handler: _StaticAddressServer_PushStaticAddressSweeplessSigs_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "server.proto",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue