get fw events
This commit is contained in:
parent
b58839c7e3
commit
a5be3a97e8
12 changed files with 250 additions and 4 deletions
|
|
@ -85,6 +85,7 @@ type Client struct {
|
|||
GetLNURLChannelLink func() (*LnurlLinkResponse, error)
|
||||
GetLiveDebitRequests func() (*LiveDebitRequest, error)
|
||||
GetLiveUserOperations func() (*LiveUserOperation, error)
|
||||
GetLndForwardingMetrics func(req LndMetricsRequest) (*LndForwardingMetrics, error)
|
||||
GetLndMetrics func(req LndMetricsRequest) (*LndMetrics, error)
|
||||
GetLnurlPayInfo func(query GetLnurlPayInfo_Query) (*LnurlPayInfoResponse, error)
|
||||
GetLnurlPayLink func() (*LnurlLinkResponse, error)
|
||||
|
|
@ -906,6 +907,35 @@ func NewClient(params ClientParams) *Client {
|
|||
},
|
||||
// server streaming method: GetLiveDebitRequests not implemented
|
||||
// server streaming method: GetLiveUserOperations not implemented
|
||||
GetLndForwardingMetrics: func(req LndMetricsRequest) (*LndForwardingMetrics, error) {
|
||||
auth, err := params.RetrieveMetricsAuth()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalRoute := "/api/reports/lnd/forwarding"
|
||||
body, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := ResultError{}
|
||||
err = json.Unmarshal(resBody, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result.Status == "ERROR" {
|
||||
return nil, fmt.Errorf(result.Reason)
|
||||
}
|
||||
res := LndForwardingMetrics{}
|
||||
err = json.Unmarshal(resBody, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &res, nil
|
||||
},
|
||||
GetLndMetrics: func(req LndMetricsRequest) (*LndMetrics, error) {
|
||||
auth, err := params.RetrieveMetricsAuth()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -361,6 +361,18 @@ type LiveUserOperation struct {
|
|||
type LndChannels struct {
|
||||
Open_channels []OpenChannel `json:"open_channels"`
|
||||
}
|
||||
type LndForwardingEvent struct {
|
||||
Amt_in int64 `json:"amt_in"`
|
||||
Amt_out int64 `json:"amt_out"`
|
||||
At_unix int64 `json:"at_unix"`
|
||||
Chan_id_in string `json:"chan_id_in"`
|
||||
Chan_id_out string `json:"chan_id_out"`
|
||||
Fee int64 `json:"fee"`
|
||||
}
|
||||
type LndForwardingMetrics struct {
|
||||
Events []LndForwardingEvent `json:"events"`
|
||||
Total_fees int64 `json:"total_fees"`
|
||||
}
|
||||
type LndGetInfoRequest struct {
|
||||
Nodeid int64 `json:"nodeId"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue