-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added offer mutations to
LightsparkClient
.
- CreateOffer for creating a new offer with the specified parameters. - PayOffer for paying an offer.
- Loading branch information
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package scripts | ||
|
||
import "github.com/lightsparkdev/go-sdk/objects" | ||
|
||
const CREATE_OFFER_MUTATION = ` | ||
mutation CreateInvoice( | ||
$node_id: ID! | ||
$amount_msats: Long | ||
$description: String | ||
) { | ||
create_offer(input: { | ||
node_id: $node_id | ||
amount_msats: $amount_msats | ||
description: $description | ||
}) { | ||
offer { | ||
...OfferFragment | ||
} | ||
} | ||
} | ||
` + objects.OfferFragment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package scripts | ||
|
||
import "github.com/lightsparkdev/go-sdk/objects" | ||
|
||
const PAY_OFFER_MUTATION = ` | ||
mutation PayOffer( | ||
$node_id: ID! | ||
$encoded_offer: String! | ||
$timeout_secs: Int! | ||
$maximum_fees_msats: Long! | ||
$amount_msats: Long | ||
$idempotency_key: String | ||
) { | ||
pay_offer(input: { | ||
node_id: $node_id | ||
encoded_offer: $encoded_offer | ||
timeout_secs: $timeout_secs | ||
maximum_fees_msats: $maximum_fees_msats | ||
amount_msats: $amount_msats | ||
idempotency_key: $idempotency_key | ||
}) { | ||
payment { | ||
...OutgoingPaymentFragment | ||
} | ||
} | ||
} | ||
` + objects.OutgoingPaymentFragment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters