lnrpc/invoicesrpc: add new invoice ref LookupInvoiceV2 method
In this commit, we add a new `LookupInvoiceV2` method attached to the invoice RPC sub-server. Compared to the existing version, this version allows an invoice to be looked up by an invoice ref. This enables users to query an AMP invoice based on a specific _set ID_, so they can get the information related to the set of cumulative settles to that invoices.
This commit is contained in:
9 files changed
+441
-35
No files matched your search
@@ -139,4 +139,29 @@ func RegisterInvoicesJSONCallbacks(registry map[string]func(ctx context.Context,
|
||||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
|
||||
registry["invoicesrpc.Invoices.LookupInvoiceV2"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
req := &LookupInvoiceMsg{}
|
||||
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
client := NewInvoicesClient(conn)
|
||||
resp, err := client.LookupInvoiceV2(ctx, req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
respBytes, err := marshaler.Marshal(resp)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user