Skip to content

Commit

Permalink
Merge pull request #101 from lightsparkdev/fail_htlc
Browse files Browse the repository at this point in the history
Add fail_htlcs mutation
  • Loading branch information
zhenlu authored May 2, 2024
2 parents dd5b264 + d3026bd commit 2ba6451
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/fail_htlcs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package scripts

const FAIL_HTLCS_MUTATION = `
mutation FailHtlcs($invoice_id: ID!) {
fail_htlcs(input: { invoice_id: $invoice_id })
}`
12 changes: 12 additions & 0 deletions services/lightspark_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,18 @@ func (client *LightsparkClient) FetchIncomingPaymentsByInvoice(invoiceId string,
return &payments, nil
}

func (client *LightsparkClient) FailHtlc(invoiceId string) (error) {
variables := map[string]interface{}{
"invoice_id": invoiceId,
}

_, err := client.Requester.ExecuteGraphql(scripts.FAIL_HTLCS_MUTATION, variables, nil)
if err != nil {
return err
}
return nil
}

func hashPhoneNumber(e614PhoneNumber string) (*string, error) {
e164PhoneRegex, err := regexp.Compile(`^\+?[1-9]\d{1,14}$`)
if err != nil {
Expand Down

0 comments on commit 2ba6451

Please sign in to comment.