policy update

This commit is contained in:
boufni95 2024-11-18 16:29:55 +00:00
parent 5417c49245
commit 79bd82b802
14 changed files with 6176 additions and 5875 deletions

View file

@ -117,6 +117,7 @@ type Client struct {
SetMockAppUserBalance func(req SetMockAppUserBalanceRequest) error
SetMockInvoiceAsPaid func(req SetMockInvoiceAsPaidRequest) error
UpdateCallbackUrl func(req CallbackUrl) (*CallbackUrl, error)
UpdateChannelPolicy func(req UpdateChannelPolicyRequest) error
UseInviteLink func(req UseInviteLinkRequest) error
UserHealth func() error
}
@ -1692,6 +1693,30 @@ func NewClient(params ClientParams) *Client {
}
return &res, nil
},
UpdateChannelPolicy: func(req UpdateChannelPolicyRequest) error {
auth, err := params.RetrieveAdminAuth()
if err != nil {
return err
}
finalRoute := "/api/admin/channel/policy/update"
body, err := json.Marshal(req)
if err != nil {
return err
}
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
if err != nil {
return err
}
result := ResultError{}
err = json.Unmarshal(resBody, &result)
if err != nil {
return err
}
if result.Status == "ERROR" {
return fmt.Errorf(result.Reason)
}
return nil
},
UseInviteLink: func(req UseInviteLinkRequest) error {
auth, err := params.RetrieveGuestWithPubAuth()
if err != nil {

View file

@ -158,6 +158,13 @@ type BannedAppUser struct {
type CallbackUrl struct {
Url string `json:"url"`
}
type ChannelPolicy struct {
Base_fee_msat int64 `json:"base_fee_msat"`
Fee_rate_ppm int64 `json:"fee_rate_ppm"`
Max_htlc_msat int64 `json:"max_htlc_msat"`
Min_htlc_msat int64 `json:"min_htlc_msat"`
Timelock_delta int64 `json:"timelock_delta"`
}
type CloseChannelRequest struct {
Force bool `json:"force"`
Funding_txid string `json:"funding_txid"`
@ -236,9 +243,6 @@ type GetAppUserLNURLInfoRequest struct {
type GetAppUserRequest struct {
User_identifier string `json:"user_identifier"`
}
type GetChannelPolicyRequest struct {
Channel_id string `json:"channel_id"`
}
type GetInviteTokenStateRequest struct {
Invite_token string `json:"invite_token"`
}
@ -371,13 +375,15 @@ type NewInvoiceResponse struct {
Invoice string `json:"invoice"`
}
type OpenChannel struct {
Active bool `json:"active"`
Capacity int64 `json:"capacity"`
Channel_id string `json:"channel_id"`
Label string `json:"label"`
Lifetime int64 `json:"lifetime"`
Local_balance int64 `json:"local_balance"`
Remote_balance int64 `json:"remote_balance"`
Active bool `json:"active"`
Capacity int64 `json:"capacity"`
Channel_id string `json:"channel_id"`
Channel_point string `json:"channel_point"`
Label string `json:"label"`
Lifetime int64 `json:"lifetime"`
Local_balance int64 `json:"local_balance"`
Policy *ChannelPolicy `json:"policy"`
Remote_balance int64 `json:"remote_balance"`
}
type OpenChannelRequest struct {
Close_address string `json:"close_address"`
@ -473,6 +479,10 @@ type SetMockInvoiceAsPaidRequest struct {
Amount int64 `json:"amount"`
Invoice string `json:"invoice"`
}
type UpdateChannelPolicyRequest struct {
Policy *ChannelPolicy `json:"policy"`
Update *UpdateChannelPolicyRequest_update `json:"update"`
}
type UsageMetric struct {
Auth_in_nano int64 `json:"auth_in_nano"`
Batch bool `json:"batch"`
@ -581,3 +591,15 @@ type NPubLinking_state struct {
Linking_token *string `json:"linking_token"`
Unlinked *Empty `json:"unlinked"`
}
type UpdateChannelPolicyRequest_update_type string
const (
ALL UpdateChannelPolicyRequest_update_type = "all"
CHANNEL_POINT UpdateChannelPolicyRequest_update_type = "channel_point"
)
type UpdateChannelPolicyRequest_update struct {
Type UpdateChannelPolicyRequest_update_type `json:"type"`
All *Empty `json:"all"`
Channel_point *string `json:"channel_point"`
}