@lightsparkdev/lightspark-sdk 1.8.10 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,6 +51,8 @@ import {
51
51
  getLightsparkNodeOwnerQuery,
52
52
  getLightsparkNodeQuery,
53
53
  getNodeQuery,
54
+ getOfferDataQuery,
55
+ getOfferQuery,
54
56
  getOnChainTransactionQuery,
55
57
  getPaymentRequestQuery,
56
58
  getRoutingTransactionQuery,
@@ -59,7 +61,7 @@ import {
59
61
  getTransactionQuery,
60
62
  getUmaInvitationQuery,
61
63
  getWithdrawalQuery
62
- } from "../chunk-HEBVNBJB.js";
64
+ } from "../chunk-KEXWDHIC.js";
63
65
  import {
64
66
  BitcoinNetwork_default
65
67
  } from "../chunk-K6SAUSAX.js";
@@ -117,6 +119,8 @@ export {
117
119
  getLightsparkNodeOwnerQuery,
118
120
  getLightsparkNodeQuery,
119
121
  getNodeQuery,
122
+ getOfferDataQuery,
123
+ getOfferQuery,
120
124
  getOnChainTransactionQuery,
121
125
  getPaymentRequestQuery,
122
126
  getRoutingTransactionQuery,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsparkdev/lightspark-sdk",
3
- "version": "1.8.10",
3
+ "version": "1.9.0",
4
4
  "description": "Lightspark JS SDK",
5
5
  "author": "Lightspark Inc.",
6
6
  "keywords": [
@@ -20,36 +20,21 @@
20
20
  },
21
21
  "exports": {
22
22
  ".": {
23
- "types": "./dist/index.d.ts",
24
- "import": {
25
- "types": "./dist/index.d.ts",
26
- "default": "./dist/index.js"
27
- },
28
- "module": "./dist/index.js",
23
+ "import": "./dist/index.js",
29
24
  "require": "./dist/index.cjs"
30
25
  },
31
26
  "./objects": {
32
- "types": "./dist/objects/index.d.ts",
33
- "import": {
34
- "types": "./dist/objects/index.d.ts",
35
- "default": "./dist/objects/index.js"
36
- },
37
- "module": "./dist/objects/index.js",
27
+ "import": "./dist/objects/index.js",
38
28
  "require": "./dist/objects/index.cjs"
39
29
  },
40
30
  "./env": {
41
- "types": "./dist/env.d.ts",
42
- "import": {
43
- "types": "./dist/env.d.ts",
44
- "default": "./dist/env.js"
45
- },
46
- "module": "./dist/env.js",
31
+ "import": "./dist/env.js",
47
32
  "require": "./dist/env.cjs"
48
33
  }
49
34
  },
50
35
  "type": "module",
51
36
  "types": "./dist/index.d.ts",
52
- "main": "./dist/index.js",
37
+ "main": "./dist/index.cjs",
53
38
  "module": "./dist/index.js",
54
39
  "browser": {
55
40
  "crypto": false,
@@ -73,6 +58,7 @@
73
58
  "lint:fix:continue": "eslint --fix . || exit 0",
74
59
  "lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
75
60
  "lint": "eslint .",
61
+ "package-types": "yarn attw --pack .",
76
62
  "postversion": "yarn build",
77
63
  "test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail",
78
64
  "test": "yarn test-cmd src/tests/*.test.ts",
@@ -82,8 +68,8 @@
82
68
  },
83
69
  "license": "Apache-2.0",
84
70
  "dependencies": {
85
- "@lightsparkdev/core": "1.2.8",
86
- "@lightsparkdev/crypto-wasm": "0.1.11",
71
+ "@lightsparkdev/core": "1.3.0",
72
+ "@lightsparkdev/crypto-wasm": "0.1.12",
87
73
  "crypto-browserify": "^3.12.0",
88
74
  "dayjs": "^1.11.7",
89
75
  "dotenv": "^16.3.1",
@@ -93,6 +79,7 @@
93
79
  "zen-observable-ts": "^1.1.0"
94
80
  },
95
81
  "devDependencies": {
82
+ "@arethetypeswrong/cli": "^0.17.4",
96
83
  "@lightsparkdev/eslint-config": "*",
97
84
  "@lightsparkdev/tsconfig": "0.0.1",
98
85
  "@types/crypto-js": "^4.1.1",
package/src/client.ts CHANGED
@@ -35,6 +35,7 @@ import { CreateApiToken } from "./graphql/CreateApiToken.js";
35
35
  import { CreateInvoice } from "./graphql/CreateInvoice.js";
36
36
  import { CreateLnurlInvoice } from "./graphql/CreateLnurlInvoice.js";
37
37
  import { CreateNodeWalletAddress } from "./graphql/CreateNodeWalletAddress.js";
38
+ import { CreateOffer } from "./graphql/CreateOffer.js";
38
39
  import { CreateTestModeInvoice } from "./graphql/CreateTestModeInvoice.js";
39
40
  import { CreateTestModePayment } from "./graphql/CreateTestModePayment.js";
40
41
  import { CreateUmaInvitation } from "./graphql/CreateUmaInvitation.js";
@@ -53,6 +54,7 @@ import { MultiNodeDashboard } from "./graphql/MultiNodeDashboard.js";
53
54
  import { OutgoingPaymentsForInvoice } from "./graphql/OutgoingPaymentsForInvoice.js";
54
55
  import { OutgoingPaymentsForPaymentHash } from "./graphql/OutgoingPaymentsForPaymentHash.js";
55
56
  import { PayInvoice } from "./graphql/PayInvoice.js";
57
+ import { PayOffer } from "./graphql/PayOffer.js";
56
58
  import { PayUmaInvoice } from "./graphql/PayUmaInvoice.js";
57
59
  import { PaymentRequestsForNode } from "./graphql/PaymentRequestsForNode.js";
58
60
  import { RegisterPayment } from "./graphql/RegisterPayment.js";
@@ -542,6 +544,31 @@ class LightsparkClient {
542
544
  return response.create_invoice?.invoice.data?.encoded_payment_request;
543
545
  }
544
546
 
547
+ /**
548
+ * Creates an offer for the given node.
549
+ *
550
+ * @param nodeId The node ID for which to create an offer.
551
+ * @param amountMsats The amount of the offer in msats.
552
+ * @param description The description of the offer.
553
+ * @returns An encoded offer, or undefined if the offer could not be created.
554
+ */
555
+ public async createOffer(
556
+ nodeId: string,
557
+ amountMsats: number,
558
+ description: string,
559
+ ): Promise<string | undefined> {
560
+ const variables = {
561
+ node_id: nodeId,
562
+ amount_msats: amountMsats,
563
+ description,
564
+ };
565
+ const response = await this.requester.makeRawRequest(
566
+ CreateOffer,
567
+ variables,
568
+ );
569
+ return response.create_offer?.offer.encoded_offer;
570
+ }
571
+
545
572
  /**
546
573
  * Generates a Lightning Invoice (follows the Bolt 11 specification) to
547
574
  * request a payment from another Lightning Node.
@@ -866,6 +893,57 @@ class LightsparkClient {
866
893
  );
867
894
  }
868
895
 
896
+ /**
897
+ * Sends a lightning payment for a given offer.
898
+ *
899
+ * @param payerNodeId The ID of the node that will pay the offer.
900
+ * @param encodedOffer The encoded offer to pay.
901
+ * @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
902
+ * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
903
+ * As guidance, a maximum fee of 16 basis points should make almost all
904
+ * transactions succeed.
905
+ * @param amountMsats The amount to pay in msats for a no-amount offer. Defaults to the full amount of the
906
+ * offer. NOTE: This parameter can only be passed for a no-amount
907
+ * offer. Otherwise, the call will fail.
908
+ * @param idempotencyKey An optional idempotency key for the payment. If provided, the payment will be attempted only once.
909
+ * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
910
+ */
911
+ public async payOffer(
912
+ payerNodeId: string,
913
+ encodedOffer: string,
914
+ timeoutSecs: number,
915
+ maximumFeeMsats: number,
916
+ amountMsats?: number,
917
+ idempotencyKey?: string,
918
+ ): Promise<OutgoingPayment | undefined> {
919
+ if (!this.nodeKeyCache.hasKey(payerNodeId)) {
920
+ throw new LightsparkSigningException("Paying node is not unlocked");
921
+ }
922
+ const variables = {
923
+ node_id: payerNodeId,
924
+ encoded_offer: encodedOffer,
925
+ timeout_secs: timeoutSecs,
926
+ maximum_fees_msats: maximumFeeMsats,
927
+ amount_msats: amountMsats,
928
+ idempotency_key: idempotencyKey,
929
+ };
930
+ const response = await this.requester.makeRawRequest(
931
+ PayOffer,
932
+ variables,
933
+ payerNodeId,
934
+ );
935
+ if (response.pay_offer?.payment.outgoing_payment_failure_message) {
936
+ throw new LightsparkException(
937
+ "PaymentError",
938
+ response.pay_offer?.payment.outgoing_payment_failure_message
939
+ .rich_text_text,
940
+ );
941
+ }
942
+ return (
943
+ response.pay_offer && OutgoingPaymentFromJson(response.pay_offer.payment)
944
+ );
945
+ }
946
+
869
947
  /**
870
948
  * sends an UMA payment to a node on the Lightning Network,
871
949
  * based on the invoice (as defined by the BOLT11 specification) that you
@@ -0,0 +1,15 @@
1
+ // Copyright ©, 2025-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export const CreateOffer = `
4
+ mutation CreateOffer(
5
+ $node_id: ID!
6
+ $amount_msats: Long
7
+ $description: String
8
+ ) {
9
+ create_offer(input: { node_id: $node_id, amount_msats: $amount_msats, description: $description }) {
10
+ offer {
11
+ encoded_offer
12
+ }
13
+ }
14
+ }
15
+ `;
@@ -0,0 +1,31 @@
1
+ // Copyright ©, 2025-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
4
+
5
+ export const PayOffer = `
6
+ mutation PayOffer(
7
+ $node_id: ID!
8
+ $encoded_offer: String!
9
+ $timeout_secs: Int!
10
+ $maximum_fees_msats: Long!
11
+ $amount_msats: Long
12
+ $idempotency_key: String
13
+ ) {
14
+ pay_offer(
15
+ input: {
16
+ node_id: $node_id
17
+ encoded_offer: $encoded_offer
18
+ timeout_secs: $timeout_secs
19
+ maximum_fees_msats: $maximum_fees_msats
20
+ amount_msats: $amount_msats
21
+ idempotency_key: $idempotency_key
22
+ }
23
+ ) {
24
+ payment {
25
+ ...OutgoingPaymentFragment
26
+ }
27
+ }
28
+ }
29
+
30
+ ${OutgoingPaymentFragment}
31
+ `;
@@ -22,6 +22,7 @@ import type BlockchainBalance from "./BlockchainBalance.js";
22
22
  import { BlockchainBalanceFromJson } from "./BlockchainBalance.js";
23
23
  import type CurrencyAmount from "./CurrencyAmount.js";
24
24
  import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
25
+ import type CurrencyAmountInput from "./CurrencyAmountInput.js";
25
26
  import type Entity from "./Entity.js";
26
27
  import type LightsparkNodeOwner from "./LightsparkNodeOwner.js";
27
28
  import type TransactionFailures from "./TransactionFailures.js";
@@ -732,13 +733,15 @@ query FetchAccountToChannelsConnection($bitcoin_network: BitcoinNetwork!, $light
732
733
  lightningNodeId: string | undefined = undefined,
733
734
  statuses: TransactionStatus[] | undefined = undefined,
734
735
  excludeFailures: TransactionFailures | undefined = undefined,
736
+ maxAmount: CurrencyAmountInput | undefined = undefined,
737
+ minAmount: CurrencyAmountInput | undefined = undefined,
735
738
  ): Promise<AccountToTransactionsConnection> {
736
739
  return (await client.executeRawQuery({
737
740
  queryPayload: `
738
- query FetchAccountToTransactionsConnection($first: Int, $after: String, $types: [TransactionType!], $after_date: DateTime, $before_date: DateTime, $bitcoin_network: BitcoinNetwork, $lightning_node_id: ID, $statuses: [TransactionStatus!], $exclude_failures: TransactionFailures) {
741
+ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types: [TransactionType!], $after_date: DateTime, $before_date: DateTime, $bitcoin_network: BitcoinNetwork, $lightning_node_id: ID, $statuses: [TransactionStatus!], $exclude_failures: TransactionFailures, $max_amount: CurrencyAmountInput, $min_amount: CurrencyAmountInput) {
739
742
  current_account {
740
743
  ... on Account {
741
- transactions(, first: $first, after: $after, types: $types, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id, statuses: $statuses, exclude_failures: $exclude_failures) {
744
+ transactions(, first: $first, after: $after, types: $types, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id, statuses: $statuses, exclude_failures: $exclude_failures, max_amount: $max_amount, min_amount: $min_amount) {
742
745
  __typename
743
746
  account_to_transactions_connection_count: count
744
747
  account_to_transactions_connection_page_info: page_info {
@@ -1337,6 +1340,8 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
1337
1340
  lightning_node_id: lightningNodeId,
1338
1341
  statuses: statuses,
1339
1342
  exclude_failures: excludeFailures,
1343
+ max_amount: maxAmount,
1344
+ min_amount: minAmount,
1340
1345
  },
1341
1346
  constructObject: (json) => {
1342
1347
  const connection = json["current_account"]["transactions"];
@@ -1353,13 +1358,15 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
1353
1358
  beforeDate: string | undefined = undefined,
1354
1359
  bitcoinNetwork: BitcoinNetwork | undefined = undefined,
1355
1360
  lightningNodeId: string | undefined = undefined,
1361
+ maxAmount: CurrencyAmountInput | undefined = undefined,
1362
+ minAmount: CurrencyAmountInput | undefined = undefined,
1356
1363
  ): Promise<AccountToPaymentRequestsConnection> {
1357
1364
  return (await client.executeRawQuery({
1358
1365
  queryPayload: `
1359
- query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $after_date: DateTime, $before_date: DateTime, $bitcoin_network: BitcoinNetwork, $lightning_node_id: ID) {
1366
+ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $after_date: DateTime, $before_date: DateTime, $bitcoin_network: BitcoinNetwork, $lightning_node_id: ID, $max_amount: CurrencyAmountInput, $min_amount: CurrencyAmountInput) {
1360
1367
  current_account {
1361
1368
  ... on Account {
1362
- payment_requests(, first: $first, after: $after, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id) {
1369
+ payment_requests(, first: $first, after: $after, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id, max_amount: $max_amount, min_amount: $min_amount) {
1363
1370
  __typename
1364
1371
  account_to_payment_requests_connection_count: count
1365
1372
  account_to_payment_requests_connection_page_info: page_info {
@@ -1692,6 +1699,8 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
1692
1699
  before_date: beforeDate,
1693
1700
  bitcoin_network: bitcoinNetwork,
1694
1701
  lightning_node_id: lightningNodeId,
1702
+ max_amount: maxAmount,
1703
+ min_amount: minAmount,
1695
1704
  },
1696
1705
  constructObject: (json) => {
1697
1706
  const connection = json["current_account"]["payment_requests"];
@@ -1710,13 +1719,15 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
1710
1719
  idempotencyKeys: string[] | undefined = undefined,
1711
1720
  afterDate: string | undefined = undefined,
1712
1721
  beforeDate: string | undefined = undefined,
1722
+ maxAmount: CurrencyAmountInput | undefined = undefined,
1723
+ minAmount: CurrencyAmountInput | undefined = undefined,
1713
1724
  ): Promise<AccountToWithdrawalRequestsConnection> {
1714
1725
  return (await client.executeRawQuery({
1715
1726
  queryPayload: `
1716
- query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $bitcoin_networks: [BitcoinNetwork!], $statuses: [WithdrawalRequestStatus!], $node_ids: [ID!], $idempotency_keys: [String!], $after_date: DateTime, $before_date: DateTime) {
1727
+ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $bitcoin_networks: [BitcoinNetwork!], $statuses: [WithdrawalRequestStatus!], $node_ids: [ID!], $idempotency_keys: [String!], $after_date: DateTime, $before_date: DateTime, $max_amount: CurrencyAmountInput, $min_amount: CurrencyAmountInput) {
1717
1728
  current_account {
1718
1729
  ... on Account {
1719
- withdrawal_requests(, first: $first, after: $after, bitcoin_networks: $bitcoin_networks, statuses: $statuses, node_ids: $node_ids, idempotency_keys: $idempotency_keys, after_date: $after_date, before_date: $before_date) {
1730
+ withdrawal_requests(, first: $first, after: $after, bitcoin_networks: $bitcoin_networks, statuses: $statuses, node_ids: $node_ids, idempotency_keys: $idempotency_keys, after_date: $after_date, before_date: $before_date, max_amount: $max_amount, min_amount: $min_amount) {
1720
1731
  __typename
1721
1732
  account_to_withdrawal_requests_connection_count: count
1722
1733
  account_to_withdrawal_requests_connection_page_info: page_info {
@@ -1795,6 +1806,8 @@ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $b
1795
1806
  idempotency_keys: idempotencyKeys,
1796
1807
  after_date: afterDate,
1797
1808
  before_date: beforeDate,
1809
+ max_amount: maxAmount,
1810
+ min_amount: minAmount,
1798
1811
  },
1799
1812
  constructObject: (json) => {
1800
1813
  const connection = json["current_account"]["withdrawal_requests"];
@@ -16,8 +16,18 @@ interface CreateInvoiceInput {
16
16
 
17
17
  invoiceType?: InvoiceType | undefined;
18
18
 
19
- /** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
19
+ /**
20
+ * The expiry of the invoice in seconds. Default value is 86400 (1 day) for AMP invoice, or
21
+ * 3600 (1 hour) for STANDARD invoice.
22
+ **/
20
23
  expirySecs?: number | undefined;
24
+
25
+ /**
26
+ * The payment hash of the invoice. It should only be set if your node is a remote signing
27
+ * node. If not set, it will be requested through REMOTE_SIGNING webhooks with sub event type
28
+ * REQUEST_INVOICE_PAYMENT_HASH.
29
+ **/
30
+ paymentHash?: string | undefined;
21
31
  }
22
32
 
23
33
  export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
@@ -30,6 +40,7 @@ export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
30
40
  InvoiceType.FUTURE_VALUE
31
41
  : null,
32
42
  expirySecs: obj["create_invoice_input_expiry_secs"],
43
+ paymentHash: obj["create_invoice_input_payment_hash"],
33
44
  } as CreateInvoiceInput;
