diff --git a/client.go b/client.go index 73c01bd..ae45e9d 100644 --- a/client.go +++ b/client.go @@ -56,7 +56,7 @@ var ( // globalCallTimeout is the maximum time any call of the client to the // server is allowed to take, including the time it may take to get - // and pay for an LSAT token. + // and pay for an L402 token. globalCallTimeout = serverRPCTimeout + l402.PaymentTimeout // probeTimeout is the maximum time until a probe is allowed to take. @@ -111,13 +111,13 @@ type ClientConfig struct { // Lnd is an instance of the lnd proxy. Lnd *lndclient.LndServices - // MaxLsatCost is the maximum price we are willing to pay to the server + // MaxL402Cost is the maximum price we are willing to pay to the server // for the token. - MaxLsatCost btcutil.Amount + MaxL402Cost btcutil.Amount - // MaxLsatFee is the maximum that we are willing to pay in routing fees + // MaxL402Fee is the maximum that we are willing to pay in routing fees // to obtain the token. - MaxLsatFee btcutil.Amount + MaxL402Fee btcutil.Amount // LoopOutMaxParts defines the maximum number of parts that may be used // for a loop out swap. When greater than one, a multi-part payment may @@ -138,12 +138,12 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore, sweeperDb sweepbatcher.BatcherStore, cfg *ClientConfig) ( *Client, func(), error) { - lsatStore, err := l402.NewFileStore(dbDir) + l402Store, err := l402.NewFileStore(dbDir) if err != nil { return nil, nil, err } - swapServerClient, err := newSwapServerClient(cfg, lsatStore) + swapServerClient, err := newSwapServerClient(cfg, l402Store) if err != nil { return nil, nil, err } @@ -153,7 +153,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore, Server: swapServerClient, Store: loopDB, Conn: swapServerClient.conn, - LsatStore: lsatStore, + L402Store: l402Store, CreateExpiryTimer: func(d time.Duration) <-chan time.Time { return time.NewTimer(d).C }, diff --git a/cmd/loop/lsat.go b/cmd/loop/l402.go similarity index 92% rename from cmd/loop/lsat.go rename to cmd/loop/l402.go index 8342b3d..fa7428f 100644 --- a/cmd/loop/lsat.go +++ b/cmd/loop/l402.go @@ -26,8 +26,8 @@ type printableToken struct { var listAuthCommand = cli.Command{ Name: "listauth", - Usage: "list all LSAT tokens", - Description: "Shows a list of all LSAT tokens that loopd has paid for", + Usage: "list all L402 tokens", + Description: "Shows a list of all L402 tokens that loopd has paid for", Action: listAuth, } @@ -38,7 +38,7 @@ func listAuth(ctx *cli.Context) error { } defer cleanup() - resp, err := client.GetLsatTokens( + resp, err := client.GetL402Tokens( context.Background(), &looprpc.TokensRequest{}, ) if err != nil { diff --git a/config.go b/config.go index 7501a56..6cf47c1 100644 --- a/config.go +++ b/config.go @@ -15,7 +15,7 @@ type clientConfig struct { Server swapServerClient Conn *grpc.ClientConn Store loopdb.SwapStore - LsatStore l402.Store + L402Store l402.Store CreateExpiryTimer func(expiry time.Duration) <-chan time.Time LoopOutMaxParts uint32 } diff --git a/instantout/reservation/manager.go b/instantout/reservation/manager.go index 6f55249..35f80ec 100644 --- a/instantout/reservation/manager.go +++ b/instantout/reservation/manager.go @@ -185,7 +185,7 @@ func (m *Manager) fetchL402(ctx context.Context) { func (m *Manager) RegisterReservationNotifications( reservationChan chan *reservationrpc.ServerReservationNotification) error { - // In order to create a valid lsat we first are going to call + // In order to create a valid l402 we first are going to call // the FetchL402 method. As a client might not have outbound capacity // yet, we'll retry until we get a valid response. if !m.hasL402 { diff --git a/loopd/config.go b/loopd/config.go index 877e472..24def35 100644 --- a/loopd/config.go +++ b/loopd/config.go @@ -160,8 +160,8 @@ type Config struct { MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB."` DebugLevel string `long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify =,=,... to set the log level for individual subsystems -- Use show to list available subsystems"` - MaxLSATCost uint32 `long:"maxlsatcost" description:"Maximum cost in satoshis that loopd is going to pay for an LSAT token automatically. Does not include routing fees."` - MaxLSATFee uint32 `long:"maxlsatfee" description:"Maximum routing fee in satoshis that we are willing to pay while paying for an LSAT token."` + MaxL402Cost uint32 `long:"maxl402cost" description:"Maximum cost in satoshis that loopd is going to pay for an L402 token automatically. Does not include routing fees."` + MaxL402Fee uint32 `long:"maxl402fee" description:"Maximum routing fee in satoshis that we are willing to pay while paying for an L402 token."` LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."` @@ -206,8 +206,8 @@ func DefaultConfig() Config { TLSKeyPath: DefaultTLSKeyPath, TLSValidity: DefaultAutogenValidity, MacaroonPath: DefaultMacaroonPath, - MaxLSATCost: l402.DefaultMaxCostSats, - MaxLSATFee: l402.DefaultMaxRoutingFeeSats, + MaxL402Cost: l402.DefaultMaxCostSats, + MaxL402Fee: l402.DefaultMaxRoutingFeeSats, LoopOutMaxParts: defaultLoopOutMaxParts, TotalPaymentTimeout: defaultTotalPaymentTimeout, MaxPaymentRetries: defaultMaxPaymentRetries, diff --git a/loopd/perms/perms.go b/loopd/perms/perms.go index 138ed79..b33d55f 100644 --- a/loopd/perms/perms.go +++ b/loopd/perms/perms.go @@ -69,7 +69,7 @@ var RequiredPermissions = map[string][]bakery.Op{ Entity: "loop", Action: "in", }}, - "/looprpc.SwapClient/GetLsatTokens": {{ + "/looprpc.SwapClient/GetL402Tokens": {{ Entity: "auth", Action: "read", }}, diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index ef9cf81..924bd37 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -920,18 +920,18 @@ func (s *swapClientServer) LoopIn(ctx context.Context, return response, nil } -// GetLsatTokens returns all tokens that are contained in the LSAT token store. -func (s *swapClientServer) GetLsatTokens(ctx context.Context, +// GetL402Tokens returns all tokens that are contained in the L402 token store. +func (s *swapClientServer) GetL402Tokens(ctx context.Context, _ *clientrpc.TokensRequest) (*clientrpc.TokensResponse, error) { - log.Infof("Get LSAT tokens request received") + log.Infof("Get L402 tokens request received") - tokens, err := s.impl.LsatStore.AllTokens() + tokens, err := s.impl.L402Store.AllTokens() if err != nil { return nil, err } - rpcTokens := make([]*clientrpc.LsatToken, len(tokens)) + rpcTokens := make([]*clientrpc.L402Token, len(tokens)) idx := 0 for key, token := range tokens { macBytes, err := token.BaseMacaroon().MarshalBinary() @@ -945,7 +945,7 @@ func (s *swapClientServer) GetLsatTokens(ctx context.Context, if err != nil { return nil, err } - rpcTokens[idx] = &clientrpc.LsatToken{ + rpcTokens[idx] = &clientrpc.L402Token{ BaseMacaroon: macBytes, PaymentHash: token.PaymentHash[:], PaymentPreimage: token.Preimage[:], diff --git a/loopd/utils.go b/loopd/utils.go index 9388a23..b8b9119 100644 --- a/loopd/utils.go +++ b/loopd/utils.go @@ -27,8 +27,8 @@ func getClient(cfg *Config, swapDb loopdb.SwapStore, SwapServerNoTLS: cfg.Server.NoTLS, TLSPathServer: cfg.Server.TLSPath, Lnd: lnd, - MaxLsatCost: btcutil.Amount(cfg.MaxLSATCost), - MaxLsatFee: btcutil.Amount(cfg.MaxLSATFee), + MaxL402Cost: btcutil.Amount(cfg.MaxL402Cost), + MaxL402Fee: btcutil.Amount(cfg.MaxL402Fee), LoopOutMaxParts: cfg.LoopOutMaxParts, TotalPaymentTimeout: cfg.TotalPaymentTimeout, MaxPaymentRetries: cfg.MaxPaymentRetries, diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index c498a64..ef0f14f 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -2074,7 +2074,7 @@ type TokensResponse struct { unknownFields protoimpl.UnknownFields // List of all tokens the daemon knows of, including old/expired tokens. - Tokens []*LsatToken `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` + Tokens []*L402Token `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` } func (x *TokensResponse) Reset() { @@ -2109,14 +2109,14 @@ func (*TokensResponse) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{18} } -func (x *TokensResponse) GetTokens() []*LsatToken { +func (x *TokensResponse) GetTokens() []*L402Token { if x != nil { return x.Tokens } return nil } -type LsatToken struct { +type L402Token struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2144,8 +2144,8 @@ type LsatToken struct { Id string `protobuf:"bytes,9,opt,name=id,proto3" json:"id,omitempty"` } -func (x *LsatToken) Reset() { - *x = LsatToken{} +func (x *L402Token) Reset() { + *x = L402Token{} if protoimpl.UnsafeEnabled { mi := &file_client_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2153,13 +2153,13 @@ func (x *LsatToken) Reset() { } } -func (x *LsatToken) String() string { +func (x *L402Token) String() string { return protoimpl.X.MessageStringOf(x) } -func (*LsatToken) ProtoMessage() {} +func (*L402Token) ProtoMessage() {} -func (x *LsatToken) ProtoReflect() protoreflect.Message { +func (x *L402Token) ProtoReflect() protoreflect.Message { mi := &file_client_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2171,68 +2171,68 @@ func (x *LsatToken) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use LsatToken.ProtoReflect.Descriptor instead. -func (*LsatToken) Descriptor() ([]byte, []int) { +// Deprecated: Use L402Token.ProtoReflect.Descriptor instead. +func (*L402Token) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{19} } -func (x *LsatToken) GetBaseMacaroon() []byte { +func (x *L402Token) GetBaseMacaroon() []byte { if x != nil { return x.BaseMacaroon } return nil } -func (x *LsatToken) GetPaymentHash() []byte { +func (x *L402Token) GetPaymentHash() []byte { if x != nil { return x.PaymentHash } return nil } -func (x *LsatToken) GetPaymentPreimage() []byte { +func (x *L402Token) GetPaymentPreimage() []byte { if x != nil { return x.PaymentPreimage } return nil } -func (x *LsatToken) GetAmountPaidMsat() int64 { +func (x *L402Token) GetAmountPaidMsat() int64 { if x != nil { return x.AmountPaidMsat } return 0 } -func (x *LsatToken) GetRoutingFeePaidMsat() int64 { +func (x *L402Token) GetRoutingFeePaidMsat() int64 { if x != nil { return x.RoutingFeePaidMsat } return 0 } -func (x *LsatToken) GetTimeCreated() int64 { +func (x *L402Token) GetTimeCreated() int64 { if x != nil { return x.TimeCreated } return 0 } -func (x *LsatToken) GetExpired() bool { +func (x *L402Token) GetExpired() bool { if x != nil { return x.Expired } return false } -func (x *LsatToken) GetStorageName() string { +func (x *L402Token) GetStorageName() string { if x != nil { return x.StorageName } return "" } -func (x *LsatToken) GetId() string { +func (x *L402Token) GetId() string { if x != nil { return x.Id } @@ -4100,8 +4100,8 @@ var file_client_proto_rawDesc = []byte{ 0x75, 0x65, 0x73, 0x74, 0x22, 0x3c, 0x0a, 0x0e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x73, 0x22, 0xcb, 0x02, 0x0a, 0x09, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x2e, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x22, 0xcb, 0x02, 0x0a, 0x09, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, @@ -4455,7 +4455,7 @@ var file_client_proto_rawDesc = []byte{ 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x73, 0x61, 0x74, 0x54, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, @@ -4547,7 +4547,7 @@ var file_client_proto_goTypes = []interface{}{ (*ProbeResponse)(nil), // 23: looprpc.ProbeResponse (*TokensRequest)(nil), // 24: looprpc.TokensRequest (*TokensResponse)(nil), // 25: looprpc.TokensResponse - (*LsatToken)(nil), // 26: looprpc.LsatToken + (*L402Token)(nil), // 26: looprpc.L402Token (*LoopStats)(nil), // 27: looprpc.LoopStats (*GetInfoRequest)(nil), // 28: looprpc.GetInfoRequest (*GetInfoResponse)(nil), // 29: looprpc.GetInfoResponse @@ -4584,7 +4584,7 @@ var file_client_proto_depIdxs = []int32{ 11, // 7: looprpc.ListSwapsResponse.swaps:type_name -> looprpc.SwapStatus 50, // 8: looprpc.QuoteRequest.loop_in_route_hints:type_name -> looprpc.RouteHint 50, // 9: looprpc.ProbeRequest.route_hints:type_name -> looprpc.RouteHint - 26, // 10: looprpc.TokensResponse.tokens:type_name -> looprpc.LsatToken + 26, // 10: looprpc.TokensResponse.tokens:type_name -> looprpc.L402Token 27, // 11: looprpc.GetInfoResponse.loop_out_stats:type_name -> looprpc.LoopStats 27, // 12: looprpc.GetInfoResponse.loop_in_stats:type_name -> looprpc.LoopStats 32, // 13: looprpc.LiquidityParameters.rules:type_name -> looprpc.LiquidityRule @@ -4609,7 +4609,7 @@ var file_client_proto_depIdxs = []int32{ 16, // 32: looprpc.SwapClient.GetLoopInTerms:input_type -> looprpc.TermsRequest 19, // 33: looprpc.SwapClient.GetLoopInQuote:input_type -> looprpc.QuoteRequest 22, // 34: looprpc.SwapClient.Probe:input_type -> looprpc.ProbeRequest - 24, // 35: looprpc.SwapClient.GetLsatTokens:input_type -> looprpc.TokensRequest + 24, // 35: looprpc.SwapClient.GetL402Tokens:input_type -> looprpc.TokensRequest 28, // 36: looprpc.SwapClient.GetInfo:input_type -> looprpc.GetInfoRequest 30, // 37: looprpc.SwapClient.GetLiquidityParams:input_type -> looprpc.GetLiquidityParamsRequest 33, // 38: looprpc.SwapClient.SetLiquidityParams:input_type -> looprpc.SetLiquidityParamsRequest @@ -4629,7 +4629,7 @@ var file_client_proto_depIdxs = []int32{ 17, // 52: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse 20, // 53: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse 23, // 54: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse - 25, // 55: looprpc.SwapClient.GetLsatTokens:output_type -> looprpc.TokensResponse + 25, // 55: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse 29, // 56: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse 31, // 57: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters 34, // 58: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse @@ -4880,7 +4880,7 @@ func file_client_proto_init() { } } file_client_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LsatToken); i { + switch v := v.(*L402Token); i { case 0: return &v.state case 1: diff --git a/looprpc/client.pb.gw.go b/looprpc/client.pb.gw.go index 4ec7a66..f6f9e5f 100644 --- a/looprpc/client.pb.gw.go +++ b/looprpc/client.pb.gw.go @@ -433,20 +433,20 @@ func local_request_SwapClient_Probe_0(ctx context.Context, marshaler runtime.Mar } -func request_SwapClient_GetLsatTokens_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_SwapClient_GetL402Tokens_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq TokensRequest var metadata runtime.ServerMetadata - msg, err := client.GetLsatTokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetL402Tokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_SwapClient_GetLsatTokens_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_SwapClient_GetL402Tokens_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq TokensRequest var metadata runtime.ServerMetadata - msg, err := server.GetLsatTokens(ctx, &protoReq) + msg, err := server.GetL402Tokens(ctx, &protoReq) return msg, metadata, err } @@ -770,7 +770,7 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) - mux.Handle("GET", pattern_SwapClient_GetLsatTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -778,12 +778,12 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/looprpc.SwapClient/GetLsatTokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/l402/tokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SwapClient_GetLsatTokens_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_SwapClient_GetL402Tokens_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -791,7 +791,7 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, return } - forward_SwapClient_GetLsatTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_SwapClient_GetL402Tokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1134,25 +1134,25 @@ func RegisterSwapClientHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) - mux.Handle("GET", pattern_SwapClient_GetLsatTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/looprpc.SwapClient/GetLsatTokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/l402/tokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SwapClient_GetLsatTokens_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_SwapClient_GetL402Tokens_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_SwapClient_GetLsatTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_SwapClient_GetL402Tokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1266,7 +1266,7 @@ var ( pattern_SwapClient_Probe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "loop", "in", "probe", "amt"}, "")) - pattern_SwapClient_GetLsatTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lsat", "tokens"}, "")) + pattern_SwapClient_GetL402Tokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "l402", "tokens"}, "")) pattern_SwapClient_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "info"}, "")) @@ -1296,7 +1296,7 @@ var ( forward_SwapClient_Probe_0 = runtime.ForwardResponseMessage - forward_SwapClient_GetLsatTokens_0 = runtime.ForwardResponseMessage + forward_SwapClient_GetL402Tokens_0 = runtime.ForwardResponseMessage forward_SwapClient_GetInfo_0 = runtime.ForwardResponseMessage diff --git a/looprpc/client.proto b/looprpc/client.proto index 8687b93..d70094c 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -76,9 +76,9 @@ service SwapClient { rpc Probe (ProbeRequest) returns (ProbeResponse); /* loop: `listauth` - GetLsatTokens returns all LSAT tokens the daemon ever paid for. + GetL402Tokens returns all L402 tokens the daemon ever paid for. */ - rpc GetLsatTokens (TokensRequest) returns (TokensResponse); + rpc GetL402Tokens (TokensRequest) returns (TokensResponse); /* loop: `getinfo` GetInfo gets basic information about the loop daemon. @@ -811,10 +811,10 @@ message TokensResponse { /* List of all tokens the daemon knows of, including old/expired tokens. */ - repeated LsatToken tokens = 1; + repeated L402Token tokens = 1; } -message LsatToken { +message L402Token { /* The base macaroon that was baked by the auth server. */ diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index d058957..2cc3b85 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -39,6 +39,29 @@ ] } }, + "/v1/l402/tokens": { + "get": { + "summary": "loop: `listauth`\nGetL402Tokens returns all L402 tokens the daemon ever paid for.", + "operationId": "SwapClient_GetL402Tokens", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/looprpcTokensResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "SwapClient" + ] + } + }, "/v1/liquidity/params": { "get": { "summary": "loop: `getparams`\nGetLiquidityParams gets the parameters that the daemon's liquidity manager\nis currently configured with. This may be nil if nothing is configured.\n[EXPERIMENTAL]: endpoint is subject to change.", @@ -515,29 +538,6 @@ "SwapClient" ] } - }, - "/v1/lsat/tokens": { - "get": { - "summary": "loop: `listauth`\nGetLsatTokens returns all LSAT tokens the daemon ever paid for.", - "operationId": "SwapClient_GetLsatTokens", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/looprpcTokensResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "tags": [ - "SwapClient" - ] - } } }, "definitions": { @@ -824,6 +824,53 @@ } } }, + "looprpcL402Token": { + "type": "object", + "properties": { + "base_macaroon": { + "type": "string", + "format": "byte", + "description": "The base macaroon that was baked by the auth server." + }, + "payment_hash": { + "type": "string", + "format": "byte", + "description": "The payment hash of the payment that was paid to obtain the token." + }, + "payment_preimage": { + "type": "string", + "format": "byte", + "description": "The preimage of the payment hash, knowledge of this is proof that the\npayment has been paid. If the preimage is set to all zeros, this means the\npayment is still pending and the token is not yet fully valid." + }, + "amount_paid_msat": { + "type": "string", + "format": "int64", + "description": "The amount of millisatoshis that was paid to get the token." + }, + "routing_fee_paid_msat": { + "type": "string", + "format": "int64", + "description": "The amount of millisatoshis paid in routing fee to pay for the token." + }, + "time_created": { + "type": "string", + "format": "int64", + "description": "The creation time of the token as UNIX timestamp in seconds." + }, + "expired": { + "type": "boolean", + "description": "Indicates whether the token is expired or still valid." + }, + "storage_name": { + "type": "string", + "description": "Identifying attribute of this token in the store. Currently represents the\nfile name of the token where it's stored on the file system." + }, + "id": { + "type": "string", + "description": "The l402 ID of the token." + } + } + }, "looprpcLiquidityParameters": { "type": "object", "properties": { @@ -1231,53 +1278,6 @@ } } }, - "looprpcLsatToken": { - "type": "object", - "properties": { - "base_macaroon": { - "type": "string", - "format": "byte", - "description": "The base macaroon that was baked by the auth server." - }, - "payment_hash": { - "type": "string", - "format": "byte", - "description": "The payment hash of the payment that was paid to obtain the token." - }, - "payment_preimage": { - "type": "string", - "format": "byte", - "description": "The preimage of the payment hash, knowledge of this is proof that the\npayment has been paid. If the preimage is set to all zeros, this means the\npayment is still pending and the token is not yet fully valid." - }, - "amount_paid_msat": { - "type": "string", - "format": "int64", - "description": "The amount of millisatoshis that was paid to get the token." - }, - "routing_fee_paid_msat": { - "type": "string", - "format": "int64", - "description": "The amount of millisatoshis paid in routing fee to pay for the token." - }, - "time_created": { - "type": "string", - "format": "int64", - "description": "The creation time of the token as UNIX timestamp in seconds." - }, - "expired": { - "type": "boolean", - "description": "Indicates whether the token is expired or still valid." - }, - "storage_name": { - "type": "string", - "description": "Identifying attribute of this token in the store. Currently represents the\nfile name of the token where it's stored on the file system." - }, - "id": { - "type": "string", - "description": "The l402 ID of the token." - } - } - }, "looprpcOutQuoteResponse": { "type": "object", "properties": { @@ -1534,7 +1534,7 @@ "tokens": { "type": "array", "items": { - "$ref": "#/definitions/looprpcLsatToken" + "$ref": "#/definitions/looprpcL402Token" }, "description": "List of all tokens the daemon knows of, including old/expired tokens." } diff --git a/looprpc/client.yaml b/looprpc/client.yaml index 188a6a2..3eb09ec 100644 --- a/looprpc/client.yaml +++ b/looprpc/client.yaml @@ -26,8 +26,8 @@ http: get: "/v1/loop/in/probe/{amt}" - selector: looprpc.SwapClient.GetInfo get: "/v1/loop/info" - - selector: looprpc.SwapClient.GetLsatTokens - get: "/v1/lsat/tokens" + - selector: looprpc.SwapClient.GetL402Tokens + get: "/v1/l402/tokens" - selector: looprpc.SwapClient.GetLiquidityParams get: "/v1/liquidity/params" - selector: looprpc.SwapClient.SetLiquidityParams diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index 4c35e42..34aafe1 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -60,8 +60,8 @@ type SwapClientClient interface { // estimate about routing fees when loopin-in. Probe(ctx context.Context, in *ProbeRequest, opts ...grpc.CallOption) (*ProbeResponse, error) // loop: `listauth` - // GetLsatTokens returns all LSAT tokens the daemon ever paid for. - GetLsatTokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) + // GetL402Tokens returns all L402 tokens the daemon ever paid for. + GetL402Tokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) // loop: `getinfo` // GetInfo gets basic information about the loop daemon. GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) @@ -228,9 +228,9 @@ func (c *swapClientClient) Probe(ctx context.Context, in *ProbeRequest, opts ... return out, nil } -func (c *swapClientClient) GetLsatTokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) { +func (c *swapClientClient) GetL402Tokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) { out := new(TokensResponse) - err := c.cc.Invoke(ctx, "/looprpc.SwapClient/GetLsatTokens", in, out, opts...) + err := c.cc.Invoke(ctx, "/looprpc.SwapClient/GetL402Tokens", in, out, opts...) if err != nil { return nil, err } @@ -355,8 +355,8 @@ type SwapClientServer interface { // estimate about routing fees when loopin-in. Probe(context.Context, *ProbeRequest) (*ProbeResponse, error) // loop: `listauth` - // GetLsatTokens returns all LSAT tokens the daemon ever paid for. - GetLsatTokens(context.Context, *TokensRequest) (*TokensResponse, error) + // GetL402Tokens returns all L402 tokens the daemon ever paid for. + GetL402Tokens(context.Context, *TokensRequest) (*TokensResponse, error) // loop: `getinfo` // GetInfo gets basic information about the loop daemon. GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) @@ -431,8 +431,8 @@ func (UnimplementedSwapClientServer) GetLoopInQuote(context.Context, *QuoteReque func (UnimplementedSwapClientServer) Probe(context.Context, *ProbeRequest) (*ProbeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Probe not implemented") } -func (UnimplementedSwapClientServer) GetLsatTokens(context.Context, *TokensRequest) (*TokensResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetLsatTokens not implemented") +func (UnimplementedSwapClientServer) GetL402Tokens(context.Context, *TokensRequest) (*TokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetL402Tokens not implemented") } func (UnimplementedSwapClientServer) GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented") @@ -672,20 +672,20 @@ func _SwapClient_Probe_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _SwapClient_GetLsatTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _SwapClient_GetL402Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(TokensRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SwapClientServer).GetLsatTokens(ctx, in) + return srv.(SwapClientServer).GetL402Tokens(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/looprpc.SwapClient/GetLsatTokens", + FullMethod: "/looprpc.SwapClient/GetL402Tokens", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SwapClientServer).GetLsatTokens(ctx, req.(*TokensRequest)) + return srv.(SwapClientServer).GetL402Tokens(ctx, req.(*TokensRequest)) } return interceptor(ctx, in, info, handler) } @@ -882,8 +882,8 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ Handler: _SwapClient_Probe_Handler, }, { - MethodName: "GetLsatTokens", - Handler: _SwapClient_GetLsatTokens_Handler, + MethodName: "GetL402Tokens", + Handler: _SwapClient_GetL402Tokens_Handler, }, { MethodName: "GetInfo", diff --git a/looprpc/swapclient.pb.json.go b/looprpc/swapclient.pb.json.go index a715cdd..cece43e 100644 --- a/looprpc/swapclient.pb.json.go +++ b/looprpc/swapclient.pb.json.go @@ -313,7 +313,7 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex callback(string(respBytes), nil) } - registry["looprpc.SwapClient.GetLsatTokens"] = func(ctx context.Context, + registry["looprpc.SwapClient.GetL402Tokens"] = func(ctx context.Context, conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { req := &TokensRequest{} @@ -324,7 +324,7 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex } client := NewSwapClientClient(conn) - resp, err := client.GetLsatTokens(ctx, req) + resp, err := client.GetL402Tokens(ctx, req) if err != nil { callback("", err) return diff --git a/release_notes.md b/release_notes.md index 38afc60..056aa18 100644 --- a/release_notes.md +++ b/release_notes.md @@ -18,6 +18,14 @@ This file tracks release notes for the loop client. #### Breaking Changes +In loopd.conf file `maxlsatcost` and `maxlsatfee` were renamed to `maxl402cost` +and `maxl402fee` accordingly. If they have been changed locally, the file has +to be updated for loopd to recognize the options. + +The path in looprpc "/v1/lsat/tokens" was renamed to "/v1/l402/tokens" and +the corresponding method was renamed from `GetLsatTokens` to `GetL402Tokens`. +Update `loop` and `loopd` simultaneously otherwise this RPC won't work. + #### Bug Fixes #### Maintenance diff --git a/sample-loopd.conf b/sample-loopd.conf index ae1e165..a0ca7b9 100644 --- a/sample-loopd.conf +++ b/sample-loopd.conf @@ -86,11 +86,11 @@ ; Maximum cost in satoshis that loopd is going to pay for an L402 token ; automatically. Does not include routing fees. -; maxlsatcost=1000 +; maxl402cost=1000 ; Maximum routing fee in satoshis that we are willing to pay while paying for an ; L402 token. -; maxlsatfee=10 +; maxl402fee=10 ; The maximum number of payment parts that may be used for a loop out swap. ; loopoutmaxparts=5 diff --git a/swap_server_client.go b/swap_server_client.go index 32708ad..60150ca 100644 --- a/swap_server_client.go +++ b/swap_server_client.go @@ -161,14 +161,14 @@ func (s *grpcSwapServerClient) stop() { var _ swapServerClient = (*grpcSwapServerClient)(nil) -func newSwapServerClient(cfg *ClientConfig, lsatStore l402.Store) ( +func newSwapServerClient(cfg *ClientConfig, l402Store l402.Store) ( *grpcSwapServerClient, error) { // Create the server connection with the interceptor that will handle - // the LSAT protocol for us. + // the L402 protocol for us. clientInterceptor := l402.NewInterceptor( - cfg.Lnd, lsatStore, serverRPCTimeout, cfg.MaxLsatCost, - cfg.MaxLsatFee, false, + cfg.Lnd, l402Store, serverRPCTimeout, cfg.MaxL402Cost, + cfg.MaxL402Fee, false, ) serverConn, err := getSwapServerConn( cfg.ServerAddress, cfg.ProxyAddress, cfg.SwapServerNoTLS,