@lightsparkdev/lightspark-sdk 1.8.9 → 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.
package/dist/index.js CHANGED
@@ -85,6 +85,8 @@ import {
85
85
  getLightsparkNodeOwnerQuery,
86
86
  getLightsparkNodeQuery,
87
87
  getNodeQuery,
88
+ getOfferDataQuery,
89
+ getOfferQuery,
88
90
  getOnChainTransactionQuery,
89
91
  getPaymentRequestQuery,
90
92
  getRoutingTransactionQuery,
@@ -93,7 +95,7 @@ import {
93
95
  getTransactionQuery,
94
96
  getUmaInvitationQuery,
95
97
  getWithdrawalQuery
96
- } from "./chunk-HEBVNBJB.js";
98
+ } from "./chunk-KEXWDHIC.js";
97
99
  import {
98
100
  BitcoinNetwork_default
99
101
  } from "./chunk-K6SAUSAX.js";
@@ -151,7 +153,7 @@ import {
151
153
  // package.json
152
154
  var package_default = {
153
155
  name: "@lightsparkdev/lightspark-sdk",
154
- version: "1.8.9",
156
+ version: "1.9.0",
155
157
  description: "Lightspark JS SDK",
156
158
  author: "Lightspark Inc.",
157
159
  keywords: [
@@ -171,36 +173,21 @@ var package_default = {
171
173
  },
172
174
  exports: {
173
175
  ".": {
174
- types: "./dist/index.d.ts",
175
- import: {
176
- types: "./dist/index.d.ts",
177
- default: "./dist/index.js"
178
- },
179
- module: "./dist/index.js",
176
+ import: "./dist/index.js",
180
177
  require: "./dist/index.cjs"
181
178
  },
182
179
  "./objects": {
183
- types: "./dist/objects/index.d.ts",
184
- import: {
185
- types: "./dist/objects/index.d.ts",
186
- default: "./dist/objects/index.js"
187
- },
188
- module: "./dist/objects/index.js",
180
+ import: "./dist/objects/index.js",
189
181
  require: "./dist/objects/index.cjs"
190
182
  },
191
183
  "./env": {
192
- types: "./dist/env.d.ts",
193
- import: {
194
- types: "./dist/env.d.ts",
195
- default: "./dist/env.js"
196
- },
197
- module: "./dist/env.js",
184
+ import: "./dist/env.js",
198
185
  require: "./dist/env.cjs"
199
186
  }
200
187
  },
201
188
  type: "module",
202
189
  types: "./dist/index.d.ts",
203
- main: "./dist/index.js",
190
+ main: "./dist/index.cjs",
204
191
  module: "./dist/index.js",
205
192
  browser: {
206
193
  crypto: false,
@@ -224,6 +211,7 @@ var package_default = {
224
211
  "lint:fix:continue": "eslint --fix . || exit 0",
225
212
  "lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
226
213
  lint: "eslint .",
214
+ "package-types": "yarn attw --pack .",
227
215
  postversion: "yarn build",
228
216
  "test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail",
229
217
  test: "yarn test-cmd src/tests/*.test.ts",
@@ -233,8 +221,8 @@ var package_default = {
233
221
  },
234
222
  license: "Apache-2.0",
235
223
  dependencies: {
236
- "@lightsparkdev/core": "1.2.7",
237
- "@lightsparkdev/crypto-wasm": "0.1.10",
224
+ "@lightsparkdev/core": "1.3.0",
225
+ "@lightsparkdev/crypto-wasm": "0.1.12",
238
226
  "crypto-browserify": "^3.12.0",
239
227
  dayjs: "^1.11.7",
240
228
  dotenv: "^16.3.1",
@@ -244,6 +232,7 @@ var package_default = {
244
232
  "zen-observable-ts": "^1.1.0"
245
233
  },
246
234
  devDependencies: {
235
+ "@arethetypeswrong/cli": "^0.17.4",
247
236
  "@lightsparkdev/eslint-config": "*",
248
237
  "@lightsparkdev/tsconfig": "0.0.1",
249
238
  "@types/crypto-js": "^4.1.1",
@@ -594,6 +583,21 @@ var CreateNodeWalletAddress = `
594
583
  }
595
584
  `;
596
585
 
586
+ // src/graphql/CreateOffer.ts
587
+ var CreateOffer = `
588
+ mutation CreateOffer(
589
+ $node_id: ID!
590
+ $amount_msats: Long
591
+ $description: String
592
+ ) {
593
+ create_offer(input: { node_id: $node_id, amount_msats: $amount_msats, description: $description }) {
594
+ offer {
595
+ encoded_offer
596
+ }
597
+ }
598
+ }
599
+ `;
600
+
597
601
  // src/graphql/CreateTestModeInvoice.ts
598
602
  var CreateTestModeInvoice = `
599
603
  mutation CreateTestModeInvoice(
@@ -964,6 +968,35 @@ var PayInvoice = `
964
968
  ${FRAGMENT9}
965
969
  `;
966
970
 
971
+ // src/graphql/PayOffer.ts
972
+ var PayOffer = `
973
+ mutation PayOffer(
974
+ $node_id: ID!
975
+ $encoded_offer: String!
976
+ $timeout_secs: Int!
977
+ $maximum_fees_msats: Long!
978
+ $amount_msats: Long
979
+ $idempotency_key: String
980
+ ) {
981
+ pay_offer(
982
+ input: {
983
+ node_id: $node_id
984
+ encoded_offer: $encoded_offer
985
+ timeout_secs: $timeout_secs
986
+ maximum_fees_msats: $maximum_fees_msats
987
+ amount_msats: $amount_msats
988
+ idempotency_key: $idempotency_key
989
+ }
990
+ ) {
991
+ payment {
992
+ ...OutgoingPaymentFragment
993
+ }
994
+ }
995
+ }
996
+
997
+ ${FRAGMENT9}
998
+ `;
999
+
967
1000
  // src/graphql/PayUmaInvoice.ts
968
1001
  var PayUmaInvoice = `
969
1002
  mutation PayUmaInvoice(
@@ -1311,11 +1344,14 @@ var LightsparkClient = class {
1311
1344
  * @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
1312
1345
  * For React Native, you should use the `ReactNativeCrypto`
1313
1346
  * implementation from `@lightsparkdev/react-native`.
1347
+ * @param signingKey Passing in a signing key enables you to overload the default signing behavior. You can implement your own SigningKey class to make requests to a secure environment to sign or load a locally persisted key. WARNING: Typically, you won't need to set this parameter unless you want to customize the OSK signing flow. Most users should just use `loadNodeSigningKey` instead of passing this parameter.
1314
1348
  */
1315
- constructor(authProvider = new StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = DefaultCrypto2) {
1349
+ constructor(authProvider = new StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = DefaultCrypto2, signingKey, fetchImpl = fetch) {
1316
1350
  this.authProvider = authProvider;
1317
1351
  this.serverUrl = serverUrl;
1318
1352
  this.cryptoImpl = cryptoImpl;
1353
+ this.signingKey = signingKey;
1354
+ this.fetchImpl = fetchImpl;
1319
1355
  this.nodeKeyCache = new NodeKeyCache(this.cryptoImpl);
1320
1356
  this.nodeKeyLoaderCache = new NodeKeyLoaderCache(
1321
1357
  this.nodeKeyCache,
@@ -1327,7 +1363,9 @@ var LightsparkClient = class {
1327
1363
  `js-lightspark-sdk/${sdkVersion}`,
1328
1364
  authProvider,
1329
1365
  serverUrl,
1330
- this.cryptoImpl
1366
+ this.cryptoImpl,
1367
+ this.signingKey,
1368
+ this.fetchImpl
1331
1369
  );
1332
1370
  autoBind(this);
1333
1371
  }
@@ -1374,7 +1412,9 @@ var LightsparkClient = class {
1374
1412
  `js-lightspark-sdk/${sdkVersion}`,
1375
1413
  authProvider,
1376
1414
  this.serverUrl,
1377
- this.cryptoImpl
1415
+ this.cryptoImpl,
1416
+ this.signingKey,
1417
+ this.fetchImpl
1378
1418
  );
1379
1419
  this.authProvider = authProvider;
1380
1420
  }
@@ -1627,6 +1667,26 @@ var LightsparkClient = class {
1627
1667
  );
1628
1668
  return response.create_invoice?.invoice.data?.encoded_payment_request;
1629
1669
  }
1670
+ /**
1671
+ * Creates an offer for the given node.
1672
+ *
1673
+ * @param nodeId The node ID for which to create an offer.
1674
+ * @param amountMsats The amount of the offer in msats.
1675
+ * @param description The description of the offer.
1676
+ * @returns An encoded offer, or undefined if the offer could not be created.
1677
+ */
1678
+ async createOffer(nodeId, amountMsats, description) {
1679
+ const variables = {
1680
+ node_id: nodeId,
1681
+ amount_msats: amountMsats,
1682
+ description
1683
+ };
1684
+ const response = await this.requester.makeRawRequest(
1685
+ CreateOffer,
1686
+ variables
1687
+ );
1688
+ return response.create_offer?.offer.encoded_offer;
1689
+ }
1630
1690
  /**
1631
1691
  * Generates a Lightning Invoice (follows the Bolt 11 specification) to
1632
1692
  * request a payment from another Lightning Node.
@@ -1894,6 +1954,46 @@ var LightsparkClient = class {
1894
1954
  }
1895
1955
  return response.pay_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
1896
1956
  }
1957
+ /**
1958
+ * Sends a lightning payment for a given offer.
1959
+ *
1960
+ * @param payerNodeId The ID of the node that will pay the offer.
1961
+ * @param encodedOffer The encoded offer to pay.
1962
+ * @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
1963
+ * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
1964
+ * As guidance, a maximum fee of 16 basis points should make almost all
1965
+ * transactions succeed.
1966
+ * @param amountMsats The amount to pay in msats for a no-amount offer. Defaults to the full amount of the
1967
+ * offer. NOTE: This parameter can only be passed for a no-amount
1968
+ * offer. Otherwise, the call will fail.
1969
+ * @param idempotencyKey An optional idempotency key for the payment. If provided, the payment will be attempted only once.
1970
+ * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
1971
+ */
1972
+ async payOffer(payerNodeId, encodedOffer, timeoutSecs, maximumFeeMsats, amountMsats, idempotencyKey) {
1973
+ if (!this.nodeKeyCache.hasKey(payerNodeId)) {
1974
+ throw new LightsparkSigningException3("Paying node is not unlocked");
1975
+ }
1976
+ const variables = {
1977
+ node_id: payerNodeId,
1978
+ encoded_offer: encodedOffer,
1979
+ timeout_secs: timeoutSecs,
1980
+ maximum_fees_msats: maximumFeeMsats,
1981
+ amount_msats: amountMsats,
1982
+ idempotency_key: idempotencyKey
1983
+ };
1984
+ const response = await this.requester.makeRawRequest(
1985
+ PayOffer,
1986
+ variables,
1987
+ payerNodeId
1988
+ );
1989
+ if (response.pay_offer?.payment.outgoing_payment_failure_message) {
1990
+ throw new LightsparkException(
1991
+ "PaymentError",
1992
+ response.pay_offer?.payment.outgoing_payment_failure_message.rich_text_text
1993
+ );
1994
+ }
1995
+ return response.pay_offer && OutgoingPaymentFromJson(response.pay_offer.payment);
1996
+ }
1897
1997
  /**
1898
1998
  * sends an UMA payment to a node on the Lightning Network,
1899
1999
  * based on the invoice (as defined by the BOLT11 specification) that you
@@ -2631,6 +2731,8 @@ export {
2631
2731
  getLightsparkNodeOwnerQuery,
2632
2732
  getLightsparkNodeQuery,
2633
2733
  getNodeQuery,
2734
+ getOfferDataQuery,
2735
+ getOfferQuery,
2634
2736
  getOnChainTransactionQuery,
2635
2737
  getPaymentRequestQuery,
2636
2738
  getRoutingTransactionQuery,
@@ -73,6 +73,8 @@ __export(objects_exports, {
73
73
  getLightsparkNodeOwnerQuery: () => getLightsparkNodeOwnerQuery,
74
74
  getLightsparkNodeQuery: () => getLightsparkNodeQuery,
75
75
  getNodeQuery: () => getNodeQuery,
76
+ getOfferDataQuery: () => getOfferDataQuery,
77
+ getOfferQuery: () => getOfferQuery,
76
78
  getOnChainTransactionQuery: () => getOnChainTransactionQuery,
77
79
  getPaymentRequestQuery: () => getPaymentRequestQuery,
78
80
  getRoutingTransactionQuery: () => getRoutingTransactionQuery,
@@ -221,6 +223,7 @@ var CurrencyUnit = /* @__PURE__ */ ((CurrencyUnit2) => {
221
223
  CurrencyUnit2["MILLISATOSHI"] = "MILLISATOSHI";
222
224
  CurrencyUnit2["USD"] = "USD";
223
225
  CurrencyUnit2["MXN"] = "MXN";
226
+ CurrencyUnit2["PHP"] = "PHP";
224
227
  CurrencyUnit2["NANOBITCOIN"] = "NANOBITCOIN";
225
228
  CurrencyUnit2["MICROBITCOIN"] = "MICROBITCOIN";
226
229
  CurrencyUnit2["MILLIBITCOIN"] = "MILLIBITCOIN";
@@ -7298,13 +7301,13 @@ query FetchAccountToChannelsConnection($bitcoin_network: BitcoinNetwork!, $light
7298
7301
  }
7299
7302
  });
7300
7303
  }
7301
- async getTransactions(client, first = void 0, after = void 0, types = void 0, afterDate = void 0, beforeDate = void 0, bitcoinNetwork = void 0, lightningNodeId = void 0, statuses = void 0, excludeFailures = void 0) {
7304
+ async getTransactions(client, first = void 0, after = void 0, types = void 0, afterDate = void 0, beforeDate = void 0, bitcoinNetwork = void 0, lightningNodeId = void 0, statuses = void 0, excludeFailures = void 0, maxAmount = void 0, minAmount = void 0) {
7302
7305
  return await client.executeRawQuery({
7303
7306
  queryPayload: `
7304
- 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) {
7307
+ 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) {
7305
7308
  current_account {
7306
7309
  ... on Account {
7307
- 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) {
7310
+ 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) {
7308
7311
  __typename
7309
7312
  account_to_transactions_connection_count: count
7310
7313
  account_to_transactions_connection_page_info: page_info {
@@ -7902,7 +7905,9 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
7902
7905
  bitcoin_network: bitcoinNetwork,
7903
7906
  lightning_node_id: lightningNodeId,
7904
7907
  statuses,
7905
- exclude_failures: excludeFailures
7908
+ exclude_failures: excludeFailures,
7909
+ max_amount: maxAmount,
7910
+ min_amount: minAmount
7906
7911
  },
7907
7912
  constructObject: (json) => {
7908
7913
  const connection = json["current_account"]["transactions"];
@@ -7910,13 +7915,13 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
7910
7915
  }
7911
7916
  });
7912
7917
  }
7913
- async getPaymentRequests(client, first = void 0, after = void 0, afterDate = void 0, beforeDate = void 0, bitcoinNetwork = void 0, lightningNodeId = void 0) {
7918
+ async getPaymentRequests(client, first = void 0, after = void 0, afterDate = void 0, beforeDate = void 0, bitcoinNetwork = void 0, lightningNodeId = void 0, maxAmount = void 0, minAmount = void 0) {
7914
7919
  return await client.executeRawQuery({
7915
7920
  queryPayload: `
7916
- query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $after_date: DateTime, $before_date: DateTime, $bitcoin_network: BitcoinNetwork, $lightning_node_id: ID) {
7921
+ 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) {
7917
7922
  current_account {
7918
7923
  ... on Account {
7919
- payment_requests(, first: $first, after: $after, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id) {
7924
+ 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) {
7920
7925
  __typename
7921
7926
  account_to_payment_requests_connection_count: count
7922
7927
  account_to_payment_requests_connection_page_info: page_info {
@@ -8248,7 +8253,9 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
8248
8253
  after_date: afterDate,
8249
8254
  before_date: beforeDate,
8250
8255
  bitcoin_network: bitcoinNetwork,
8251
- lightning_node_id: lightningNodeId
8256
+ lightning_node_id: lightningNodeId,
8257
+ max_amount: maxAmount,
8258
+ min_amount: minAmount
8252
8259
  },
8253
8260
  constructObject: (json) => {
8254
8261
  const connection = json["current_account"]["payment_requests"];
@@ -8256,13 +8263,13 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
8256
8263
  }
8257
8264
  });
8258
8265
  }
8259
- async getWithdrawalRequests(client, first = void 0, after = void 0, bitcoinNetworks = void 0, statuses = void 0, nodeIds = void 0, idempotencyKeys = void 0, afterDate = void 0, beforeDate = void 0) {
8266
+ async getWithdrawalRequests(client, first = void 0, after = void 0, bitcoinNetworks = void 0, statuses = void 0, nodeIds = void 0, idempotencyKeys = void 0, afterDate = void 0, beforeDate = void 0, maxAmount = void 0, minAmount = void 0) {
8260
8267
  return await client.executeRawQuery({
8261
8268
  queryPayload: `
8262
- query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $bitcoin_networks: [BitcoinNetwork!], $statuses: [WithdrawalRequestStatus!], $node_ids: [ID!], $idempotency_keys: [String!], $after_date: DateTime, $before_date: DateTime) {
8269
+ 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) {
8263
8270
  current_account {
8264
8271
  ... on Account {
8265
- 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) {
8272
+ 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) {
8266
8273
  __typename
8267
8274
  account_to_withdrawal_requests_connection_count: count
8268
8275
  account_to_withdrawal_requests_connection_page_info: page_info {
@@ -8340,7 +8347,9 @@ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $b
8340
8347
  node_ids: nodeIds,
8341
8348
  idempotency_keys: idempotencyKeys,
8342
8349
  after_date: afterDate,
8343
- before_date: beforeDate
8350
+ before_date: beforeDate,
8351
+ max_amount: maxAmount,
8352
+ min_amount: minAmount
8344
8353
  },
8345
8354
  constructObject: (json) => {
8346
8355
  const connection = json["current_account"]["withdrawal_requests"];
@@ -9986,6 +9995,110 @@ ${FRAGMENT27}
9986
9995
  };
9987
9996
  };
9988
9997
 
9998
+ // src/objects/Offer.ts
9999
+ var import_core30 = require("@lightsparkdev/core");
10000
+ var OfferFromJson = (obj) => {
10001
+ return {
10002
+ id: obj["offer_id"],
10003
+ createdAt: obj["offer_created_at"],
10004
+ updatedAt: obj["offer_updated_at"],
10005
+ dataId: obj["offer_data"].id,
10006
+ encodedOffer: obj["offer_encoded_offer"],
10007
+ typename: "Offer",
10008
+ amount: !!obj["offer_amount"] ? CurrencyAmountFromJson(obj["offer_amount"]) : void 0,
10009
+ description: obj["offer_description"]
10010
+ };
10011
+ };
10012
+ var FRAGMENT28 = `
10013
+ fragment OfferFragment on Offer {
10014
+ __typename
10015
+ offer_id: id
10016
+ offer_created_at: created_at
10017
+ offer_updated_at: updated_at
10018
+ offer_data: data {
10019
+ id
10020
+ }
10021
+ offer_encoded_offer: encoded_offer
10022
+ offer_amount: amount {
10023
+ __typename
10024
+ currency_amount_original_value: original_value
10025
+ currency_amount_original_unit: original_unit
10026
+ currency_amount_preferred_currency_unit: preferred_currency_unit
10027
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
10028
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
10029
+ }
10030
+ offer_description: description
10031
+ }`;
10032
+ var getOfferQuery = (id) => {
10033
+ return {
10034
+ queryPayload: `
10035
+ query GetOffer($id: ID!) {
10036
+ entity(id: $id) {
10037
+ ... on Offer {
10038
+ ...OfferFragment
10039
+ }
10040
+ }
10041
+ }
10042
+
10043
+ ${FRAGMENT28}
10044
+ `,
10045
+ variables: { id },
10046
+ constructObject: (data) => (0, import_core30.isObject)(data) && "entity" in data && (0, import_core30.isObject)(data.entity) ? OfferFromJson(data.entity) : null
10047
+ };
10048
+ };
10049
+
10050
+ // src/objects/OfferData.ts
10051
+ var import_core31 = require("@lightsparkdev/core");
10052
+ var OfferDataFromJson = (obj) => {
10053
+ return {
10054
+ id: obj["offer_data_id"],
10055
+ createdAt: obj["offer_data_created_at"],
10056
+ updatedAt: obj["offer_data_updated_at"],
10057
+ encodedOffer: obj["offer_data_encoded_offer"],
10058
+ bitcoinNetworks: obj["offer_data_bitcoin_networks"].map(
10059
+ (e) => BitcoinNetwork_default[e]
10060
+ ),
10061
+ typename: "OfferData",
10062
+ amount: !!obj["offer_data_amount"] ? CurrencyAmountFromJson(obj["offer_data_amount"]) : void 0,
10063
+ expiresAt: obj["offer_data_expires_at"]
10064
+ };
10065
+ };
10066
+ var FRAGMENT29 = `
10067
+ fragment OfferDataFragment on OfferData {
10068
+ __typename
10069
+ offer_data_id: id
10070
+ offer_data_created_at: created_at
10071
+ offer_data_updated_at: updated_at
10072
+ offer_data_amount: amount {
10073
+ __typename
10074
+ currency_amount_original_value: original_value
10075
+ currency_amount_original_unit: original_unit
10076
+ currency_amount_preferred_currency_unit: preferred_currency_unit
10077
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
10078
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
10079
+ }
10080
+ offer_data_encoded_offer: encoded_offer
10081
+ offer_data_bitcoin_networks: bitcoin_networks
10082
+ offer_data_expires_at: expires_at
10083
+ }`;
10084
+ var getOfferDataQuery = (id) => {
10085
+ return {
10086
+ queryPayload: `
10087
+ query GetOfferData($id: ID!) {
10088
+ entity(id: $id) {
10089
+ ... on OfferData {
10090
+ ...OfferDataFragment
10091
+ }
10092
+ }
10093
+ }
10094
+
10095
+ ${FRAGMENT29}
10096
+ `,
10097
+ variables: { id },
10098
+ constructObject: (data) => (0, import_core31.isObject)(data) && "entity" in data && (0, import_core31.isObject)(data.entity) ? OfferDataFromJson(data.entity) : null
10099
+ };
10100
+ };
10101
+
9989
10102
  // src/objects/OnChainFeeTarget.ts
9990
10103
  var OnChainFeeTarget = /* @__PURE__ */ ((OnChainFeeTarget2) => {
9991
10104
  OnChainFeeTarget2["FUTURE_VALUE"] = "FUTURE_VALUE";
@@ -9998,7 +10111,7 @@ var OnChainFeeTarget = /* @__PURE__ */ ((OnChainFeeTarget2) => {
9998
10111
  var OnChainFeeTarget_default = OnChainFeeTarget;
9999
10112
 
10000
10113
  // src/objects/OnChainTransaction.ts
10001
- var import_core30 = require("@lightsparkdev/core");
10114
+ var import_core32 = require("@lightsparkdev/core");
10002
10115
  var OnChainTransactionFromJson = (obj) => {
10003
10116
  if (obj["__typename"] == "ChannelClosingTransaction") {
10004
10117
  return {
@@ -10072,12 +10185,12 @@ var OnChainTransactionFromJson = (obj) => {
10072
10185
  numConfirmations: obj["withdrawal_num_confirmations"]
10073
10186
  };
10074
10187
  }
10075
- throw new import_core30.LightsparkException(
10188
+ throw new import_core32.LightsparkException(
10076
10189
  "DeserializationError",
10077
10190
  `Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
10078
10191
  );
10079
10192
  };
10080
- var FRAGMENT28 = `
10193
+ var FRAGMENT30 = `
10081
10194
  fragment OnChainTransactionFragment on OnChainTransaction {
10082
10195
  __typename
10083
10196
  ... on ChannelClosingTransaction {
@@ -10220,10 +10333,10 @@ query GetOnChainTransaction($id: ID!) {
10220
10333
  }
10221
10334
  }
10222
10335
 
10223
- ${FRAGMENT28}
10336
+ ${FRAGMENT30}
10224
10337
  `,
10225
10338
  variables: { id },
10226
- constructObject: (data) => (0, import_core30.isObject)(data) && "entity" in data && (0, import_core30.isObject)(data.entity) ? OnChainTransactionFromJson(data.entity) : null
10339
+ constructObject: (data) => (0, import_core32.isObject)(data) && "entity" in data && (0, import_core32.isObject)(data.entity) ? OnChainTransactionFromJson(data.entity) : null
10227
10340
  };
10228
10341
  };
10229
10342
 
@@ -10263,7 +10376,7 @@ var RiskRating = /* @__PURE__ */ ((RiskRating2) => {
10263
10376
  var RiskRating_default = RiskRating;
10264
10377
 
10265
10378
  // src/objects/RoutingTransaction.ts
10266
- var import_core31 = require("@lightsparkdev/core");
10379
+ var import_core33 = require("@lightsparkdev/core");
10267
10380
  var RoutingTransactionFromJson = (obj) => {
10268
10381
  return {
10269
10382
  id: obj["routing_transaction_id"],
@@ -10281,7 +10394,7 @@ var RoutingTransactionFromJson = (obj) => {
10281
10394
  failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
10282
10395
  };
10283
10396
  };
10284
- var FRAGMENT29 = `
10397
+ var FRAGMENT31 = `
10285
10398
  fragment RoutingTransactionFragment on RoutingTransaction {
10286
10399
  __typename
10287
10400
  routing_transaction_id: id
@@ -10329,15 +10442,15 @@ query GetRoutingTransaction($id: ID!) {
10329
10442
  }
10330
10443
  }
10331
10444
 
10332
- ${FRAGMENT29}
10445
+ ${FRAGMENT31}
10333
10446
  `,
10334
10447
  variables: { id },
10335
- constructObject: (data) => (0, import_core31.isObject)(data) && "entity" in data && (0, import_core31.isObject)(data.entity) ? RoutingTransactionFromJson(data.entity) : null
10448
+ constructObject: (data) => (0, import_core33.isObject)(data) && "entity" in data && (0, import_core33.isObject)(data.entity) ? RoutingTransactionFromJson(data.entity) : null
10336
10449
  };
10337
10450
  };
10338
10451
 
10339
10452
  // src/objects/Signable.ts
10340
- var import_core32 = require("@lightsparkdev/core");
10453
+ var import_core34 = require("@lightsparkdev/core");
10341
10454
  var SignableFromJson = (obj) => {
10342
10455
  return {
10343
10456
  id: obj["signable_id"],
@@ -10346,7 +10459,7 @@ var SignableFromJson = (obj) => {
10346
10459
  typename: "Signable"
10347
10460
  };
10348
10461
  };
10349
- var FRAGMENT30 = `
10462
+ var FRAGMENT32 = `
10350
10463
  fragment SignableFragment on Signable {
10351
10464
  __typename
10352
10465
  signable_id: id
@@ -10364,10 +10477,10 @@ query GetSignable($id: ID!) {
10364
10477
  }
10365
10478
  }
10366
10479
 
10367
- ${FRAGMENT30}
10480
+ ${FRAGMENT32}
10368
10481
  `,
10369
10482
  variables: { id },
10370
- constructObject: (data) => (0, import_core32.isObject)(data) && "entity" in data && (0, import_core32.isObject)(data.entity) ? SignableFromJson(data.entity) : null
10483
+ constructObject: (data) => (0, import_core34.isObject)(data) && "entity" in data && (0, import_core34.isObject)(data.entity) ? SignableFromJson(data.entity) : null
10371
10484
  };
10372
10485
  };
10373
10486
 
@@ -10389,7 +10502,7 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
10389
10502
  var TransactionType_default = TransactionType;
10390
10503
 
10391
10504
  // src/objects/UmaInvitation.ts
10392
- var import_core33 = require("@lightsparkdev/core");
10505
+ var import_core35 = require("@lightsparkdev/core");
10393
10506
  var UmaInvitationFromJson = (obj) => {
10394
10507
  return {
10395
10508
  id: obj["uma_invitation_id"],
@@ -10404,7 +10517,7 @@ var UmaInvitationFromJson = (obj) => {
10404
10517
  incentivesIneligibilityReason: !!obj["uma_invitation_incentives_ineligibility_reason"] ? IncentivesIneligibilityReason_default[obj["uma_invitation_incentives_ineligibility_reason"]] ?? IncentivesIneligibilityReason_default.FUTURE_VALUE : null
10405
10518
  };
10406
10519
  };
10407
- var FRAGMENT31 = `
10520
+ var FRAGMENT33 = `
10408
10521
  fragment UmaInvitationFragment on UmaInvitation {
10409
10522
  __typename
10410
10523
  uma_invitation_id: id
@@ -10428,10 +10541,10 @@ query GetUmaInvitation($id: ID!) {
10428
10541
  }
10429
10542
  }
10430
10543
 
10431
- ${FRAGMENT31}
10544
+ ${FRAGMENT33}
10432
10545
  `,
10433
10546
  variables: { id },
10434
- constructObject: (data) => (0, import_core33.isObject)(data) && "entity" in data && (0, import_core33.isObject)(data.entity) ? UmaInvitationFromJson(data.entity) : null
10547
+ constructObject: (data) => (0, import_core35.isObject)(data) && "entity" in data && (0, import_core35.isObject)(data.entity) ? UmaInvitationFromJson(data.entity) : null
10435
10548
  };
10436
10549
  };
10437
10550
 
@@ -10511,6 +10624,8 @@ var WebhookEventType_default = WebhookEventType;
10511
10624
  getLightsparkNodeOwnerQuery,
10512
10625
  getLightsparkNodeQuery,
10513
10626
  getNodeQuery,
10627
+ getOfferDataQuery,
10628
+ getOfferQuery,
10514
10629
  getOnChainTransactionQuery,
10515
10630
  getPaymentRequestQuery,
10516
10631
  getRoutingTransactionQuery,
@@ -1,4 +1,4 @@
1
- export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as AccountToWithdrawalRequestsConnection, h as ApiToken, j as AuditLogActor, B as Balances, l as BlockchainBalance, C as CancelInvoiceInput, m as CancelInvoiceOutput, n as Channel, o as ChannelClosingTransaction, q as ChannelFees, r as ChannelOpeningTransaction, t as ChannelSnapshot, v as ChannelStatus, w as ChannelToTransactionsConnection, x as ClaimUmaInvitationInput, y as ClaimUmaInvitationOutput, z as ClaimUmaInvitationWithIncentivesInput, D as ClaimUmaInvitationWithIncentivesOutput, E as ComplianceProvider, F as Connection, G as CreateApiTokenInput, H as CreateApiTokenOutput, I as CreateInvitationWithIncentivesInput, J as CreateInvitationWithIncentivesOutput, K as CreateInvoiceInput, M as CreateInvoiceOutput, N as CreateLnurlInvoiceInput, O as CreateNodeWalletAddressInput, P as CreateNodeWalletAddressOutput, Q as CreateTestModeInvoiceInput, R as CreateTestModeInvoiceOutput, S as CreateTestModePaymentInput, T as CreateTestModePaymentoutput, U as CreateUmaInvitationInput, V as CreateUmaInvitationOutput, X as CreateUmaInvoiceInput, Y as CurrencyAmount, Z as CurrencyUnit, _ as DailyLiquidityForecast, $ as DeclineToSignMessagesInput, a0 as DeclineToSignMessagesOutput, a1 as DeleteApiTokenInput, a2 as DeleteApiTokenOutput, a3 as Deposit, a5 as Entity, a6 as FailHtlcsInput, a7 as FailHtlcsOutput, a8 as FeeEstimate, a9 as FundNodeInput, aa as FundNodeOutput, ab as GraphNode, ac as Hop, ae as HtlcAttemptFailureCode, af as IdAndSignature, ag as IncentivesIneligibilityReason, ah as IncentivesStatus, ai as IncomingPayment, aj as IncomingPaymentAttempt, al as IncomingPaymentAttemptStatus, aq as IncomingPaymentToAttemptsConnection, am as IncomingPaymentsForInvoiceQueryInput, an as IncomingPaymentsForInvoiceQueryOutput, ao as IncomingPaymentsForPaymentHashQueryInput, ap as IncomingPaymentsForPaymentHashQueryOutput, ar as Invoice, at as InvoiceData, au as InvoiceForPaymentHashInput, av as InvoiceForPaymentHashOutput, aw as InvoiceType, ax as LightningFeeEstimateForInvoiceInput, ay as LightningFeeEstimateForNodeInput, az as LightningFeeEstimateOutput, aA as LightningPaymentDirection, aB as LightningTransaction, aD as LightsparkNode, aF as LightsparkNodeOwner, aH as LightsparkNodeStatus, aI as LightsparkNodeToChannelsConnection, aJ as LightsparkNodeToDailyLiquidityForecastsConnection, aK as LightsparkNodeWithOSK, aL as LightsparkNodeWithRemoteSigning, aM as MultiSigAddressValidationParameters, aN as Node, aP as NodeAddress, aQ as NodeAddressType, aR as NodeToAddressesConnection, aS as OnChainFeeTarget, aT as OnChainTransaction, aV as OutgoingPayment, aW as OutgoingPaymentAttempt, aX as OutgoingPaymentAttemptStatus, aY as OutgoingPaymentAttemptToHopsConnection, aZ as OutgoingPaymentForIdempotencyKeyInput, a_ as OutgoingPaymentForIdempotencyKeyOutput, b3 as OutgoingPaymentToAttemptsConnection, a$ as OutgoingPaymentsForInvoiceQueryInput, b0 as OutgoingPaymentsForInvoiceQueryOutput, b1 as OutgoingPaymentsForPaymentHashQueryInput, b2 as OutgoingPaymentsForPaymentHashQueryOutput, b4 as PageInfo, b5 as PayInvoiceInput, b6 as PayInvoiceOutput, bd as PayUmaInvoiceInput, b7 as PaymentDirection, b8 as PaymentFailureReason, b9 as PaymentRequest, bb as PaymentRequestData, bc as PaymentRequestStatus, be as Permission, bf as PostTransactionData, bg as RegionCode, bh as RegisterPaymentInput, bi as RegisterPaymentOutput, bj as ReleaseChannelPerCommitmentSecretInput, bk as ReleaseChannelPerCommitmentSecretOutput, bl as ReleasePaymentPreimageInput, bm as ReleasePaymentPreimageOutput, bn as RemoteSigningSubEventType, bo as RequestInitiator, bp as RequestWithdrawalInput, bq as RequestWithdrawalOutput, br as RichText, bs as RiskRating, bt as RoutingTransaction, bv as RoutingTransactionFailureReason, bw as ScreenNodeInput, bx as ScreenNodeOutput, by as Secret, bz as SendPaymentInput, bA as SendPaymentOutput, bB as SetInvoicePaymentHashInput, bC as SetInvoicePaymentHashOutput, bI as SignInvoiceInput, bJ as SignInvoiceOutput, bK as SignMessagesInput, bL as SignMessagesOutput, bD as Signable, bF as SignablePayload, bH as SignablePayloadStatus, bM as SingleNodeDashboard, bN as Transaction, bP as TransactionFailures, bQ as TransactionStatus, bR as TransactionType, bS as TransactionUpdate, bT as UmaInvitation, bV as UpdateChannelPerCommitmentPointInput, bW as UpdateChannelPerCommitmentPointOutput, bX as UpdateNodeSharedSecretInput, bY as UpdateNodeSharedSecretOutput, bZ as Wallet, b_ as WalletStatus, b$ as WalletToPaymentRequestsConnection, c0 as WalletToTransactionsConnection, c1 as WalletToWithdrawalRequestsConnection, W as WebhookEventType, c2 as Withdrawal, c4 as WithdrawalFeeEstimateInput, c5 as WithdrawalFeeEstimateOutput, c6 as WithdrawalMode, c7 as WithdrawalRequest, c8 as WithdrawalRequestStatus, c9 as WithdrawalRequestToChannelClosingTransactionsConnection, ca as WithdrawalRequestToChannelOpeningTransactionsConnection, cb as WithdrawalRequestToWithdrawalsConnection, i as getApiTokenQuery, k as getAuditLogActorQuery, p as getChannelClosingTransactionQuery, s as getChannelOpeningTransactionQuery, u as getChannelSnapshotQuery, a4 as getDepositQuery, ad as getHopQuery, ak as getIncomingPaymentAttemptQuery, as as getInvoiceQuery, aC as getLightningTransactionQuery, aG as getLightsparkNodeOwnerQuery, aE as getLightsparkNodeQuery, aO as getNodeQuery, aU as getOnChainTransactionQuery, ba as getPaymentRequestQuery, bu as getRoutingTransactionQuery, bG as getSignablePayloadQuery, bE as getSignableQuery, bO as getTransactionQuery, bU as getUmaInvitationQuery, c3 as getWithdrawalQuery } from '../index-jTkpKHc9.cjs';
1
+ export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as AccountToWithdrawalRequestsConnection, h as ApiToken, j as AuditLogActor, B as Balances, l as BlockchainBalance, C as CancelInvoiceInput, m as CancelInvoiceOutput, n as Channel, o as ChannelClosingTransaction, q as ChannelFees, r as ChannelOpeningTransaction, t as ChannelSnapshot, v as ChannelStatus, w as ChannelToTransactionsConnection, x as ClaimUmaInvitationInput, y as ClaimUmaInvitationOutput, z as ClaimUmaInvitationWithIncentivesInput, D as ClaimUmaInvitationWithIncentivesOutput, E as ComplianceProvider, F as Connection, G as CreateApiTokenInput, H as CreateApiTokenOutput, I as CreateInvitationWithIncentivesInput, J as CreateInvitationWithIncentivesOutput, K as CreateInvoiceInput, M as CreateInvoiceOutput, N as CreateLnurlInvoiceInput, O as CreateNodeWalletAddressInput, P as CreateNodeWalletAddressOutput, Q as CreateOfferInput, R as CreateOfferOutput, S as CreateTestModeInvoiceInput, T as CreateTestModeInvoiceOutput, U as CreateTestModePaymentInput, V as CreateTestModePaymentoutput, X as CreateUmaInvitationInput, Y as CreateUmaInvitationOutput, Z as CreateUmaInvoiceInput, _ as CurrencyAmount, $ as CurrencyAmountInput, a0 as CurrencyUnit, a1 as DailyLiquidityForecast, a2 as DeclineToSignMessagesInput, a3 as DeclineToSignMessagesOutput, a4 as DeleteApiTokenInput, a5 as DeleteApiTokenOutput, a6 as Deposit, a8 as Entity, a9 as FailHtlcsInput, aa as FailHtlcsOutput, ab as FeeEstimate, ac as FundNodeInput, ad as FundNodeOutput, ae as GraphNode, af as Hop, ah as HtlcAttemptFailureCode, ai as IdAndSignature, aj as IncentivesIneligibilityReason, ak as IncentivesStatus, al as IncomingPayment, am as IncomingPaymentAttempt, ao as IncomingPaymentAttemptStatus, at as IncomingPaymentToAttemptsConnection, ap as IncomingPaymentsForInvoiceQueryInput, aq as IncomingPaymentsForInvoiceQueryOutput, ar as IncomingPaymentsForPaymentHashQueryInput, as as IncomingPaymentsForPaymentHashQueryOutput, au as Invoice, aw as InvoiceData, ax as InvoiceForPaymentHashInput, ay as InvoiceForPaymentHashOutput, az as InvoiceType, aA as LightningFeeEstimateForInvoiceInput, aB as LightningFeeEstimateForNodeInput, aC as LightningFeeEstimateOutput, aD as LightningPaymentDirection, aE as LightningTransaction, aG as LightsparkNode, aI as LightsparkNodeOwner, aK as LightsparkNodeStatus, aL as LightsparkNodeToChannelsConnection, aM as LightsparkNodeToDailyLiquidityForecastsConnection, aN as LightsparkNodeWithOSK, aO as LightsparkNodeWithRemoteSigning, aP as MultiSigAddressValidationParameters, aQ as Node, aS as NodeAddress, aT as NodeAddressType, aU as NodeToAddressesConnection, aV as Offer, aX as OfferData, aZ as OnChainFeeTarget, a_ as OnChainTransaction, b0 as OutgoingPayment, b1 as OutgoingPaymentAttempt, b2 as OutgoingPaymentAttemptStatus, b3 as OutgoingPaymentAttemptToHopsConnection, b4 as OutgoingPaymentForIdempotencyKeyInput, b5 as OutgoingPaymentForIdempotencyKeyOutput, ba as OutgoingPaymentToAttemptsConnection, b6 as OutgoingPaymentsForInvoiceQueryInput, b7 as OutgoingPaymentsForInvoiceQueryOutput, b8 as OutgoingPaymentsForPaymentHashQueryInput, b9 as OutgoingPaymentsForPaymentHashQueryOutput, bb as PageInfo, bc as PayInvoiceInput, bd as PayInvoiceOutput, bk as PayOfferInput, bl as PayOfferOutput, bm as PayTestModeInvoiceInput, bn as PayUmaInvoiceInput, be as PaymentDirection, bf as PaymentFailureReason, bg as PaymentRequest, bi as PaymentRequestData, bj as PaymentRequestStatus, bo as Permission, bp as PostTransactionData, bq as RegionCode, br as RegisterPaymentInput, bs as RegisterPaymentOutput, bt as ReleaseChannelPerCommitmentSecretInput, bu as ReleaseChannelPerCommitmentSecretOutput, bv as ReleasePaymentPreimageInput, bw as ReleasePaymentPreimageOutput, bx as RemoteSigningSubEventType, by as RequestInitiator, bz as RequestWithdrawalInput, bA as RequestWithdrawalOutput, bB as RichText, bC as RiskRating, bD as RoutingTransaction, bF as RoutingTransactionFailureReason, bG as ScreenNodeInput, bH as ScreenNodeOutput, bI as Secret, bJ as SendPaymentInput, bK as SendPaymentOutput, bL as SetInvoicePaymentHashInput, bM as SetInvoicePaymentHashOutput, bS as SignInvoiceInput, bT as SignInvoiceOutput, bU as SignMessagesInput, bV as SignMessagesOutput, bN as Signable, bP as SignablePayload, bR as SignablePayloadStatus, bW as SingleNodeDashboard, bX as Transaction, bZ as TransactionFailures, b_ as TransactionStatus, b$ as TransactionType, c0 as TransactionUpdate, c1 as UmaInvitation, c3 as UpdateChannelPerCommitmentPointInput, c4 as UpdateChannelPerCommitmentPointOutput, c5 as UpdateNodeSharedSecretInput, c6 as UpdateNodeSharedSecretOutput, c7 as Wallet, c8 as WalletStatus, c9 as WalletToPaymentRequestsConnection, ca as WalletToTransactionsConnection, cb as WalletToWithdrawalRequestsConnection, W as WebhookEventType, cc as Withdrawal, ce as WithdrawalFeeEstimateInput, cf as WithdrawalFeeEstimateOutput, cg as WithdrawalMode, ch as WithdrawalRequest, ci as WithdrawalRequestStatus, cj as WithdrawalRequestToChannelClosingTransactionsConnection, ck as WithdrawalRequestToChannelOpeningTransactionsConnection, cl as WithdrawalRequestToWithdrawalsConnection, i as getApiTokenQuery, k as getAuditLogActorQuery, p as getChannelClosingTransactionQuery, s as getChannelOpeningTransactionQuery, u as getChannelSnapshotQuery, a7 as getDepositQuery, ag as getHopQuery, an as getIncomingPaymentAttemptQuery, av as getInvoiceQuery, aF as getLightningTransactionQuery, aJ as getLightsparkNodeOwnerQuery, aH as getLightsparkNodeQuery, aR as getNodeQuery, aY as getOfferDataQuery, aW as getOfferQuery, a$ as getOnChainTransactionQuery, bh as getPaymentRequestQuery, bE as getRoutingTransactionQuery, bQ as getSignablePayloadQuery, bO as getSignableQuery, bY as getTransactionQuery, c2 as getUmaInvitationQuery, cd as getWithdrawalQuery } from '../index-BxC6kyLD.cjs';
2
2
  export { B as BitcoinNetwork } from '../BitcoinNetwork-CIfB1c0X.cjs';
3
3
  import '@lightsparkdev/core';
4
4
  import 'zen-observable';