34
45
  };
35
46
  export const CreateInvoiceInputToJson = (obj: CreateInvoiceInput): any => {
@@ -39,6 +50,7 @@ export const CreateInvoiceInputToJson = (obj: CreateInvoiceInput): any => {
39
50
  create_invoice_input_memo: obj.memo,
40
51
  create_invoice_input_invoice_type: obj.invoiceType,
41
52
  create_invoice_input_expiry_secs: obj.expirySecs,
53
+ create_invoice_input_payment_hash: obj.paymentHash,
42
54
  };
43
55
  };
44
56
 
@@ -0,0 +1,32 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ interface CreateOfferInput {
4
+ /** The node from which to create the offer. **/
5
+ nodeId: string;
6
+
7
+ /**
8
+ * The amount for which the offer should be created, in millisatoshis. Setting the amount to 0
9
+ * will allow the payer to specify an amount.
10
+ **/
11
+ amountMsats?: number | undefined;
12
+
13
+ /** A short description of the offer. **/
14
+ description?: string | undefined;
15
+ }
16
+
17
+ export const CreateOfferInputFromJson = (obj: any): CreateOfferInput => {
18
+ return {
19
+ nodeId: obj["create_offer_input_node_id"],
20
+ amountMsats: obj["create_offer_input_amount_msats"],
21
+ description: obj["create_offer_input_description"],
22
+ } as CreateOfferInput;
23
+ };
24
+ export const CreateOfferInputToJson = (obj: CreateOfferInput): any => {
25
+ return {
26
+ create_offer_input_node_id: obj.nodeId,
27
+ create_offer_input_amount_msats: obj.amountMsats,
28
+ create_offer_input_description: obj.description,
29
+ };
30
+ };
31
+
32
+ export default CreateOfferInput;
@@ -0,0 +1,26 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ interface CreateOfferOutput {
4
+ offerId: string;
5
+ }
6
+
7
+ export const CreateOfferOutputFromJson = (obj: any): CreateOfferOutput => {
8
+ return {
9
+ offerId: obj["create_offer_output_offer"].id,
10
+ } as CreateOfferOutput;
11
+ };
12
+ export const CreateOfferOutputToJson = (obj: CreateOfferOutput): any => {
13
+ return {
14
+ create_offer_output_offer: { id: obj.offerId },
15
+ };
16
+ };
17
+
18
+ export const FRAGMENT = `
19
+ fragment CreateOfferOutputFragment on CreateOfferOutput {
20
+ __typename
21
+ create_offer_output_offer: offer {
22
+ id
23
+ }
24
+ }`;
25
+
26
+ export default CreateOfferOutput;
@@ -3,12 +3,19 @@
3
3
  import InvoiceType from "./InvoiceType.js";
