-
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.
- Loading branch information
1 parent
037c4b0
commit 07e2de8
Showing
6 changed files
with
168 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,14 @@ | ||
// Copyright ©, 2024-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
type CreateOfferInput struct { | ||
|
||
// NodeId The node from which to create the offer. | ||
NodeId string `json:"create_offer_input_node_id"` | ||
|
||
// AmountMsats The amount for which the offer should be created, in millisatoshis. Setting the amount to 0 will allow the payer to specify an amount. | ||
AmountMsats int64 `json:"create_offer_input_amount_msats"` | ||
|
||
// Description The description of the offer. | ||
Description *string `json:"create_offer_input_description"` | ||
} |
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,8 @@ | ||
// Copyright ©, 2024-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
type CreateOfferOutput struct { | ||
|
||
// Offer The offer that was created. | ||
Offer Offer `json:"create_offer_output_offer"` | ||
} |
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,76 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
import "time" | ||
|
||
// Offer This object represents a BOLT #12 offer (https://github.com/lightning/bolts/blob/master/12-offer-encoding.md) created by a Lightspark Node. You can retrieve this object to receive relevant payment information for a specific offer generated by a Lightspark node. | ||
type Offer struct { | ||
|
||
// Id The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque string. | ||
Id string `json:"offer_id"` | ||
|
||
// CreatedAt The date and time when the entity was first created. | ||
CreatedAt time.Time `json:"offer_created_at"` | ||
|
||
// EncodedOffer The encoded offer string. | ||
EncodedOffer string `json:"offer_encoded_offer"` | ||
|
||
// Amount The requested amount in this invoice. If it is equal to 0, the sender should choose the amount to send. | ||
Amount CurrencyAmount `json:"offer_amount"` | ||
|
||
// Description The description of the offer. | ||
Description *string `json:"offer_description"` | ||
|
||
// Typename The typename of the object | ||
Typename string `json:"__typename"` | ||
} | ||
|
||
const ( | ||
OfferFragment = ` | ||
fragment OfferFragment on Offer { | ||
__typename | ||
offer_id: id | ||
offer_created_at: created_at | ||
offer_encoded_offer: encoded_offer | ||
offer_amount: amount { | ||
__typename | ||
currency_amount_original_value: original_value | ||
currency_amount_original_unit: original_unit | ||
currency_amount_preferred_currency_unit: preferred_currency_unit | ||
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded | ||
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx | ||
} | ||
offer_description: description | ||
} | ||
` | ||
) | ||
|
||
// GetId The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque string. | ||
func (obj Offer) GetId() string { | ||
return obj.Id | ||
} | ||
|
||
// GetCreatedAt The date and time when the entity was first created. | ||
func (obj Offer) GetCreatedAt() time.Time { | ||
return obj.CreatedAt | ||
} | ||
|
||
// GetEncodedOffer The encoded offer string. | ||
func (obj Offer) GetEncodedOffer() string { | ||
return obj.EncodedOffer | ||
} | ||
|
||
// GetAmount The requested amount in this invoice. | ||
func (obj Offer) GetAmount() CurrencyAmount { | ||
return obj.Amount | ||
} | ||
|
||
// GetDescription The description of the offer. | ||
func (obj Offer) GetDescription() *string { | ||
return obj.Description | ||
} | ||
|
||
// GetTypename The typename of the object | ||
func (obj Offer) GetTypename() string { | ||
return obj.Typename | ||
} |
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 CreateOffer( | ||
$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
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