@lightsparkdev/lightspark-sdk 1.8.1 → 1.8.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @lightsparkdev/lightspark-sdk
2
2
 
3
+ ## 1.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 9d2f78a: - adds IncomingPaymentsForInvoice and OutgoingPaymentsForInvoice
8
+ - 9d2f78a: - Enable setting logging level on client
9
+
3
10
  ## 1.8.1
4
11
 
5
12
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { Maybe, Query, AuthProvider, CryptoInterface, SigningKey, KeyOrAliasType } from '@lightsparkdev/core';
1
+ import { Maybe, Query, AuthProvider, CryptoInterface, SigningKey, KeyOrAliasType, LoggingLevel } from '@lightsparkdev/core';
2
2
  import Observable from 'zen-observable';
3
3
  import { B as BitcoinNetwork } from './BitcoinNetwork-4f6ea015.js';
4
4
 
@@ -3376,6 +3376,20 @@ declare class LightsparkClient {
3376
3376
  * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
3377
3377
  */
3378
3378
  outgoingPaymentsForPaymentHash(paymentHash: string, statuses?: TransactionStatus[] | undefined): Promise<OutgoingPayment[]>;
3379
+ /**
3380
+ * Fetches Outgoing payments for a given invoice if there are any.
3381
+ *
3382
+ * @param encodedInvoice encoded invoice associated with outgoing payment
3383
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
3384
+ */
3385
+ outgoingPaymentsForInvoice(encodedInvoice: string, statuses?: TransactionStatus[] | undefined): Promise<OutgoingPayment[]>;
3386
+ /**
3387
+ * Fetches Incoming payments for a given invoice if there are any.
3388
+ *
3389
+ * @param invoiceId id of associated invoice
3390
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
3391
+ */
3392
+ incomingPaymentsForInvoice(invoiceId: string, statuses?: TransactionStatus[] | undefined): Promise<IncomingPayment[]>;
3379
3393
  private hashPhoneNumber;
3380
3394
  hashUmaIdentifier(identifier: string, signingPrivateKey: Uint8Array): Promise<string>;
3381
3395
  getUtcDateTime(): Date;
@@ -3390,6 +3404,13 @@ declare class LightsparkClient {
3390
3404
  * @returns The result of the query.
3391
3405
  */
3392
3406
  executeRawQuery<T>(query: Query<T>): Promise<T | null>;
3407
+ /**
3408
+ * Enable logging for debugging purposes
3409
+ *
3410
+ * @param enabled Whether logging should be enabled.
3411
+ * @param level The logging level to use.
3412
+ * */
3413
+ setLoggingEnabled(enabled: boolean, level?: LoggingLevel): void;
3393
3414
  }
3394
3415
 
3395
3416
  /** Audit log actor who called the GraphQL mutation **/
package/dist/index.cjs CHANGED
@@ -1981,12 +1981,12 @@ var AccountTokenAuthProvider = class {
1981
1981
  var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
1982
1982
 
1983
1983
  // src/client.ts
1984
- var import_core27 = require("@lightsparkdev/core");
1984
+ var import_core28 = require("@lightsparkdev/core");
1985
1985
 
1986
1986
  // package.json
1987
1987
  var package_default = {
1988
1988
  name: "@lightsparkdev/lightspark-sdk",
1989
- version: "1.8.1",
1989
+ version: "1.8.2",
1990
1990
  description: "Lightspark JS SDK",
1991
1991
  author: "Lightspark Inc.",
1992
1992
  keywords: [
@@ -5623,6 +5623,25 @@ var FundNode = `
5623
5623
  ${FRAGMENT}
5624
5624
  `;
5625
5625
 
5626
+ // src/graphql/IncomingPaymentsForInvoice.ts
5627
+ var IncomingPaymentsForInvoice = `
5628
+ query IncomingPaymentsForInvoice(
5629
+ $invoice_id: Hash32!,
5630
+ $statuses: [TransactionStatus!]
5631
+ ) {
5632
+ incoming_payments_for_invoice(input: {
5633
+ invoice_id: $invoice_id
5634
+ statuses: $statuses
5635
+ }) {
5636
+ payments {
5637
+ ...IncomingPaymentFragment
5638
+ }
5639
+ }
5640
+ }
5641
+
5642
+ ${FRAGMENT13}
5643
+ `;
5644
+
5626
5645
  // src/graphql/InvoiceForPaymentHash.ts
5627
5646
  var InvoiceForPaymentHash = `
5628
5647
  query InvoiceForPaymentHash($payment_hash: Hash32!) {
@@ -6642,6 +6661,25 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
6642
6661
  }`;
6643
6662
  var OutgoingPayment_default = OutgoingPayment;
6644
6663
 
6664
+ // src/graphql/OutgoingPaymentsForInvoice.ts
6665
+ var OutgoingPaymentsForInvoice = `
6666
+ query OutgoingPaymentsForInvoice(
6667
+ $encoded_invoice: Hash32!,
6668
+ $statuses: [TransactionStatus!]
6669
+ ) {
6670
+ outgoing_payments_for_invoice(input: {
6671
+ encoded_invoice: $encoded_invoice
6672
+ statuses: $statuses
6673
+ }) {
6674
+ payments {
6675
+ ...OutgoingPaymentFragment
6676
+ }
6677
+ }
6678
+ }
6679
+
6680
+ ${FRAGMENT17}
6681
+ `;
6682
+
6645
6683
  // src/graphql/OutgoingPaymentsForPaymentHash.ts
6646
6684
  var OutgoingPaymentsForPaymentHash = `
6647
6685
  query OutgoingPaymentsForPaymentHash(
@@ -8743,8 +8781,12 @@ var WithdrawalFeeEstimate = `
8743
8781
  ${FRAGMENT25}
8744
8782
  `;
8745
8783
 
8784
+ // src/logger.ts
8785
+ var import_core24 = require("@lightsparkdev/core");
8786
+ var logger = new import_core24.Logger("@lightsparkdev/lightspark-sdk");
8787
+
8746
8788
  // src/objects/Account.ts
8747
- var import_core26 = require("@lightsparkdev/core");
8789
+ var import_core27 = require("@lightsparkdev/core");
8748
8790
 
8749
8791
  // src/objects/AccountToApiTokensConnection.ts
8750
8792
  var AccountToApiTokensConnectionFromJson = (obj) => {
@@ -8773,7 +8815,7 @@ var AccountToChannelsConnectionFromJson = (obj) => {
8773
8815
  };
8774
8816
 
8775
8817
  // src/objects/LightsparkNode.ts
8776
- var import_core24 = require("@lightsparkdev/core");
8818
+ var import_core25 = require("@lightsparkdev/core");
8777
8819
  var LightsparkNodeFromJson = (obj) => {
8778
8820
  if (obj["__typename"] == "LightsparkNodeWithOSK") {
8779
8821
  return new LightsparkNodeWithOSK_default(
@@ -8844,7 +8886,7 @@ var LightsparkNodeFromJson = (obj) => {
8844
8886
  !!obj["lightspark_node_with_remote_signing_balances"] ? BalancesFromJson(obj["lightspark_node_with_remote_signing_balances"]) : void 0
8845
8887
  );
8846
8888
  }
8847
- throw new import_core24.LightsparkException(
8889
+ throw new import_core25.LightsparkException(
8848
8890
  "DeserializationError",
8849
8891
  `Couldn't find a concrete type for interface LightsparkNode corresponding to the typename=${obj["__typename"]}`
8850
8892
  );
@@ -9126,7 +9168,7 @@ query GetLightsparkNode($id: ID!) {
9126
9168
  ${FRAGMENT26}
9127
9169
  `,
9128
9170
  variables: { id },
9129
- constructObject: (data) => (0, import_core24.isObject)(data) && "entity" in data && (0, import_core24.isObject)(data.entity) ? LightsparkNodeFromJson(data.entity) : null
9171
+ constructObject: (data) => (0, import_core25.isObject)(data) && "entity" in data && (0, import_core25.isObject)(data.entity) ? LightsparkNodeFromJson(data.entity) : null
9130
9172
  };
9131
9173
  };
9132
9174
 
@@ -9180,7 +9222,7 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
9180
9222
  };
9181
9223
 
9182
9224
  // src/objects/Wallet.ts
9183
- var import_core25 = require("@lightsparkdev/core");
9225
+ var import_core26 = require("@lightsparkdev/core");
9184
9226
 
9185
9227
  // src/objects/WalletStatus.ts
9186
9228
  var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
@@ -10347,7 +10389,7 @@ query GetWallet($id: ID!) {
10347
10389
  ${FRAGMENT27}
10348
10390
  `,
10349
10391
  variables: { id },
10350
- constructObject: (data) => (0, import_core25.isObject)(data) && "entity" in data && (0, import_core25.isObject)(data.entity) ? WalletFromJson(data.entity) : null
10392
+ constructObject: (data) => (0, import_core26.isObject)(data) && "entity" in data && (0, import_core26.isObject)(data.entity) ? WalletFromJson(data.entity) : null
10351
10393
  };
10352
10394
  }
10353
10395
  toJson() {
@@ -12207,7 +12249,7 @@ query GetAccount {
12207
12249
  ${FRAGMENT28}
12208
12250
  `,
12209
12251
  variables: {},
12210
- constructObject: (data) => (0, import_core26.isObject)(data) && "current_account" in data && (0, import_core26.isObject)(data.current_account) ? AccountFromJson(data.current_account) : null
12252
+ constructObject: (data) => (0, import_core27.isObject)(data) && "current_account" in data && (0, import_core27.isObject)(data.current_account) ? AccountFromJson(data.current_account) : null
12211
12253
  };
12212
12254
  }
12213
12255
  toJson() {
@@ -12262,16 +12304,16 @@ var LightsparkClient = class {
12262
12304
  * For React Native, you should use the `ReactNativeCrypto`
12263
12305
  * implementation from `@lightsparkdev/react-native`.
12264
12306
  */
12265
- constructor(authProvider = new import_core27.StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = import_core27.DefaultCrypto) {
12307
+ constructor(authProvider = new import_core28.StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = import_core28.DefaultCrypto) {
12266
12308
  this.authProvider = authProvider;
12267
12309
  this.serverUrl = serverUrl;
12268
12310
  this.cryptoImpl = cryptoImpl;
12269
- this.nodeKeyCache = new import_core27.NodeKeyCache(this.cryptoImpl);
12311
+ this.nodeKeyCache = new import_core28.NodeKeyCache(this.cryptoImpl);
12270
12312
  this.nodeKeyLoaderCache = new NodeKeyLoaderCache(
12271
12313
  this.nodeKeyCache,
12272
12314
  this.cryptoImpl
12273
12315
  );
12274
- this.requester = new import_core27.Requester(
12316
+ this.requester = new import_core28.Requester(
12275
12317
  this.nodeKeyCache,
12276
12318
  this.LIGHTSPARK_SDK_ENDPOINT,
12277
12319
  `js-lightspark-sdk/${sdkVersion}`,
@@ -12318,7 +12360,7 @@ var LightsparkClient = class {
12318
12360
  * @param authProvider
12319
12361
  */
12320
12362
  setAuthProvider(authProvider) {
12321
- this.requester = new import_core27.Requester(
12363
+ this.requester = new import_core28.Requester(
12322
12364
  this.nodeKeyCache,
12323
12365
  this.LIGHTSPARK_SDK_ENDPOINT,
12324
12366
  `js-lightspark-sdk/${sdkVersion}`,
@@ -12423,10 +12465,10 @@ var LightsparkClient = class {
12423
12465
  network: bitcoinNetwork
12424
12466
  });
12425
12467
  if (!response.current_account) {
12426
- throw new import_core27.LightsparkAuthException("No current account");
12468
+ throw new import_core28.LightsparkAuthException("No current account");
12427
12469
  }
12428
12470
  if (!response.current_account.dashboard_overview_nodes || response.current_account.dashboard_overview_nodes.entities.length === 0) {
12429
- throw new import_core27.LightsparkException(
12471
+ throw new import_core28.LightsparkException(
12430
12472
  "NO_NODES_FOUND",
12431
12473
  `No nodes found for this dashboard request. This could mean one of a few things:
12432
12474
  1. You are requesting MAINNET nodes, but you have no MAINNET nodes yet. In this case, request BitcoinNetwork.REGTEST instead.
@@ -12497,11 +12539,11 @@ var LightsparkClient = class {
12497
12539
  }
12498
12540
  );
12499
12541
  if (!response.current_account) {
12500
- throw new import_core27.LightsparkAuthException("No current account");
12542
+ throw new import_core28.LightsparkAuthException("No current account");
12501
12543
  }
12502
12544
  const account = response.current_account;
12503
12545
  if (!account.dashboard_overview_nodes || !account.dashboard_overview_nodes.entities || account.dashboard_overview_nodes.entities.length === 0) {
12504
- throw new import_core27.LightsparkException(
12546
+ throw new import_core28.LightsparkException(
12505
12547
  "InvalidOrMissingNode",
12506
12548
  "No nodes found for node dashboard"
12507
12549
  );
@@ -12595,7 +12637,7 @@ var LightsparkClient = class {
12595
12637
  * @returns An Invoice object representing the generated invoice.
12596
12638
  */
12597
12639
  async createLnurlInvoice(nodeId, amountMsats, metadata, expirySecs = void 0) {
12598
- const metadataHash = await (0, import_core27.createSha256Hash)(metadata, true);
12640
+ const metadataHash = await (0, import_core28.createSha256Hash)(metadata, true);
12599
12641
  const variables = {
12600
12642
  node_id: nodeId,
12601
12643
  amount_msats: amountMsats,
@@ -12634,11 +12676,11 @@ var LightsparkClient = class {
12634
12676
  * @returns An Invoice object representing the generated invoice.
12635
12677
  */
12636
12678
  async createUmaInvoice(nodeId, amountMsats, metadata, expirySecs = void 0, signingPrivateKey = void 0, receiverIdentifier = void 0) {
12637
- const metadataHash = await (0, import_core27.createSha256Hash)(metadata, true);
12679
+ const metadataHash = await (0, import_core28.createSha256Hash)(metadata, true);
12638
12680
  let receiverHash = void 0;
12639
12681
  if (receiverIdentifier !== void 0) {
12640
12682
  if (signingPrivateKey == void 0) {
12641
- throw new import_core27.LightsparkException(
12683
+ throw new import_core28.LightsparkException(
12642
12684
  "CreateUmaInvoiceError",
12643
12685
  "Receiver identifier provided without signing private key"
12644
12686
  );
@@ -12779,7 +12821,7 @@ var LightsparkClient = class {
12779
12821
  }
12780
12822
  });
12781
12823
  if (!response) {
12782
- throw new import_core27.LightsparkException(
12824
+ throw new import_core28.LightsparkException(
12783
12825
  "WithdrawalFeeEstimateError",
12784
12826
  "Null or invalid fee estimate response from server"
12785
12827
  );
@@ -12796,7 +12838,7 @@ var LightsparkClient = class {
12796
12838
  await this.nodeKeyCache.loadKey(
12797
12839
  nodeId,
12798
12840
  signingPrivateKeyOrAlias,
12799
- import_core27.SigningKeyType.RSASigningKey
12841
+ import_core28.SigningKeyType.RSASigningKey
12800
12842
  );
12801
12843
  }
12802
12844
  /**
@@ -12820,7 +12862,7 @@ var LightsparkClient = class {
12820
12862
  */
12821
12863
  async payInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
12822
12864
  if (!this.nodeKeyCache.hasKey(payerNodeId)) {
12823
- throw new import_core27.LightsparkSigningException("Paying node is not unlocked");
12865
+ throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
12824
12866
  }
12825
12867
  const variables = {
12826
12868
  node_id: payerNodeId,
@@ -12837,7 +12879,7 @@ var LightsparkClient = class {
12837
12879
  payerNodeId
12838
12880
  );
12839
12881
  if (response.pay_invoice?.payment.outgoing_payment_failure_message) {
12840
- throw new import_core27.LightsparkException(
12882
+ throw new import_core28.LightsparkException(
12841
12883
  "PaymentError",
12842
12884
  response.pay_invoice?.payment.outgoing_payment_failure_message.rich_text_text
12843
12885
  );
@@ -12869,12 +12911,12 @@ var LightsparkClient = class {
12869
12911
  */
12870
12912
  async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0, signingPrivateKey = void 0, senderIdentifier = void 0) {
12871
12913
  if (!this.nodeKeyCache.hasKey(payerNodeId)) {
12872
- throw new import_core27.LightsparkSigningException("Paying node is not unlocked");
12914
+ throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
12873
12915
  }
12874
12916
  let senderHash = void 0;
12875
12917
  if (senderIdentifier !== void 0) {
12876
12918
  if (signingPrivateKey == void 0) {
12877
- throw new import_core27.LightsparkException(
12919
+ throw new import_core28.LightsparkException(
12878
12920
  "PayUmaInvoiceError",
12879
12921
  "Sender identifier provided without signing private key"
12880
12922
  );
@@ -12902,7 +12944,7 @@ var LightsparkClient = class {
12902
12944
  payerNodeId
12903
12945
  );
12904
12946
  if (response.pay_uma_invoice?.payment.outgoing_payment_failure_message) {
12905
- throw new import_core27.LightsparkException(
12947
+ throw new import_core28.LightsparkException(
12906
12948
  "PaymentError",
12907
12949
  response.pay_uma_invoice?.payment.outgoing_payment_failure_message.rich_text_text
12908
12950
  );
@@ -12920,7 +12962,7 @@ var LightsparkClient = class {
12920
12962
  const pollIntervalMs = 250;
12921
12963
  const pollMaxTimeouts = pollTimeoutSecs * 1e3 / pollIntervalMs;
12922
12964
  const pollIgnoreErrors = false;
12923
- const transaction = await (0, import_core27.pollUntil)(
12965
+ const transaction = await (0, import_core28.pollUntil)(
12924
12966
  () => {
12925
12967
  return this.getTransaction(transactionId);
12926
12968
  },
@@ -12940,7 +12982,7 @@ var LightsparkClient = class {
12940
12982
  pollIntervalMs,
12941
12983
  pollMaxTimeouts,
12942
12984
  pollIgnoreErrors,
12943
- () => new import_core27.LightsparkException(
12985
+ () => new import_core28.LightsparkException(
12944
12986
  "Timeout",
12945
12987
  "Timeout waiting for transaction to complete."
12946
12988
  )
@@ -12964,7 +13006,7 @@ var LightsparkClient = class {
12964
13006
  */
12965
13007
  async sendPayment(payerNodeId, destinationPublicKey, timeoutSecs = 60, amountMsats, maximumFeesMsats) {
12966
13008
  if (!this.nodeKeyCache.hasKey(payerNodeId)) {
12967
- throw new import_core27.LightsparkSigningException("Paying node is not unlocked");
13009
+ throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
12968
13010
  }
12969
13011
  const response = await this.requester.makeRawRequest(
12970
13012
  SendPayment,
@@ -12978,7 +13020,7 @@ var LightsparkClient = class {
12978
13020
  payerNodeId
12979
13021
  );
12980
13022
  if (response.send_payment?.payment.outgoing_payment_failure_message) {
12981
- throw new import_core27.LightsparkException(
13023
+ throw new import_core28.LightsparkException(
12982
13024
  "PaymentError",
12983
13025
  response.send_payment?.payment.outgoing_payment_failure_message.rich_text_text
12984
13026
  );
@@ -13105,7 +13147,7 @@ var LightsparkClient = class {
13105
13147
  constructObject: (responseJson) => {
13106
13148
  const encodedPaymentRequest = responseJson.create_test_mode_invoice?.encoded_payment_request;
13107
13149
  if (!encodedPaymentRequest) {
13108
- throw new import_core27.LightsparkException(
13150
+ throw new import_core28.LightsparkException(
13109
13151
  "CreateTestModeInvoiceError",
13110
13152
  "Unable to create test mode invoice"
13111
13153
  );
@@ -13156,7 +13198,7 @@ var LightsparkClient = class {
13156
13198
  },
13157
13199
  constructObject: (responseJson) => {
13158
13200
  if (responseJson.screen_node?.rating === void 0) {
13159
- throw new import_core27.LightsparkException(
13201
+ throw new import_core28.LightsparkException(
13160
13202
  "ScreenNodeError",
13161
13203
  "Unable to screen node"
13162
13204
  );
@@ -13188,7 +13230,7 @@ var LightsparkClient = class {
13188
13230
  },
13189
13231
  constructObject: (responseJson) => {
13190
13232
  if (!responseJson.register_payment?.payment?.id) {
13191
- throw new import_core27.LightsparkException(
13233
+ throw new import_core28.LightsparkException(
13192
13234
  "RegisterPaymentError",
13193
13235
  "Unable to register payment"
13194
13236
  );
@@ -13212,7 +13254,7 @@ var LightsparkClient = class {
13212
13254
  },
13213
13255
  constructObject: (responseJson) => {
13214
13256
  if (!responseJson.create_uma_invitation?.invitation) {
13215
- throw new import_core27.LightsparkException(
13257
+ throw new import_core28.LightsparkException(
13216
13258
  "CreateUmaInvitationError",
13217
13259
  "Unable to create UMA invitation"
13218
13260
  );
@@ -13241,7 +13283,7 @@ var LightsparkClient = class {
13241
13283
  },
13242
13284
  constructObject: (responseJson) => {
13243
13285
  if (!responseJson.create_uma_invitation_with_incentives?.invitation) {
13244
- throw new import_core27.LightsparkException(
13286
+ throw new import_core28.LightsparkException(
13245
13287
  "CreateUmaInvitationError",
13246
13288
  "Unable to create UMA invitation"
13247
13289
  );
@@ -13269,7 +13311,7 @@ var LightsparkClient = class {
13269
13311
  },
13270
13312
  constructObject: (responseJson) => {
13271
13313
  if (!responseJson.claim_uma_invitation?.invitation) {
13272
- throw new import_core27.LightsparkException(
13314
+ throw new import_core28.LightsparkException(
13273
13315
  "ClaimUmaInvitationError",
13274
13316
  "Unable to claim UMA invitation"
13275
13317
  );
@@ -13301,7 +13343,7 @@ var LightsparkClient = class {
13301
13343
  },
13302
13344
  constructObject: (responseJson) => {
13303
13345
  if (!responseJson.claim_uma_invitation_with_incentives?.invitation) {
13304
- throw new import_core27.LightsparkException(
13346
+ throw new import_core28.LightsparkException(
13305
13347
  "ClaimUmaInvitationError",
13306
13348
  "Unable to claim UMA invitation"
13307
13349
  );
@@ -13375,20 +13417,66 @@ var LightsparkClient = class {
13375
13417
  }
13376
13418
  });
13377
13419
  }
13420
+ /**
13421
+ * Fetches Outgoing payments for a given invoice if there are any.
13422
+ *
13423
+ * @param encodedInvoice encoded invoice associated with outgoing payment
13424
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
13425
+ */
13426
+ async outgoingPaymentsForInvoice(encodedInvoice, statuses = void 0) {
13427
+ return await this.executeRawQuery({
13428
+ queryPayload: OutgoingPaymentsForInvoice,
13429
+ variables: {
13430
+ encoded_invoice: encodedInvoice,
13431
+ statuses
13432
+ },
13433
+ constructObject: (responseJson) => {
13434
+ if (!responseJson.outgoing_payments_for_invoice || !responseJson.outgoing_payments_for_invoice.payments) {
13435
+ return [];
13436
+ }
13437
+ return responseJson.outgoing_payments_for_invoice.payments.map(
13438
+ (payment) => OutgoingPaymentFromJson(payment)
13439
+ );
13440
+ }
13441
+ });
13442
+ }
13443
+ /**
13444
+ * Fetches Incoming payments for a given invoice if there are any.
13445
+ *
13446
+ * @param invoiceId id of associated invoice
13447
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
13448
+ */
13449
+ async incomingPaymentsForInvoice(invoiceId, statuses = void 0) {
13450
+ return await this.executeRawQuery({
13451
+ queryPayload: IncomingPaymentsForInvoice,
13452
+ variables: {
13453
+ invoice_id: invoiceId,
13454
+ statuses
13455
+ },
13456
+ constructObject: (responseJson) => {
13457
+ if (!responseJson.incoming_payments_for_invoice || !responseJson.incoming_payments_for_invoice.payments) {
13458
+ return [];
13459
+ }
13460
+ return responseJson.incoming_payments_for_invoice.payments.map(
13461
+ (payment) => IncomingPaymentFromJson(payment)
13462
+ );
13463
+ }
13464
+ });
13465
+ }
13378
13466
  async hashPhoneNumber(e164PhoneNumber) {
13379
13467
  const e164PhoneRegex = /^\+[1-9]\d{1,14}$/;
13380
13468
  if (!e164PhoneRegex.test(e164PhoneNumber)) {
13381
- throw new import_core27.LightsparkException(
13469
+ throw new import_core28.LightsparkException(
13382
13470
  "InvalidPhoneNumber",
13383
13471
  "Invalid phone number. Phone number must be in E164 format."
13384
13472
  );
13385
13473
  }
13386
- return await (0, import_core27.createSha256Hash)(e164PhoneNumber, true);
13474
+ return await (0, import_core28.createSha256Hash)(e164PhoneNumber, true);
13387
13475
  }
13388
13476
  async hashUmaIdentifier(identifier, signingPrivateKey) {
13389
13477
  const now = this.getUtcDateTime();
13390
- const input = identifier + `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` + (0, import_core27.bytesToHex)(signingPrivateKey);
13391
- return await (0, import_core27.createSha256Hash)(input, true);
13478
+ const input = identifier + `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` + (0, import_core28.bytesToHex)(signingPrivateKey);
13479
+ return await (0, import_core28.createSha256Hash)(input, true);
13392
13480
  }
13393
13481
  getUtcDateTime() {
13394
13482
  return /* @__PURE__ */ new Date();
@@ -13406,6 +13494,16 @@ var LightsparkClient = class {
13406
13494
  executeRawQuery(query) {
13407
13495
  return this.requester.executeQuery(query);
13408
13496
  }
13497
+ /**
13498
+ * Enable logging for debugging purposes
13499
+ *
13500
+ * @param enabled Whether logging should be enabled.
13501
+ * @param level The logging level to use.
13502
+ * */
13503
+ setLoggingEnabled(enabled, level = import_core28.LoggingLevel.Info) {
13504
+ import_core28.logger.setEnabled(enabled, level);
13505
+ logger.setEnabled(enabled, level);
13506
+ }
13409
13507
  };
13410
13508
  var client_default = LightsparkClient;
13411
13509
 
@@ -13434,7 +13532,7 @@ var getBitcoinNetworkOrThrow = (bitcoinNetwork) => {
13434
13532
  };
13435
13533
 
13436
13534
  // src/objects/AuditLogActor.ts
13437
- var import_core28 = require("@lightsparkdev/core");
13535
+ var import_core29 = require("@lightsparkdev/core");
13438
13536
  var AuditLogActorFromJson = (obj) => {
13439
13537
  if (obj["__typename"] == "ApiToken") {
13440
13538
  return {
@@ -13448,7 +13546,7 @@ var AuditLogActorFromJson = (obj) => {
13448
13546
  typename: "ApiToken"
13449
13547
  };
13450
13548
  }
13451
- throw new import_core28.LightsparkException(
13549
+ throw new import_core29.LightsparkException(
13452
13550
  "DeserializationError",
13453
13551
  `Couldn't find a concrete type for interface AuditLogActor corresponding to the typename=${obj["__typename"]}`
13454
13552
  );
@@ -13481,12 +13579,12 @@ query GetAuditLogActor($id: ID!) {
13481
13579
  ${FRAGMENT29}
13482
13580
  `,
13483
13581
  variables: { id },
13484
- constructObject: (data) => (0, import_core28.isObject)(data) && "entity" in data && (0, import_core28.isObject)(data.entity) ? AuditLogActorFromJson(data.entity) : null
13582
+ constructObject: (data) => (0, import_core29.isObject)(data) && "entity" in data && (0, import_core29.isObject)(data.entity) ? AuditLogActorFromJson(data.entity) : null
13485
13583
  };
13486
13584
  };
13487
13585
 
13488
13586
  // src/objects/ChannelSnapshot.ts
13489
- var import_core29 = require("@lightsparkdev/core");
13587
+ var import_core30 = require("@lightsparkdev/core");
13490
13588
  var ChannelSnapshotFromJson = (obj) => {
13491
13589
  return {
13492
13590
  id: obj["channel_snapshot_id"],
@@ -13569,7 +13667,7 @@ query GetChannelSnapshot($id: ID!) {
13569
13667
  ${FRAGMENT30}
13570
13668
  `,
13571
13669
  variables: { id },
13572
- constructObject: (data) => (0, import_core29.isObject)(data) && "entity" in data && (0, import_core29.isObject)(data.entity) ? ChannelSnapshotFromJson(data.entity) : null
13670
+ constructObject: (data) => (0, import_core30.isObject)(data) && "entity" in data && (0, import_core30.isObject)(data.entity) ? ChannelSnapshotFromJson(data.entity) : null
13573
13671
  };
13574
13672
  };
13575
13673
 
@@ -13839,10 +13937,10 @@ var ComplianceProvider = /* @__PURE__ */ ((ComplianceProvider2) => {
13839
13937
  var ComplianceProvider_default = ComplianceProvider;
13840
13938
 
13841
13939
  // src/objects/Connection.ts
13842
- var import_core30 = require("@lightsparkdev/core");
13940
+ var import_core31 = require("@lightsparkdev/core");
13843
13941
 
13844
13942
  // src/objects/SignablePayload.ts
13845
- var import_core31 = require("@lightsparkdev/core");
13943
+ var import_core32 = require("@lightsparkdev/core");
13846
13944
 
13847
13945
  // src/objects/SignablePayloadStatus.ts
13848
13946
  var SignablePayloadStatus = /* @__PURE__ */ ((SignablePayloadStatus2) => {
@@ -13899,12 +13997,12 @@ query GetSignablePayload($id: ID!) {
13899
13997
  ${FRAGMENT31}
13900
13998
  `,
13901
13999
  variables: { id },
13902
- constructObject: (data) => (0, import_core31.isObject)(data) && "entity" in data && (0, import_core31.isObject)(data.entity) ? SignablePayloadFromJson(data.entity) : null
14000
+ constructObject: (data) => (0, import_core32.isObject)(data) && "entity" in data && (0, import_core32.isObject)(data.entity) ? SignablePayloadFromJson(data.entity) : null
13903
14001
  };
13904
14002
  };
13905
14003
 
13906
14004
  // src/objects/Deposit.ts
13907
- var import_core32 = require("@lightsparkdev/core");
14005
+ var import_core33 = require("@lightsparkdev/core");
13908
14006
  var DepositFromJson = (obj) => {
13909
14007
  return {
13910
14008
  id: obj["deposit_id"],
@@ -13970,12 +14068,12 @@ query GetDeposit($id: ID!) {
13970
14068
  ${FRAGMENT32}
13971
14069
  `,
13972
14070
  variables: { id },
13973
- constructObject: (data) => (0, import_core32.isObject)(data) && "entity" in data && (0, import_core32.isObject)(data.entity) ? DepositFromJson(data.entity) : null
14071
+ constructObject: (data) => (0, import_core33.isObject)(data) && "entity" in data && (0, import_core33.isObject)(data.entity) ? DepositFromJson(data.entity) : null
13974
14072
  };
13975
14073
  };
13976
14074
 
13977
14075
  // src/objects/LightningTransaction.ts
13978
- var import_core33 = require("@lightsparkdev/core");
14076
+ var import_core34 = require("@lightsparkdev/core");
13979
14077
  var LightningTransactionFromJson = (obj) => {
13980
14078
  if (obj["__typename"] == "IncomingPayment") {
13981
14079
  return new IncomingPayment_default(
@@ -14040,7 +14138,7 @@ var LightningTransactionFromJson = (obj) => {
14040
14138
  failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
14041
14139
  };
14042
14140
  }
14043
- throw new import_core33.LightsparkException(
14141
+ throw new import_core34.LightsparkException(
14044
14142
  "DeserializationError",
14045
14143
  `Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
14046
14144
  );
@@ -14482,12 +14580,12 @@ query GetLightningTransaction($id: ID!) {
14482
14580
  ${FRAGMENT33}
14483
14581
  `,
14484
14582
  variables: { id },
14485
- constructObject: (data) => (0, import_core33.isObject)(data) && "entity" in data && (0, import_core33.isObject)(data.entity) ? LightningTransactionFromJson(data.entity) : null
14583
+ constructObject: (data) => (0, import_core34.isObject)(data) && "entity" in data && (0, import_core34.isObject)(data.entity) ? LightningTransactionFromJson(data.entity) : null
14486
14584
  };
14487
14585
  };
14488
14586
 
14489
14587
  // src/objects/LightsparkNodeOwner.ts
14490
- var import_core34 = require("@lightsparkdev/core");
14588
+ var import_core35 = require("@lightsparkdev/core");
14491
14589
  var LightsparkNodeOwnerFromJson = (obj) => {
14492
14590
  if (obj["__typename"] == "Account") {
14493
14591
  return new Account_default(
@@ -14511,7 +14609,7 @@ var LightsparkNodeOwnerFromJson = (obj) => {
14511
14609
  obj["wallet_account"]?.id ?? void 0
14512
14610
  );
14513
14611
  }
14514
- throw new import_core34.LightsparkException(
14612
+ throw new import_core35.LightsparkException(
14515
14613
  "DeserializationError",
14516
14614
  `Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
14517
14615
  );
@@ -14580,7 +14678,7 @@ query GetLightsparkNodeOwner($id: ID!) {
14580
14678
  ${FRAGMENT34}
14581
14679
  `,
14582
14680
  variables: { id },
14583
- constructObject: (data) => (0, import_core34.isObject)(data) && "entity" in data && (0, import_core34.isObject)(data.entity) ? LightsparkNodeOwnerFromJson(data.entity) : null
14681
+ constructObject: (data) => (0, import_core35.isObject)(data) && "entity" in data && (0, import_core35.isObject)(data.entity) ? LightsparkNodeOwnerFromJson(data.entity) : null
14584
14682
  };
14585
14683
  };
14586
14684
 
@@ -14596,7 +14694,7 @@ var OnChainFeeTarget = /* @__PURE__ */ ((OnChainFeeTarget2) => {
14596
14694
  var OnChainFeeTarget_default = OnChainFeeTarget;
14597
14695
 
14598
14696
  // src/objects/OnChainTransaction.ts
14599
- var import_core35 = require("@lightsparkdev/core");
14697
+ var import_core36 = require("@lightsparkdev/core");
14600
14698
  var OnChainTransactionFromJson = (obj) => {
14601
14699
  if (obj["__typename"] == "ChannelClosingTransaction") {
14602
14700
  return {
@@ -14670,7 +14768,7 @@ var OnChainTransactionFromJson = (obj) => {
14670
14768
  numConfirmations: obj["withdrawal_num_confirmations"]
14671
14769
  };
14672
14770
  }
14673
- throw new import_core35.LightsparkException(
14771
+ throw new import_core36.LightsparkException(
14674
14772
  "DeserializationError",
14675
14773
  `Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
14676
14774
  );
@@ -14821,7 +14919,7 @@ query GetOnChainTransaction($id: ID!) {
14821
14919
  ${FRAGMENT35}
14822
14920
  `,
14823
14921
  variables: { id },
14824
- constructObject: (data) => (0, import_core35.isObject)(data) && "entity" in data && (0, import_core35.isObject)(data.entity) ? OnChainTransactionFromJson(data.entity) : null
14922
+ constructObject: (data) => (0, import_core36.isObject)(data) && "entity" in data && (0, import_core36.isObject)(data.entity) ? OnChainTransactionFromJson(data.entity) : null
14825
14923
  };
14826
14924
  };
14827
14925
 
@@ -14861,7 +14959,7 @@ var RiskRating = /* @__PURE__ */ ((RiskRating2) => {
14861
14959
  var RiskRating_default = RiskRating;
14862
14960
 
14863
14961
  // src/objects/RoutingTransaction.ts
14864
- var import_core36 = require("@lightsparkdev/core");
14962
+ var import_core37 = require("@lightsparkdev/core");
14865
14963
  var RoutingTransactionFromJson = (obj) => {
14866
14964
  return {
14867
14965
  id: obj["routing_transaction_id"],
@@ -14930,12 +15028,12 @@ query GetRoutingTransaction($id: ID!) {
14930
15028
  ${FRAGMENT36}
14931
15029
  `,
14932
15030
  variables: { id },
14933
- constructObject: (data) => (0, import_core36.isObject)(data) && "entity" in data && (0, import_core36.isObject)(data.entity) ? RoutingTransactionFromJson(data.entity) : null
15031
+ constructObject: (data) => (0, import_core37.isObject)(data) && "entity" in data && (0, import_core37.isObject)(data.entity) ? RoutingTransactionFromJson(data.entity) : null
14934
15032
  };
14935
15033
  };
14936
15034
 
14937
15035
  // src/objects/Signable.ts
14938
- var import_core37 = require("@lightsparkdev/core");
15036
+ var import_core38 = require("@lightsparkdev/core");
14939
15037
  var SignableFromJson = (obj) => {
14940
15038
  return {
14941
15039
  id: obj["signable_id"],
@@ -14965,7 +15063,7 @@ query GetSignable($id: ID!) {
14965
15063
  ${FRAGMENT37}
14966
15064
  `,
14967
15065
  variables: { id },
14968
- constructObject: (data) => (0, import_core37.isObject)(data) && "entity" in data && (0, import_core37.isObject)(data.entity) ? SignableFromJson(data.entity) : null
15066
+ constructObject: (data) => (0, import_core38.isObject)(data) && "entity" in data && (0, import_core38.isObject)(data.entity) ? SignableFromJson(data.entity) : null
14969
15067
  };
14970
15068
  };
14971
15069
 
@@ -15008,7 +15106,7 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
15008
15106
  var WebhookEventType_default = WebhookEventType;
15009
15107
 
15010
15108
  // src/webhooks.ts
15011
- var import_core38 = require("@lightsparkdev/core");
15109
+ var import_core39 = require("@lightsparkdev/core");
15012
15110
  var WEBHOOKS_SIGNATURE_HEADER = "lightspark-signature";
15013
15111
  var verifyAndParseWebhook = async (data, hexdigest, webhook_secret) => {
15014
15112
  const { createHmac } = await import("crypto");
@@ -15044,8 +15142,8 @@ var RemoteSigningWebhookHandler = class {
15044
15142
  this.validator = validator;
15045
15143
  }
15046
15144
  async handleWebhookRequest(data, webhookSignature, webhookSecret) {
15047
- if (!import_core38.isNode) {
15048
- throw new import_core38.LightsparkSigningException(
15145
+ if (!import_core39.isNode) {
15146
+ throw new import_core39.LightsparkSigningException(
15049
15147
  "Environment not supported for handling webhooks."
15050
15148
  );
15051
15149
  }
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AuthProvider } from '@lightsparkdev/core';
2
- import { W as WebhookEventType, L as LightsparkClient } from './index-9a69ef6a.js';
3
- 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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from './index-9a69ef6a.js';
2
+ import { W as WebhookEventType, L as LightsparkClient } from './index-27dad75b.js';
3
+ 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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from './index-27dad75b.js';
4
4
  import { B as BitcoinNetwork } from './BitcoinNetwork-4f6ea015.js';
5
5
  import 'zen-observable';
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AuthProvider } from '@lightsparkdev/core';
2
- import { W as WebhookEventType, L as LightsparkClient } from './index-9a69ef6a.js';
3
- 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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from './index-9a69ef6a.js';
2
+ import { W as WebhookEventType, L as LightsparkClient } from './index-27dad75b.js';
3
+ 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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from './index-27dad75b.js';
4
4
  import { B as BitcoinNetwork } from './BitcoinNetwork-4f6ea015.js';
5
5
  import 'zen-observable';
6
6
 
package/dist/index.js CHANGED
@@ -138,11 +138,13 @@ import {
138
138
  LightsparkAuthException,
139
139
  LightsparkException,
140
140
  LightsparkSigningException as LightsparkSigningException3,
141
+ LoggingLevel,
141
142
  NodeKeyCache,
142
143
  Requester,
143
144
  SigningKeyType as SigningKeyType2,
144
145
  StubAuthProvider,
145
146
  bytesToHex,
147
+ logger as coreLogger,
146
148
  createSha256Hash,
147
149
  pollUntil
148
150
  } from "@lightsparkdev/core";
@@ -150,7 +152,7 @@ import {
150
152
  // package.json
151
153
  var package_default = {
152
154
  name: "@lightsparkdev/lightspark-sdk",
153
- version: "1.8.1",
155
+ version: "1.8.2",
154
156
  description: "Lightspark JS SDK",
155
157
  author: "Lightspark Inc.",
156
158
  keywords: [
@@ -754,6 +756,25 @@ var FundNode = `
754
756
  ${FRAGMENT}
755
757
  `;
756
758
 
759
+ // src/graphql/IncomingPaymentsForInvoice.ts
760
+ var IncomingPaymentsForInvoice = `
761
+ query IncomingPaymentsForInvoice(
762
+ $invoice_id: Hash32!,
763
+ $statuses: [TransactionStatus!]
764
+ ) {
765
+ incoming_payments_for_invoice(input: {
766
+ invoice_id: $invoice_id
767
+ statuses: $statuses
768
+ }) {
769
+ payments {
770
+ ...IncomingPaymentFragment
771
+ }
772
+ }
773
+ }
774
+
775
+ ${FRAGMENT7}
776
+ `;
777
+
757
778
  // src/graphql/InvoiceForPaymentHash.ts
758
779
  var InvoiceForPaymentHash = `
759
780
  query InvoiceForPaymentHash($payment_hash: Hash32!) {
@@ -882,6 +903,25 @@ var MultiNodeDashboard = `
882
903
  ${FRAGMENT}
883
904
  `;
884
905
 
906
+ // src/graphql/OutgoingPaymentsForInvoice.ts
907
+ var OutgoingPaymentsForInvoice = `
908
+ query OutgoingPaymentsForInvoice(
909
+ $encoded_invoice: Hash32!,
910
+ $statuses: [TransactionStatus!]
911
+ ) {
912
+ outgoing_payments_for_invoice(input: {
913
+ encoded_invoice: $encoded_invoice
914
+ statuses: $statuses
915
+ }) {
916
+ payments {
917
+ ...OutgoingPaymentFragment
918
+ }
919
+ }
920
+ }
921
+
922
+ ${FRAGMENT9}
923
+ `;
924
+
885
925
  // src/graphql/OutgoingPaymentsForPaymentHash.ts
886
926
  var OutgoingPaymentsForPaymentHash = `
887
927
  query OutgoingPaymentsForPaymentHash(
@@ -1258,6 +1298,10 @@ var WithdrawalFeeEstimate = `
1258
1298
  ${FRAGMENT14}
1259
1299
  `;
1260
1300
 
1301
+ // src/logger.ts
1302
+ import { Logger } from "@lightsparkdev/core";
1303
+ var logger = new Logger("@lightsparkdev/lightspark-sdk");
1304
+
1261
1305
  // src/client.ts
1262
1306
  var sdkVersion = package_default.version;
1263
1307
  var LightsparkClient = class {
@@ -2385,6 +2429,52 @@ var LightsparkClient = class {
2385
2429
  }
2386
2430
  });
2387
2431
  }
2432
+ /**
2433
+ * Fetches Outgoing payments for a given invoice if there are any.
2434
+ *
2435
+ * @param encodedInvoice encoded invoice associated with outgoing payment
2436
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
2437
+ */
2438
+ async outgoingPaymentsForInvoice(encodedInvoice, statuses = void 0) {
2439
+ return await this.executeRawQuery({
2440
+ queryPayload: OutgoingPaymentsForInvoice,
2441
+ variables: {
2442
+ encoded_invoice: encodedInvoice,
2443
+ statuses
2444
+ },
2445
+ constructObject: (responseJson) => {
2446
+ if (!responseJson.outgoing_payments_for_invoice || !responseJson.outgoing_payments_for_invoice.payments) {
2447
+ return [];
2448
+ }
2449
+ return responseJson.outgoing_payments_for_invoice.payments.map(
2450
+ (payment) => OutgoingPaymentFromJson(payment)
2451
+ );
2452
+ }
2453
+ });
2454
+ }
2455
+ /**
2456
+ * Fetches Incoming payments for a given invoice if there are any.
2457
+ *
2458
+ * @param invoiceId id of associated invoice
2459
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
2460
+ */
2461
+ async incomingPaymentsForInvoice(invoiceId, statuses = void 0) {
2462
+ return await this.executeRawQuery({
2463
+ queryPayload: IncomingPaymentsForInvoice,
2464
+ variables: {
2465
+ invoice_id: invoiceId,
2466
+ statuses
2467
+ },
2468
+ constructObject: (responseJson) => {
2469
+ if (!responseJson.incoming_payments_for_invoice || !responseJson.incoming_payments_for_invoice.payments) {
2470
+ return [];
2471
+ }
2472
+ return responseJson.incoming_payments_for_invoice.payments.map(
2473
+ (payment) => IncomingPaymentFromJson(payment)
2474
+ );
2475
+ }
2476
+ });
2477
+ }
2388
2478
  async hashPhoneNumber(e164PhoneNumber) {
2389
2479
  const e164PhoneRegex = /^\+[1-9]\d{1,14}$/;
2390
2480
  if (!e164PhoneRegex.test(e164PhoneNumber)) {
@@ -2416,6 +2506,16 @@ var LightsparkClient = class {
2416
2506
  executeRawQuery(query) {
2417
2507
  return this.requester.executeQuery(query);
2418
2508
  }
2509
+ /**
2510
+ * Enable logging for debugging purposes
2511
+ *
2512
+ * @param enabled Whether logging should be enabled.
2513
+ * @param level The logging level to use.
2514
+ * */
2515
+ setLoggingEnabled(enabled, level = LoggingLevel.Info) {
2516
+ coreLogger.setEnabled(enabled, level);
2517
+ logger.setEnabled(enabled, level);
2518
+ }
2419
2519
  };
2420
2520
  var client_default = LightsparkClient;
2421
2521
 
@@ -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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from '../index-9a69ef6a.js';
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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from '../index-27dad75b.js';
2
2
  export { B as BitcoinNetwork } from '../BitcoinNetwork-4f6ea015.js';
3
3
  import '@lightsparkdev/core';
4
4
  import 'zen-observable';
@@ -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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from '../index-9a69ef6a.js';
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, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 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, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from '../index-27dad75b.js';
2
2
  export { B as BitcoinNetwork } from '../BitcoinNetwork-4f6ea015.js';
3
3
  import '@lightsparkdev/core';
4
4
  import 'zen-observable';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsparkdev/lightspark-sdk",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Lightspark JS SDK",
5
5
  "author": "Lightspark Inc.",
6
6
  "keywords": [
package/src/client.ts CHANGED
@@ -3,26 +3,26 @@
3
3
  import autoBind from "auto-bind";
4
4
  import type Observable from "zen-observable";
5
5
 
6
- import type {
7
- AuthProvider,
8
- CryptoInterface,
9
- KeyOrAliasType,
10
- Maybe,
11
- Query,
12
- SigningKey,
13
- } from "@lightsparkdev/core";
14
6
  import {
15
7
  DefaultCrypto,
16
8
  LightsparkAuthException,
17
9
  LightsparkException,
18
10
  LightsparkSigningException,
11
+ LoggingLevel,
19
12
  NodeKeyCache,
20
13
  Requester,
21
14
  SigningKeyType,
22
15
  StubAuthProvider,
23
16
  bytesToHex,
17
+ logger as coreLogger,
24
18
  createSha256Hash,
25
19
  pollUntil,
20
+ type AuthProvider,
21
+ type CryptoInterface,
22
+ type KeyOrAliasType,
23
+ type Maybe,
24
+ type Query,
25
+ type SigningKey,
26
26
  } from "@lightsparkdev/core";
27
27
  import packageJson from "../package.json";
28
28
  import NodeKeyLoaderCache from "./NodeKeyLoaderCache.js";
@@ -44,11 +44,13 @@ import { DecodeInvoice } from "./graphql/DecodeInvoice.js";
44
44
  import { DeleteApiToken } from "./graphql/DeleteApiToken.js";
45
45
  import { FetchUmaInvitation } from "./graphql/FetchUmaInvitation.js";
46
46
  import { FundNode } from "./graphql/FundNode.js";
47
+ import { IncomingPaymentsForInvoice } from "./graphql/IncomingPaymentsForInvoice.js";
47
48
  import { InvoiceForPaymentHash } from "./graphql/InvoiceForPaymentHash.js";
48
49
  import { LightningFeeEstimateForInvoice } from "./graphql/LightningFeeEstimateForInvoice.js";
49
50
  import { LightningFeeEstimateForNode } from "./graphql/LightningFeeEstimateForNode.js";
50
51
  import type { AccountDashboard } from "./graphql/MultiNodeDashboard.js";
51
52
  import { MultiNodeDashboard } from "./graphql/MultiNodeDashboard.js";
53
+ import { OutgoingPaymentsForInvoice } from "./graphql/OutgoingPaymentsForInvoice.js";
52
54
  import { OutgoingPaymentsForPaymentHash } from "./graphql/OutgoingPaymentsForPaymentHash.js";
53
55
  import { PayInvoice } from "./graphql/PayInvoice.js";
54
56
  import { PayUmaInvoice } from "./graphql/PayUmaInvoice.js";
@@ -62,6 +64,7 @@ import { TransactionSubscription } from "./graphql/TransactionSubscription.js";
62
64
  import { TransactionsForNode } from "./graphql/TransactionsForNode.js";
63
65
  import { WithdrawalFeeEstimate } from "./graphql/WithdrawalFeeEstimate.js";
64
66
  import { RiskRating, TransactionStatus } from "./index.js";
67
+ import { logger } from "./logger.js";
65
68
  import Account from "./objects/Account.js";
66
69
  import { ApiTokenFromJson } from "./objects/ApiToken.js";
67
70
  import BitcoinNetwork from "./objects/BitcoinNetwork.js";
@@ -1531,6 +1534,70 @@ class LightsparkClient {
1531
1534
  });
1532
1535
  }
1533
1536
 
1537
+ /**
1538
+ * Fetches Outgoing payments for a given invoice if there are any.
1539
+ *
1540
+ * @param encodedInvoice encoded invoice associated with outgoing payment
1541
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
1542
+ */
1543
+ public async outgoingPaymentsForInvoice(
1544
+ encodedInvoice: string,
1545
+ statuses: TransactionStatus[] | undefined = undefined,
1546
+ ): Promise<OutgoingPayment[]> {
1547
+ return await this.executeRawQuery({
1548
+ queryPayload: OutgoingPaymentsForInvoice,
1549
+ variables: {
1550
+ encoded_invoice: encodedInvoice,
1551
+ statuses: statuses,
1552
+ },
1553
+ constructObject: (responseJson: {
1554
+ outgoing_payments_for_invoice: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1555
+ }) => {
1556
+ if (
1557
+ !responseJson.outgoing_payments_for_invoice ||
1558
+ !responseJson.outgoing_payments_for_invoice.payments
1559
+ ) {
1560
+ return [];
1561
+ }
1562
+ return responseJson.outgoing_payments_for_invoice.payments.map(
1563
+ (payment) => OutgoingPaymentFromJson(payment),
1564
+ );
1565
+ },
1566
+ });
1567
+ }
1568
+
1569
+ /**
1570
+ * Fetches Incoming payments for a given invoice if there are any.
1571
+ *
1572
+ * @param invoiceId id of associated invoice
1573
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
1574
+ */
1575
+ public async incomingPaymentsForInvoice(
1576
+ invoiceId: string,
1577
+ statuses: TransactionStatus[] | undefined = undefined,
1578
+ ): Promise<IncomingPayment[]> {
1579
+ return await this.executeRawQuery({
1580
+ queryPayload: IncomingPaymentsForInvoice,
1581
+ variables: {
1582
+ invoice_id: invoiceId,
1583
+ statuses: statuses,
1584
+ },
1585
+ constructObject: (responseJson: {
1586
+ incoming_payments_for_invoice: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1587
+ }) => {
1588
+ if (
1589
+ !responseJson.incoming_payments_for_invoice ||
1590
+ !responseJson.incoming_payments_for_invoice.payments
1591
+ ) {
1592
+ return [];
1593
+ }
1594
+ return responseJson.incoming_payments_for_invoice.payments.map(
1595
+ (payment) => IncomingPaymentFromJson(payment),
1596
+ );
1597
+ },
1598
+ });
1599
+ }
1600
+
1534
1601
  private async hashPhoneNumber(e164PhoneNumber: string): Promise<string> {
1535
1602
  const e164PhoneRegex = /^\+[1-9]\d{1,14}$/;
1536
1603
  if (!e164PhoneRegex.test(e164PhoneNumber)) {
@@ -1571,6 +1638,20 @@ class LightsparkClient {
1571
1638
  public executeRawQuery<T>(query: Query<T>): Promise<T | null> {
1572
1639
  return this.requester.executeQuery(query);
1573
1640
  }
1641
+
1642
+ /**
1643
+ * Enable logging for debugging purposes
1644
+ *
1645
+ * @param enabled Whether logging should be enabled.
1646
+ * @param level The logging level to use.
1647
+ * */
1648
+ public setLoggingEnabled(
1649
+ enabled: boolean,
1650
+ level: LoggingLevel = LoggingLevel.Info,
1651
+ ) {
1652
+ coreLogger.setEnabled(enabled, level);
1653
+ logger.setEnabled(enabled, level);
1654
+ }
1574
1655
  }
1575
1656
 
1576
1657
  export default LightsparkClient;
@@ -0,0 +1,21 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as IncomingPaymentFragment } from "../objects/IncomingPayment.js";
4
+
5
+ export const IncomingPaymentsForInvoice = `
6
+ query IncomingPaymentsForInvoice(
7
+ $invoice_id: Hash32!,
8
+ $statuses: [TransactionStatus!]
9
+ ) {
10
+ incoming_payments_for_invoice(input: {
11
+ invoice_id: $invoice_id
12
+ statuses: $statuses
13
+ }) {
14
+ payments {
15
+ ...IncomingPaymentFragment
16
+ }
17
+ }
18
+ }
19
+
20
+ ${IncomingPaymentFragment}
21
+ `;
@@ -0,0 +1,21 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
4
+
5
+ export const OutgoingPaymentsForInvoice = `
6
+ query OutgoingPaymentsForInvoice(
7
+ $encoded_invoice: Hash32!,
8
+ $statuses: [TransactionStatus!]
9
+ ) {
10
+ outgoing_payments_for_invoice(input: {
11
+ encoded_invoice: $encoded_invoice
12
+ statuses: $statuses
13
+ }) {
14
+ payments {
15
+ ...OutgoingPaymentFragment
16
+ }
17
+ }
18
+ }
19
+
20
+ ${OutgoingPaymentFragment}
21
+ `;