4
4
 
5
5
  interface CreateTestModeInvoiceInput {
6
+ /** The local node from which to create the invoice. **/
6
7
  localNodeId: string;
7
8
 
9
+ /**
10
+ * The amount for which the invoice should be created, in millisatoshis. Setting the amount to
11
+ * 0 will allow the payer to specify an amount.
12
+ **/
8
13
  amountMsats: number;
9
14
 
15
+ /** An optional memo to include in the invoice. **/
10
16
  memo?: string | undefined;
11
17
 
18
+ /** The type of invoice to create. **/
12
19
  invoiceType?: InvoiceType | undefined;
13
20
  }
14
21
 
@@ -0,0 +1,26 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import CurrencyUnit from "./CurrencyUnit.js";
4
+
5
+ interface CurrencyAmountInput {
6
+ value: number;
7
+
8
+ unit: CurrencyUnit;
9
+ }
10
+
11
+ export const CurrencyAmountInputFromJson = (obj: any): CurrencyAmountInput => {
12
+ return {
13
+ value: obj["currency_amount_input_value"],
14
+ unit:
15
+ CurrencyUnit[obj["currency_amount_input_unit"]] ??
16
+ CurrencyUnit.FUTURE_VALUE,
17
+ } as CurrencyAmountInput;
18
+ };
19
+ export const CurrencyAmountInputToJson = (obj: CurrencyAmountInput): any => {
20
+ return {
21
+ currency_amount_input_value: obj.value,
22
+ currency_amount_input_unit: obj.unit,
23
+ };
24
+ };
25
+
26
+ export default CurrencyAmountInput;
@@ -25,6 +25,8 @@ export enum CurrencyUnit {
25
25
  USD = "USD",
26
26
  /** Mexican Peso. **/
27
27
  MXN = "MXN",
28
+ /** Philippine Peso. **/
29
+ PHP = "PHP",
28
30
  /**
29
31
  * 0.000000001 (10e-9) Bitcoin or a billionth of a Bitcoin. We recommend using the Satoshi unit
30
32
  * instead when possible. *
@@ -946,6 +946,42 @@ fragment EntityFragment on Entity {
946
946
  }
947
947
  }
948
948
  }
949
+ ... on Offer {
950
+ __typename
951
+ offer_id: id
952
+ offer_created_at: created_at
953
+ offer_updated_at: updated_at
954
+ offer_data: data {
955
+ id
956
+ }
957
+ offer_encoded_offer: encoded_offer
958
+ offer_amount: amount {
959
+ __typename
960
+ currency_amount_original_value: original_value
961
+ currency_amount_original_unit: original_unit
962
+ currency_amount_preferred_currency_unit: preferred_currency_unit
963
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
964
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
965
+ }
966
+ offer_description: description
967
+ }
968
+ ... on OfferData {
969
+ __typename
970
+ offer_data_id: id
971
+ offer_data_created_at: created_at
972
+ offer_data_updated_at: updated_at
973
+ offer_data_amount: amount {
974
+ __typename
975
+ currency_amount_original_value: original_value
976
+ currency_amount_original_unit: original_unit
977
+ currency_amount_preferred_currency_unit: preferred_currency_unit
978
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
979
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
980
+ }
981
+ offer_data_encoded_offer: encoded_offer
982
+ offer_data_bitcoin_networks: bitcoin_networks
983
+ offer_data_expires_at: expires_at
984
+ }
949
985
  ... on OutgoingPayment {
950
986
  __typename
951
987
  outgoing_payment_id: id
@@ -10,7 +10,11 @@ import type InvoiceData from "./InvoiceData.js";
10
10
  import { InvoiceDataFromJson, InvoiceDataToJson } from "./InvoiceData.js";
11
11
  import PaymentRequestStatus from "./PaymentRequestStatus.js";
12
12
 
13
- /** This object represents a BOLT #11 invoice (https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) created by a Lightspark Node. You can retrieve this object to receive relevant payment information for a specific invoice generated by a Lightspark node. **/
13
+ /**
14
+ * This object represents a Bolt #11 or Bolt #12 invoice created by a Lightspark Node. You can
15
+ * retrieve this object to receive relevant payment information for a specific invoice generated by
16
+ * a Lightspark node. *
17
+ */
14
18
  interface Invoice {
15
19
  /**
16
20
  * The unique identifier of this entity across all Lightspark systems. Should be treated as an
@@ -10,8 +10,8 @@ import type Node from "./Node.js";
10
10
  import { NodeFromJson, NodeToJson } from "./Node.js";
11
11
 
12
12
  /**
13
- * This object represents the data associated with a BOLT #11 invoice. You can retrieve this object
14
- * to receive the relevant data associated with a specific invoice. *
13
+ * This object represents the data associated with a Bolt #11 or Bolt #12 invoice. You can retrieve
14
+ * this object to receive the relevant data associated with a specific invoice. *
15
15
  */
16
16
  interface InvoiceData {
17
17
  encodedPaymentRequest: string;