list admin swaps + payment state fixes
This commit is contained in:
parent
0a385188ae
commit
008d11d047
15 changed files with 192 additions and 36 deletions
|
|
@ -114,6 +114,7 @@ type Client struct {
|
|||
HandleLnurlWithdraw func(query HandleLnurlWithdraw_Query) error
|
||||
Health func() error
|
||||
LinkNPubThroughToken func(req LinkNPubThroughTokenRequest) error
|
||||
ListAdminSwaps func() (*SwapsList, error)
|
||||
ListChannels func() (*LndChannels, error)
|
||||
ListSwaps func() (*SwapsList, error)
|
||||
LndGetInfo func(req LndGetInfoRequest) (*LndGetInfoResponse, error)
|
||||
|
|
@ -1642,6 +1643,32 @@ func NewClient(params ClientParams) *Client {
|
|||
}
|
||||
return nil
|
||||
},
|
||||
ListAdminSwaps: func() (*SwapsList, error) {
|
||||
auth, err := params.RetrieveAdminAuth()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalRoute := "/api/admin/swap/list"
|
||||
body := []byte{}
|
||||
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 := SwapsList{}
|
||||
err = json.Unmarshal(resBody, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &res, nil
|
||||
},
|
||||
ListChannels: func() (*LndChannels, error) {
|
||||
auth, err := params.RetrieveAdminAuth()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -584,10 +584,13 @@ type PayerData struct {
|
|||
Data map[string]string `json:"data"`
|
||||
}
|
||||
type PaymentState struct {
|
||||
Amount int64 `json:"amount"`
|
||||
Network_fee int64 `json:"network_fee"`
|
||||
Paid_at_unix int64 `json:"paid_at_unix"`
|
||||
Service_fee int64 `json:"service_fee"`
|
||||
Amount int64 `json:"amount"`
|
||||
Internal bool `json:"internal"`
|
||||
Network_fee int64 `json:"network_fee"`
|
||||
Operation_id string `json:"operation_id"`
|
||||
Paid_at_unix int64 `json:"paid_at_unix"`
|
||||
Preimage string `json:"preimage"`
|
||||
Service_fee int64 `json:"service_fee"`
|
||||
}
|
||||
type Product struct {
|
||||
Id string `json:"id"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue