@lightsparkdev/lightspark-sdk 1.5.13 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-FGFVWCTL.js → chunk-UHTZSOPX.js} +272 -144
  3. package/dist/{index-2b493387.d.ts → index-145ff316.d.ts} +232 -87
  4. package/dist/index.cjs +351 -142
  5. package/dist/index.d.cts +2 -2
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +85 -3
  8. package/dist/objects/index.cjs +262 -133
  9. package/dist/objects/index.d.cts +1 -1
  10. package/dist/objects/index.d.ts +1 -1
  11. package/dist/objects/index.js +3 -1
  12. package/package.json +2 -2
  13. package/src/client.ts +62 -0
  14. package/src/graphql/InvoiceForPaymentHash.ts +17 -0
  15. package/src/graphql/OutgoingPaymentsForPaymentHash.ts +21 -0
  16. package/src/objects/Account.ts +14 -2
  17. package/src/objects/ChannelClosingTransaction.ts +1 -4
  18. package/src/objects/ChannelOpeningTransaction.ts +1 -4
  19. package/src/objects/Connection.ts +116 -0
  20. package/src/objects/Deposit.ts +1 -4
  21. package/src/objects/Entity.ts +10 -0
  22. package/src/objects/FailHtlcsInput.ts +27 -0
  23. package/src/objects/FailHtlcsOutput.ts +26 -0
  24. package/src/objects/InvoiceForPaymentHashInput.ts +23 -0
  25. package/src/objects/InvoiceForPaymentHashOutput.ts +30 -0
  26. package/src/objects/LightningTransaction.ts +3 -0
  27. package/src/objects/LightsparkNode.ts +3 -1
  28. package/src/objects/LightsparkNodeWithOSK.ts +8 -4
  29. package/src/objects/LightsparkNodeWithRemoteSigning.ts +8 -4
  30. package/src/objects/OnChainFeeTarget.ts +19 -0
  31. package/src/objects/OnChainTransaction.ts +1 -4
  32. package/src/objects/OutgoingPayment.ts +5 -0
  33. package/src/objects/OutgoingPaymentForIdempotencyKeyInput.ts +24 -0
  34. package/src/objects/OutgoingPaymentForIdempotencyKeyOutput.ts +33 -0
  35. package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +1 -0
  36. package/src/objects/OutgoingPaymentsForPaymentHashQueryInput.ts +34 -0
  37. package/src/objects/OutgoingPaymentsForPaymentHashQueryOutput.ts +37 -0
  38. package/src/objects/PayInvoiceInput.ts +8 -0
  39. package/src/objects/PayUmaInvoiceInput.ts +4 -0
  40. package/src/objects/PaymentFailureReason.ts +2 -0
  41. package/src/objects/RemoteSigningSubEventType.ts +2 -0
  42. package/src/objects/RequestWithdrawalInput.ts +29 -0
  43. package/src/objects/SendPaymentInput.ts +8 -0
  44. package/src/objects/Transaction.ts +3 -0
  45. package/src/objects/TransactionStatus.ts +1 -1
  46. package/src/objects/Wallet.ts +10 -0
  47. package/src/objects/Withdrawal.ts +1 -4
  48. package/src/objects/WithdrawalRequest.ts +107 -11
  49. package/src/objects/WithdrawalRequestStatus.ts +2 -0
  50. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +15 -10
  51. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +15 -10
  52. package/src/objects/WithdrawalRequestToWithdrawalsConnection.ts +47 -0
  53. package/src/objects/index.ts +10 -0
  54. package/src/webhooks.ts +3 -0
package/dist/index.cjs CHANGED
@@ -1860,6 +1860,7 @@ __export(src_exports, {
1860
1860
  LightsparkNodeWithOSK: () => LightsparkNodeWithOSK_default,
1861
1861
  LightsparkNodeWithRemoteSigning: () => LightsparkNodeWithRemoteSigning_default,
1862
1862
  NodeAddressType: () => NodeAddressType_default,
1863
+ OnChainFeeTarget: () => OnChainFeeTarget_default,
1863
1864
  OutgoingPayment: () => OutgoingPayment_default,
1864
1865
  OutgoingPaymentAttempt: () => OutgoingPaymentAttempt_default,
1865
1866
  OutgoingPaymentAttemptStatus: () => OutgoingPaymentAttemptStatus_default,
@@ -1984,7 +1985,7 @@ var import_core9 = require("@lightsparkdev/core");
1984
1985
  // package.json
1985
1986
  var package_default = {
1986
1987
  name: "@lightsparkdev/lightspark-sdk",
1987
- version: "1.5.13",
1988
+ version: "1.6.0",
1988
1989
  description: "Lightspark JS SDK",
1989
1990
  author: "Lightspark Inc.",
1990
1991
  keywords: [
@@ -2070,7 +2071,7 @@ var package_default = {
2070
2071
  license: "Apache-2.0",
2071
2072
  dependencies: {
2072
2073
  "@lightsparkdev/core": "1.1.0",
2073
- "@lightsparkdev/crypto-wasm": "0.1.3",
2074
+ "@lightsparkdev/crypto-wasm": "0.1.4",
2074
2075
  "crypto-browserify": "^3.12.0",
2075
2076
  dayjs: "^1.11.7",
2076
2077
  dotenv: "^16.3.1",
@@ -2987,13 +2988,13 @@ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [Node
2987
2988
  }
2988
2989
  });
2989
2990
  }
2990
- async getChannels(client, first = void 0, statuses = void 0, after = void 0) {
2991
+ async getChannels(client, first = void 0, after = void 0, beforeDate = void 0, afterDate = void 0, statuses = void 0) {
2991
2992
  return await client.executeRawQuery({
2992
2993
  queryPayload: `
2993
- query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!], $after: String) {
2994
+ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $after: String, $before_date: DateTime, $after_date: DateTime, $statuses: [ChannelStatus!]) {
2994
2995
  entity(id: $entity_id) {
2995
2996
  ... on LightsparkNodeWithOSK {
2996
- channels(, first: $first, statuses: $statuses, after: $after) {
2997
+ channels(, first: $first, after: $after, before_date: $before_date, after_date: $after_date, statuses: $statuses) {
2997
2998
  __typename
2998
2999
  lightspark_node_to_channels_connection_count: count
2999
3000
  lightspark_node_to_channels_connection_page_info: page_info {
@@ -3105,8 +3106,10 @@ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $sta
3105
3106
  variables: {
3106
3107
  entity_id: this.id,
3107
3108
  first,
3108
- statuses,
3109
- after
3109
+ after,
3110
+ before_date: beforeDate,
3111
+ after_date: afterDate,
3112
+ statuses
3110
3113
  },
3111
3114
  constructObject: (json) => {
3112
3115
  const connection = json["entity"]["channels"];
@@ -3414,13 +3417,13 @@ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [Node
3414
3417
  }
3415
3418
  });
3416
3419
  }
3417
- async getChannels(client, first = void 0, statuses = void 0, after = void 0) {
3420
+ async getChannels(client, first = void 0, after = void 0, beforeDate = void 0, afterDate = void 0, statuses = void 0) {
3418
3421
  return await client.executeRawQuery({
3419
3422
  queryPayload: `
3420
- query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!], $after: String) {
3423
+ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $after: String, $before_date: DateTime, $after_date: DateTime, $statuses: [ChannelStatus!]) {
3421
3424
  entity(id: $entity_id) {
3422
3425
  ... on LightsparkNodeWithRemoteSigning {
3423
- channels(, first: $first, statuses: $statuses, after: $after) {
3426
+ channels(, first: $first, after: $after, before_date: $before_date, after_date: $after_date, statuses: $statuses) {
3424
3427
  __typename
3425
3428
  lightspark_node_to_channels_connection_count: count
3426
3429
  lightspark_node_to_channels_connection_page_info: page_info {
@@ -3532,8 +3535,10 @@ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $sta
3532
3535
  variables: {
3533
3536
  entity_id: this.id,
3534
3537
  first,
3535
- statuses,
3536
- after
3538
+ after,
3539
+ before_date: beforeDate,
3540
+ after_date: afterDate,
3541
+ statuses
3537
3542
  },
3538
3543
  constructObject: (json) => {
3539
3544
  const connection = json["entity"]["channels"];
@@ -5586,6 +5591,21 @@ var FundNode = `
5586
5591
  ${FRAGMENT}
5587
5592
  `;
5588
5593
 
5594
+ // src/graphql/InvoiceForPaymentHash.ts
5595
+ var InvoiceForPaymentHash = `
5596
+ query InvoiceForPaymentHash($payment_hash: Hash32!) {
5597
+ invoice_for_payment_hash(input: {
5598
+ payment_hash: $payment_hash
5599
+ }) {
5600
+ invoice {
5601
+ ...InvoiceFragment
5602
+ }
5603
+ }
5604
+ }
5605
+
5606
+ ${FRAGMENT9}
5607
+ `;
5608
+
5589
5609
  // src/objects/LightningFeeEstimateOutput.ts
5590
5610
  var FRAGMENT14 = `
5591
5611
  fragment LightningFeeEstimateOutputFragment on LightningFeeEstimateOutput {
@@ -6024,6 +6044,7 @@ var PaymentFailureReason = /* @__PURE__ */ ((PaymentFailureReason2) => {
6024
6044
  PaymentFailureReason2["INVOICE_EXPIRED"] = "INVOICE_EXPIRED";
6025
6045
  PaymentFailureReason2["INVOICE_CANCELLED"] = "INVOICE_CANCELLED";
6026
6046
  PaymentFailureReason2["RISK_SCREENING_FAILED"] = "RISK_SCREENING_FAILED";
6047
+ PaymentFailureReason2["INSUFFICIENT_BALANCE_ON_SINGLE_PATH_INVOICE"] = "INSUFFICIENT_BALANCE_ON_SINGLE_PATH_INVOICE";
6027
6048
  return PaymentFailureReason2;
6028
6049
  })(PaymentFailureReason || {});
6029
6050
  var PaymentFailureReason_default = PaymentFailureReason;
@@ -6084,7 +6105,7 @@ var RichTextToJson = (obj) => {
6084
6105
 
6085
6106
  // src/objects/OutgoingPayment.ts
6086
6107
  var OutgoingPayment = class {
6087
- constructor(id, createdAt, updatedAt, status, amount, isUma, originId, isInternalPayment, typename, resolvedAt, transactionHash, destinationId, fees, paymentRequestData, failureReason, failureMessage, umaPostTransactionData, paymentPreimage) {
6108
+ constructor(id, createdAt, updatedAt, status, amount, isUma, originId, isInternalPayment, typename, resolvedAt, transactionHash, destinationId, fees, paymentRequestData, failureReason, failureMessage, umaPostTransactionData, paymentPreimage, idempotencyKey) {
6088
6109
  this.id = id;
6089
6110
  this.createdAt = createdAt;
6090
6111
  this.updatedAt = updatedAt;
@@ -6103,6 +6124,7 @@ var OutgoingPayment = class {
6103
6124
  this.failureMessage = failureMessage;
6104
6125
  this.umaPostTransactionData = umaPostTransactionData;
6105
6126
  this.paymentPreimage = paymentPreimage;
6127
+ this.idempotencyKey = idempotencyKey;
6106
6128
  autoBind(this);
6107
6129
  }
6108
6130
  async getAttempts(client, first = void 0, after = void 0) {
@@ -6202,7 +6224,8 @@ ${FRAGMENT17}
6202
6224
  outgoing_payment_failure_message: this.failureMessage ? RichTextToJson(this.failureMessage) : void 0,
6203
6225
  outgoing_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e)),
6204
6226
  outgoing_payment_payment_preimage: this.paymentPreimage,
6205
- outgoing_payment_is_internal_payment: this.isInternalPayment
6227
+ outgoing_payment_is_internal_payment: this.isInternalPayment,
6228
+ outgoing_payment_idempotency_key: this.idempotencyKey
6206
6229
  };
6207
6230
  }
6208
6231
  };
@@ -6227,7 +6250,8 @@ var OutgoingPaymentFromJson = (obj) => {
6227
6250
  obj["outgoing_payment_uma_post_transaction_data"]?.map(
6228
6251
  (e) => PostTransactionDataFromJson(e)
6229
6252
  ),
6230
- obj["outgoing_payment_payment_preimage"]
6253
+ obj["outgoing_payment_payment_preimage"],
6254
+ obj["outgoing_payment_idempotency_key"]
6231
6255
  );
6232
6256
  };
6233
6257
  var FRAGMENT17 = `
@@ -6575,9 +6599,29 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
6575
6599
  }
6576
6600
  outgoing_payment_payment_preimage: payment_preimage
6577
6601
  outgoing_payment_is_internal_payment: is_internal_payment
6602
+ outgoing_payment_idempotency_key: idempotency_key
6578
6603
  }`;
6579
6604
  var OutgoingPayment_default = OutgoingPayment;
6580
6605
 
6606
+ // src/graphql/OutgoingPaymentsForPaymentHash.ts
6607
+ var OutgoingPaymentsForPaymentHash = `
6608
+ query OutgoingPaymentsForPaymentHash(
6609
+ $payment_hash: Hash32!
6610
+ $statuses: [TransactionStatus!]
6611
+ ) {
6612
+ outgoing_payments_for_payment_hash(input: {
6613
+ payment_hash: $payment_hash
6614
+ statuses: $statuses
6615
+ }) {
6616
+ payments {
6617
+ ...OutgoingPaymentFragment
6618
+ }
6619
+ }
6620
+ }
6621
+
6622
+ ${FRAGMENT17}
6623
+ `;
6624
+
6581
6625
  // src/graphql/PayInvoice.ts
6582
6626
  var PayInvoice = `
6583
6627
  mutation PayInvoice(
@@ -7043,6 +7087,7 @@ var WithdrawalMode_default = WithdrawalMode;
7043
7087
  // src/objects/WithdrawalRequestStatus.ts
7044
7088
  var WithdrawalRequestStatus = /* @__PURE__ */ ((WithdrawalRequestStatus2) => {
7045
7089
  WithdrawalRequestStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
7090
+ WithdrawalRequestStatus2["CREATING"] = "CREATING";
7046
7091
  WithdrawalRequestStatus2["CREATED"] = "CREATED";
7047
7092
  WithdrawalRequestStatus2["FAILED"] = "FAILED";
7048
7093
  WithdrawalRequestStatus2["IN_PROGRESS"] = "IN_PROGRESS";
@@ -7125,11 +7170,12 @@ ${FRAGMENT19}
7125
7170
  // src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts
7126
7171
  var WithdrawalRequestToChannelClosingTransactionsConnectionFromJson = (obj) => {
7127
7172
  return {
7173
+ count: obj["withdrawal_request_to_channel_closing_transactions_connection_count"],
7128
7174
  pageInfo: PageInfoFromJson(
7129
7175
  obj["withdrawal_request_to_channel_closing_transactions_connection_page_info"]
7130
7176
  ),
7131
- count: obj["withdrawal_request_to_channel_closing_transactions_connection_count"],
7132
- entities: obj["withdrawal_request_to_channel_closing_transactions_connection_entities"].map((e) => ChannelClosingTransactionFromJson(e))
7177
+ entities: obj["withdrawal_request_to_channel_closing_transactions_connection_entities"].map((e) => ChannelClosingTransactionFromJson(e)),
7178
+ typename: "WithdrawalRequestToChannelClosingTransactionsConnection"
7133
7179
  };
7134
7180
  };
7135
7181
 
@@ -7206,17 +7252,98 @@ ${FRAGMENT20}
7206
7252
  // src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts
7207
7253
  var WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (obj) => {
7208
7254
  return {
7255
+ count: obj["withdrawal_request_to_channel_opening_transactions_connection_count"],
7209
7256
  pageInfo: PageInfoFromJson(
7210
7257
  obj["withdrawal_request_to_channel_opening_transactions_connection_page_info"]
7211
7258
  ),
7212
- count: obj["withdrawal_request_to_channel_opening_transactions_connection_count"],
7213
- entities: obj["withdrawal_request_to_channel_opening_transactions_connection_entities"].map((e) => ChannelOpeningTransactionFromJson(e))
7259
+ entities: obj["withdrawal_request_to_channel_opening_transactions_connection_entities"].map((e) => ChannelOpeningTransactionFromJson(e)),
7260
+ typename: "WithdrawalRequestToChannelOpeningTransactionsConnection"
7261
+ };
7262
+ };
7263
+
7264
+ // src/objects/Withdrawal.ts
7265
+ var WithdrawalFromJson = (obj) => {
7266
+ return {
7267
+ id: obj["withdrawal_id"],
7268
+ createdAt: obj["withdrawal_created_at"],
7269
+ updatedAt: obj["withdrawal_updated_at"],
7270
+ status: TransactionStatus_default[obj["withdrawal_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
7271
+ amount: CurrencyAmountFromJson(obj["withdrawal_amount"]),
7272
+ blockHeight: obj["withdrawal_block_height"],
7273
+ destinationAddresses: obj["withdrawal_destination_addresses"],
7274
+ originId: obj["withdrawal_origin"].id,
7275
+ typename: "Withdrawal",
7276
+ resolvedAt: obj["withdrawal_resolved_at"],
7277
+ transactionHash: obj["withdrawal_transaction_hash"],
7278
+ fees: !!obj["withdrawal_fees"] ? CurrencyAmountFromJson(obj["withdrawal_fees"]) : void 0,
7279
+ blockHash: obj["withdrawal_block_hash"],
7280
+ numConfirmations: obj["withdrawal_num_confirmations"]
7281
+ };
7282
+ };
7283
+ var FRAGMENT21 = `
7284
+ fragment WithdrawalFragment on Withdrawal {
7285
+ __typename
7286
+ withdrawal_id: id
7287
+ withdrawal_created_at: created_at
7288
+ withdrawal_updated_at: updated_at
7289
+ withdrawal_status: status
7290
+ withdrawal_resolved_at: resolved_at
7291
+ withdrawal_amount: amount {
7292
+ __typename
7293
+ currency_amount_original_value: original_value
7294
+ currency_amount_original_unit: original_unit
7295
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7296
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7297
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7298
+ }
7299
+ withdrawal_transaction_hash: transaction_hash
7300
+ withdrawal_fees: fees {
7301
+ __typename
7302
+ currency_amount_original_value: original_value
7303
+ currency_amount_original_unit: original_unit
7304
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7305
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7306
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7307
+ }
7308
+ withdrawal_block_hash: block_hash
7309
+ withdrawal_block_height: block_height
7310
+ withdrawal_destination_addresses: destination_addresses
7311
+ withdrawal_num_confirmations: num_confirmations
7312
+ withdrawal_origin: origin {
7313
+ id
7314
+ }
7315
+ }`;
7316
+ var getWithdrawalQuery = (id) => {
7317
+ return {
7318
+ queryPayload: `
7319
+ query GetWithdrawal($id: ID!) {
7320
+ entity(id: $id) {
7321
+ ... on Withdrawal {
7322
+ ...WithdrawalFragment
7323
+ }
7324
+ }
7325
+ }
7326
+
7327
+ ${FRAGMENT21}
7328
+ `,
7329
+ variables: { id },
7330
+ constructObject: (data) => WithdrawalFromJson(data.entity)
7331
+ };
7332
+ };
7333
+
7334
+ // src/objects/WithdrawalRequestToWithdrawalsConnection.ts
7335
+ var WithdrawalRequestToWithdrawalsConnectionFromJson = (obj) => {
7336
+ return {
7337
+ count: obj["withdrawal_request_to_withdrawals_connection_count"],
7338
+ entities: obj["withdrawal_request_to_withdrawals_connection_entities"].map(
7339
+ (e) => WithdrawalFromJson(e)
7340
+ )
7214
7341
  };
7215
7342
  };
7216
7343
 
7217
7344
  // src/objects/WithdrawalRequest.ts
7218
7345
  var WithdrawalRequest = class {
7219
- constructor(id, createdAt, updatedAt, requestedAmount, amount, bitcoinAddress, withdrawalMode, status, typename, estimatedAmount, amountWithdrawn, completedAt, withdrawalId) {
7346
+ constructor(id, createdAt, updatedAt, requestedAmount, amount, bitcoinAddress, withdrawalMode, status, typename, estimatedAmount, amountWithdrawn, totalFees, completedAt, withdrawalId, idempotencyKey) {
7220
7347
  this.id = id;
7221
7348
  this.createdAt = createdAt;
7222
7349
  this.updatedAt = updatedAt;
@@ -7228,18 +7355,21 @@ var WithdrawalRequest = class {
7228
7355
  this.typename = typename;
7229
7356
  this.estimatedAmount = estimatedAmount;
7230
7357
  this.amountWithdrawn = amountWithdrawn;
7358
+ this.totalFees = totalFees;
7231
7359
  this.completedAt = completedAt;
7232
7360
  this.withdrawalId = withdrawalId;
7361
+ this.idempotencyKey = idempotencyKey;
7233
7362
  autoBind(this);
7234
7363
  }
7235
- async getChannelClosingTransactions(client, first = void 0) {
7364
+ async getChannelClosingTransactions(client, first = void 0, after = void 0) {
7236
7365
  return await client.executeRawQuery({
7237
7366
  queryPayload: `
7238
- query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: ID!, $first: Int) {
7367
+ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: ID!, $first: Int, $after: String) {
7239
7368
  entity(id: $entity_id) {
7240
7369
  ... on WithdrawalRequest {
7241
- channel_closing_transactions(, first: $first) {
7370
+ channel_closing_transactions(, first: $first, after: $after) {
7242
7371
  __typename
7372
+ withdrawal_request_to_channel_closing_transactions_connection_count: count
7243
7373
  withdrawal_request_to_channel_closing_transactions_connection_page_info: page_info {
7244
7374
  __typename
7245
7375
  page_info_has_next_page: has_next_page
@@ -7247,7 +7377,6 @@ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: I
7247
7377
  page_info_start_cursor: start_cursor
7248
7378
  page_info_end_cursor: end_cursor
7249
7379
  }
7250
- withdrawal_request_to_channel_closing_transactions_connection_count: count
7251
7380
  withdrawal_request_to_channel_closing_transactions_connection_entities: entities {
7252
7381
  __typename
7253
7382
  channel_closing_transaction_id: id
@@ -7285,7 +7414,7 @@ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: I
7285
7414
  }
7286
7415
  }
7287
7416
  `,
7288
- variables: { entity_id: this.id, first },
7417
+ variables: { entity_id: this.id, first, after },
7289
7418
  constructObject: (json) => {
7290
7419
  const connection = json["entity"]["channel_closing_transactions"];
7291
7420
  return WithdrawalRequestToChannelClosingTransactionsConnectionFromJson(
@@ -7294,14 +7423,15 @@ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: I
7294
7423
  }
7295
7424
  });
7296
7425
  }
7297
- async getChannelOpeningTransactions(client, first = void 0) {
7426
+ async getChannelOpeningTransactions(client, first = void 0, after = void 0) {
7298
7427
  return await client.executeRawQuery({
7299
7428
  queryPayload: `
7300
- query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: ID!, $first: Int) {
7429
+ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: ID!, $first: Int, $after: String) {
7301
7430
  entity(id: $entity_id) {
7302
7431
  ... on WithdrawalRequest {
7303
- channel_opening_transactions(, first: $first) {
7432
+ channel_opening_transactions(, first: $first, after: $after) {
7304
7433
  __typename
7434
+ withdrawal_request_to_channel_opening_transactions_connection_count: count
7305
7435
  withdrawal_request_to_channel_opening_transactions_connection_page_info: page_info {
7306
7436
  __typename
7307
7437
  page_info_has_next_page: has_next_page
@@ -7309,7 +7439,6 @@ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: I
7309
7439
  page_info_start_cursor: start_cursor
7310
7440
  page_info_end_cursor: end_cursor
7311
7441
  }
7312
- withdrawal_request_to_channel_opening_transactions_connection_count: count
7313
7442
  withdrawal_request_to_channel_opening_transactions_connection_entities: entities {
7314
7443
  __typename
7315
7444
  channel_opening_transaction_id: id
@@ -7347,7 +7476,7 @@ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: I
7347
7476
  }
7348
7477
  }
7349
7478
  `,
7350
- variables: { entity_id: this.id, first },
7479
+ variables: { entity_id: this.id, first, after },
7351
7480
  constructObject: (json) => {
7352
7481
  const connection = json["entity"]["channel_opening_transactions"];
7353
7482
  return WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson(
@@ -7356,6 +7485,59 @@ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: I
7356
7485
  }
7357
7486
  });
7358
7487
  }
7488
+ async getWithdrawals(client, first = void 0) {
7489
+ return await client.executeRawQuery({
7490
+ queryPayload: `
7491
+ query FetchWithdrawalRequestToWithdrawalsConnection($entity_id: ID!, $first: Int) {
7492
+ entity(id: $entity_id) {
7493
+ ... on WithdrawalRequest {
7494
+ withdrawals(, first: $first) {
7495
+ __typename
7496
+ withdrawal_request_to_withdrawals_connection_count: count
7497
+ withdrawal_request_to_withdrawals_connection_entities: entities {
7498
+ __typename
7499
+ withdrawal_id: id
7500
+ withdrawal_created_at: created_at
7501
+ withdrawal_updated_at: updated_at
7502
+ withdrawal_status: status
7503
+ withdrawal_resolved_at: resolved_at
7504
+ withdrawal_amount: amount {
7505
+ __typename
7506
+ currency_amount_original_value: original_value
7507
+ currency_amount_original_unit: original_unit
7508
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7509
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7510
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7511
+ }
7512
+ withdrawal_transaction_hash: transaction_hash
7513
+ withdrawal_fees: fees {
7514
+ __typename
7515
+ currency_amount_original_value: original_value
7516
+ currency_amount_original_unit: original_unit
7517
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7518
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7519
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7520
+ }
7521
+ withdrawal_block_hash: block_hash
7522
+ withdrawal_block_height: block_height
7523
+ withdrawal_destination_addresses: destination_addresses
7524
+ withdrawal_num_confirmations: num_confirmations
7525
+ withdrawal_origin: origin {
7526
+ id
7527
+ }
7528
+ }
7529
+ }
7530
+ }
7531
+ }
7532
+ }
7533
+ `,
7534
+ variables: { entity_id: this.id, first },
7535
+ constructObject: (json) => {
7536
+ const connection = json["entity"]["withdrawals"];
7537
+ return WithdrawalRequestToWithdrawalsConnectionFromJson(connection);
7538
+ }
7539
+ });
7540
+ }
7359
7541
  static getWithdrawalRequestQuery(id) {
7360
7542
  return {
7361
7543
  queryPayload: `
@@ -7367,7 +7549,7 @@ query GetWithdrawalRequest($id: ID!) {
7367
7549
  }
7368
7550
  }
7369
7551
 
7370
- ${FRAGMENT21}
7552
+ ${FRAGMENT22}
7371
7553
  `,
7372
7554
  variables: { id },
7373
7555
  constructObject: (data) => WithdrawalRequestFromJson(data.entity)
@@ -7385,11 +7567,13 @@ ${FRAGMENT21}
7385
7567
  withdrawal_request_amount: CurrencyAmountToJson(this.amount),
7386
7568
  withdrawal_request_estimated_amount: this.estimatedAmount ? CurrencyAmountToJson(this.estimatedAmount) : void 0,
7387
7569
  withdrawal_request_amount_withdrawn: this.amountWithdrawn ? CurrencyAmountToJson(this.amountWithdrawn) : void 0,
7570
+ withdrawal_request_total_fees: this.totalFees ? CurrencyAmountToJson(this.totalFees) : void 0,
7388
7571
  withdrawal_request_bitcoin_address: this.bitcoinAddress,
7389
7572
  withdrawal_request_withdrawal_mode: this.withdrawalMode,
7390
7573
  withdrawal_request_status: this.status,
7391
7574
  withdrawal_request_completed_at: this.completedAt,
7392
- withdrawal_request_withdrawal: { id: this.withdrawalId }
7575
+ withdrawal_request_withdrawal: { id: this.withdrawalId },
7576
+ withdrawal_request_idempotency_key: this.idempotencyKey
7393
7577
  };
7394
7578
  }
7395
7579
  };
@@ -7406,11 +7590,13 @@ var WithdrawalRequestFromJson = (obj) => {
7406
7590
  "WithdrawalRequest",
7407
7591
  !!obj["withdrawal_request_estimated_amount"] ? CurrencyAmountFromJson(obj["withdrawal_request_estimated_amount"]) : void 0,
7408
7592
  !!obj["withdrawal_request_amount_withdrawn"] ? CurrencyAmountFromJson(obj["withdrawal_request_amount_withdrawn"]) : void 0,
7593
+ !!obj["withdrawal_request_total_fees"] ? CurrencyAmountFromJson(obj["withdrawal_request_total_fees"]) : void 0,
7409
7594
  obj["withdrawal_request_completed_at"],
7410
- obj["withdrawal_request_withdrawal"]?.id ?? void 0
7595
+ obj["withdrawal_request_withdrawal"]?.id ?? void 0,
7596
+ obj["withdrawal_request_idempotency_key"]
7411
7597
  );
7412
7598
  };
7413
- var FRAGMENT21 = `
7599
+ var FRAGMENT22 = `
7414
7600
  fragment WithdrawalRequestFragment on WithdrawalRequest {
7415
7601
  __typename
7416
7602
  withdrawal_request_id: id
@@ -7448,6 +7634,14 @@ fragment WithdrawalRequestFragment on WithdrawalRequest {
7448
7634
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7449
7635
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7450
7636
  }
7637
+ withdrawal_request_total_fees: total_fees {
7638
+ __typename
7639
+ currency_amount_original_value: original_value
7640
+ currency_amount_original_unit: original_unit
7641
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7642
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7643
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7644
+ }
7451
7645
  withdrawal_request_bitcoin_address: bitcoin_address
7452
7646
  withdrawal_request_withdrawal_mode: withdrawal_mode
7453
7647
  withdrawal_request_status: status
@@ -7455,6 +7649,7 @@ fragment WithdrawalRequestFragment on WithdrawalRequest {
7455
7649
  withdrawal_request_withdrawal: withdrawal {
7456
7650
  id
7457
7651
  }
7652
+ withdrawal_request_idempotency_key: idempotency_key
7458
7653
  }`;
7459
7654
  var WithdrawalRequest_default = WithdrawalRequest;
7460
7655
 
@@ -7478,7 +7673,7 @@ var RequestWithdrawal = `
7478
7673
  }
7479
7674
  }
7480
7675
 
7481
- ${FRAGMENT21}
7676
+ ${FRAGMENT22}
7482
7677
  `;
7483
7678
 
7484
7679
  // src/graphql/ScreenNode.ts
@@ -7634,7 +7829,8 @@ var TransactionFromJson = (obj) => {
7634
7829
  obj["outgoing_payment_uma_post_transaction_data"]?.map(
7635
7830
  (e) => PostTransactionDataFromJson(e)
7636
7831
  ),
7637
- obj["outgoing_payment_payment_preimage"]
7832
+ obj["outgoing_payment_payment_preimage"],
7833
+ obj["outgoing_payment_idempotency_key"]
7638
7834
  );
7639
7835
  }
7640
7836
  if (obj["__typename"] == "RoutingTransaction") {
@@ -7677,7 +7873,7 @@ var TransactionFromJson = (obj) => {
7677
7873
  `Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
7678
7874
  );
7679
7875
  };
7680
- var FRAGMENT22 = `
7876
+ var FRAGMENT23 = `
7681
7877
  fragment TransactionFragment on Transaction {
7682
7878
  __typename
7683
7879
  ... on ChannelClosingTransaction {
@@ -8157,6 +8353,7 @@ fragment TransactionFragment on Transaction {
8157
8353
  }
8158
8354
  outgoing_payment_payment_preimage: payment_preimage
8159
8355
  outgoing_payment_is_internal_payment: is_internal_payment
8356
+ outgoing_payment_idempotency_key: idempotency_key
8160
8357
  }
8161
8358
  ... on RoutingTransaction {
8162
8359
  __typename
@@ -8238,7 +8435,7 @@ query GetTransaction($id: ID!) {
8238
8435
  }
8239
8436
  }
8240
8437
 
8241
- ${FRAGMENT22}
8438
+ ${FRAGMENT23}
8242
8439
  `,
8243
8440
  variables: { id },
8244
8441
  constructObject: (data) => TransactionFromJson(data.entity)
@@ -8353,7 +8550,7 @@ query SingleNodeDashboard(
8353
8550
  }
8354
8551
  }
8355
8552
 
8356
- ${FRAGMENT22}
8553
+ ${FRAGMENT23}
8357
8554
  ${FRAGMENT}
8358
8555
  `;
8359
8556
 
@@ -8370,7 +8567,7 @@ var TransactionUpdateFromJson = (obj) => {
8370
8567
  transactionHash: obj["transaction_hash"]
8371
8568
  };
8372
8569
  };
8373
- var FRAGMENT23 = `
8570
+ var FRAGMENT24 = `
8374
8571
  fragment TransactionUpdateFragment on Transaction {
8375
8572
  __typename
8376
8573
  id
@@ -8400,7 +8597,7 @@ subscription TransactionSubscription(
8400
8597
  }
8401
8598
  }
8402
8599
 
8403
- ${FRAGMENT23}
8600
+ ${FRAGMENT24}
8404
8601
  `;
8405
8602
 
8406
8603
  // src/graphql/TransactionsForNode.ts
@@ -8438,7 +8635,7 @@ query TransactionsForNode(
8438
8635
  }
8439
8636
  }
8440
8637
 
8441
- ${FRAGMENT22}
8638
+ ${FRAGMENT23}
8442
8639
  ${FRAGMENT}
8443
8640
  `;
8444
8641
 
@@ -8450,7 +8647,7 @@ var WithdrawalFeeEstimateOutputFromJson = (obj) => {
8450
8647
  )
8451
8648
  };
8452
8649
  };
8453
- var FRAGMENT24 = `
8650
+ var FRAGMENT25 = `
8454
8651
  fragment WithdrawalFeeEstimateOutputFragment on WithdrawalFeeEstimateOutput {
8455
8652
  __typename
8456
8653
  withdrawal_fee_estimate_output_fee_estimate: fee_estimate {
@@ -8479,7 +8676,7 @@ var WithdrawalFeeEstimate = `
8479
8676
  }
8480
8677
  }
8481
8678
 
8482
- ${FRAGMENT24}
8679
+ ${FRAGMENT25}
8483
8680
  `;
8484
8681
 
8485
8682
  // src/objects/AccountToApiTokensConnection.ts
@@ -8585,7 +8782,7 @@ var LightsparkNodeFromJson = (obj) => {
8585
8782
  `Couldn't find a concrete type for interface LightsparkNode corresponding to the typename=${obj["__typename"]}`
8586
8783
  );
8587
8784
  };
8588
- var FRAGMENT25 = `
8785
+ var FRAGMENT26 = `
8589
8786
  fragment LightsparkNodeFragment on LightsparkNode {
8590
8787
  __typename
8591
8788
  ... on LightsparkNodeWithOSK {
@@ -8859,7 +9056,7 @@ query GetLightsparkNode($id: ID!) {
8859
9056
  }
8860
9057
  }
8861
9058
 
8862
- ${FRAGMENT25}
9059
+ ${FRAGMENT26}
8863
9060
  `,
8864
9061
  variables: { id },
8865
9062
  constructObject: (data) => LightsparkNodeFromJson(data.entity)
@@ -9482,6 +9679,7 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after:
9482
9679
  }
9483
9680
  outgoing_payment_payment_preimage: payment_preimage
9484
9681
  outgoing_payment_is_internal_payment: is_internal_payment
9682
+ outgoing_payment_idempotency_key: idempotency_key
9485
9683
  }
9486
9684
  ... on RoutingTransaction {
9487
9685
  __typename
@@ -9997,6 +10195,14 @@ query FetchWalletToWithdrawalRequestsConnection($entity_id: ID!, $first: Int, $a
9997
10195
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
9998
10196
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
9999
10197
  }
10198
+ withdrawal_request_total_fees: total_fees {
10199
+ __typename
10200
+ currency_amount_original_value: original_value
10201
+ currency_amount_original_unit: original_unit
10202
+ currency_amount_preferred_currency_unit: preferred_currency_unit
10203
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
10204
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
10205
+ }
10000
10206
  withdrawal_request_bitcoin_address: bitcoin_address
10001
10207
  withdrawal_request_withdrawal_mode: withdrawal_mode
10002
10208
  withdrawal_request_status: status
@@ -10004,6 +10210,7 @@ query FetchWalletToWithdrawalRequestsConnection($entity_id: ID!, $first: Int, $a
10004
10210
  withdrawal_request_withdrawal: withdrawal {
10005
10211
  id
10006
10212
  }
10213
+ withdrawal_request_idempotency_key: idempotency_key
10007
10214
  }
10008
10215
  }
10009
10216
  }
@@ -10064,7 +10271,7 @@ query GetWallet($id: ID!) {
10064
10271
  }
10065
10272
  }
10066
10273
 
10067
- ${FRAGMENT26}
10274
+ ${FRAGMENT27}
10068
10275
  `,
10069
10276
  variables: { id },
10070
10277
  constructObject: (data) => WalletFromJson(data.entity)
@@ -10097,7 +10304,7 @@ var WalletFromJson = (obj) => {
10097
10304
  obj["wallet_account"]?.id ?? void 0
10098
10305
  );
10099
10306
  };
10100
- var FRAGMENT26 = `
10307
+ var FRAGMENT27 = `
10101
10308
  fragment WalletFragment on Wallet {
10102
10309
  __typename
10103
10310
  wallet_id: id
@@ -11315,6 +11522,7 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
11315
11522
  }
11316
11523
  outgoing_payment_payment_preimage: payment_preimage
11317
11524
  outgoing_payment_is_internal_payment: is_internal_payment
11525
+ outgoing_payment_idempotency_key: idempotency_key
11318
11526
  }
11319
11527
  ... on RoutingTransaction {
11320
11528
  __typename
@@ -11751,13 +11959,13 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
11751
11959
  }
11752
11960
  });
11753
11961
  }
11754
- async getWithdrawalRequests(client, first = void 0, after = void 0, bitcoinNetworks = void 0, statuses = void 0, nodeIds = void 0, afterDate = void 0, beforeDate = void 0) {
11962
+ async getWithdrawalRequests(client, first = void 0, after = void 0, bitcoinNetworks = void 0, statuses = void 0, nodeIds = void 0, idempotencyKeys = void 0, afterDate = void 0, beforeDate = void 0) {
11755
11963
  return await client.executeRawQuery({
11756
11964
  queryPayload: `
11757
- query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $bitcoin_networks: [BitcoinNetwork!], $statuses: [WithdrawalRequestStatus!], $node_ids: [ID!], $after_date: DateTime, $before_date: DateTime) {
11965
+ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $bitcoin_networks: [BitcoinNetwork!], $statuses: [WithdrawalRequestStatus!], $node_ids: [ID!], $idempotency_keys: [String!], $after_date: DateTime, $before_date: DateTime) {
11758
11966
  current_account {
11759
11967
  ... on Account {
11760
- withdrawal_requests(, first: $first, after: $after, bitcoin_networks: $bitcoin_networks, statuses: $statuses, node_ids: $node_ids, after_date: $after_date, before_date: $before_date) {
11968
+ withdrawal_requests(, first: $first, after: $after, bitcoin_networks: $bitcoin_networks, statuses: $statuses, node_ids: $node_ids, idempotency_keys: $idempotency_keys, after_date: $after_date, before_date: $before_date) {
11761
11969
  __typename
11762
11970
  account_to_withdrawal_requests_connection_count: count
11763
11971
  account_to_withdrawal_requests_connection_page_info: page_info {
@@ -11804,6 +12012,14 @@ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $b
11804
12012
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
11805
12013
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
11806
12014
  }
12015
+ withdrawal_request_total_fees: total_fees {
12016
+ __typename
12017
+ currency_amount_original_value: original_value
12018
+ currency_amount_original_unit: original_unit
12019
+ currency_amount_preferred_currency_unit: preferred_currency_unit
12020
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
12021
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
12022
+ }
11807
12023
  withdrawal_request_bitcoin_address: bitcoin_address
11808
12024
  withdrawal_request_withdrawal_mode: withdrawal_mode
11809
12025
  withdrawal_request_status: status
@@ -11811,6 +12027,7 @@ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $b
11811
12027
  withdrawal_request_withdrawal: withdrawal {
11812
12028
  id
11813
12029
  }
12030
+ withdrawal_request_idempotency_key: idempotency_key
11814
12031
  }
11815
12032
  }
11816
12033
  }
@@ -11823,6 +12040,7 @@ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $b
11823
12040
  bitcoin_networks: bitcoinNetworks,
11824
12041
  statuses,
11825
12042
  node_ids: nodeIds,
12043
+ idempotency_keys: idempotencyKeys,
11826
12044
  after_date: afterDate,
11827
12045
  before_date: beforeDate
11828
12046
  },
@@ -11910,7 +12128,7 @@ query GetAccount {
11910
12128
  }
11911
12129
  }
11912
12130
 
11913
- ${FRAGMENT27}
12131
+ ${FRAGMENT28}
11914
12132
  `,
11915
12133
  variables: {},
11916
12134
  constructObject: (data) => AccountFromJson(data.current_account)
@@ -11935,7 +12153,7 @@ var AccountFromJson = (obj) => {
11935
12153
  obj["account_name"]
11936
12154
  );
11937
12155
  };
11938
- var FRAGMENT27 = `
12156
+ var FRAGMENT28 = `
11939
12157
  fragment AccountFragment on Account {
11940
12158
  __typename
11941
12159
  account_id: id
@@ -13000,6 +13218,49 @@ var LightsparkClient = class {
13000
13218
  }
13001
13219
  });
13002
13220
  }
13221
+ /**
13222
+ * Fetches a created invoice by its payment hash.
13223
+ *
13224
+ * @param paymentHash
13225
+ * @returns The invoice if there is one corresponding to the payment hash, or null if no invoice exists with that payment hash.
13226
+ */
13227
+ async invoiceForPaymentHash(paymentHash) {
13228
+ return await this.executeRawQuery({
13229
+ queryPayload: InvoiceForPaymentHash,
13230
+ variables: {
13231
+ payment_hash: paymentHash
13232
+ },
13233
+ constructObject: (responseJson) => {
13234
+ if (!responseJson.invoice_for_payment_hash || !responseJson.invoice_for_payment_hash.invoice) {
13235
+ return null;
13236
+ }
13237
+ return InvoiceFromJson(responseJson.invoice_for_payment_hash.invoice);
13238
+ }
13239
+ });
13240
+ }
13241
+ /**
13242
+ * Fetches outgoing payments for a given payment hash if there are any.
13243
+ *
13244
+ * @param paymentHash
13245
+ * @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
13246
+ */
13247
+ async outgoingPaymentsForPaymentHash(paymentHash, statuses = void 0) {
13248
+ return await this.executeRawQuery({
13249
+ queryPayload: OutgoingPaymentsForPaymentHash,
13250
+ variables: {
13251
+ payment_hash: paymentHash,
13252
+ statuses
13253
+ },
13254
+ constructObject: (responseJson) => {
13255
+ if (!responseJson.outgoing_payments_for_payment_hash || !responseJson.outgoing_payments_for_payment_hash.payments) {
13256
+ return [];
13257
+ }
13258
+ return responseJson.outgoing_payments_for_payment_hash.payments.map(
13259
+ (payment) => OutgoingPaymentFromJson(payment)
13260
+ );
13261
+ }
13262
+ });
13263
+ }
13003
13264
  async hashPhoneNumber(e164PhoneNumber) {
13004
13265
  const e164PhoneRegex = /^\+[1-9]\d{1,14}$/;
13005
13266
  if (!e164PhoneRegex.test(e164PhoneNumber)) {
@@ -13070,7 +13331,7 @@ var AuditLogActorFromJson = (obj) => {
13070
13331
  `Couldn't find a concrete type for interface AuditLogActor corresponding to the typename=${obj["__typename"]}`
13071
13332
  );
13072
13333
  };
13073
- var FRAGMENT28 = `
13334
+ var FRAGMENT29 = `
13074
13335
  fragment AuditLogActorFragment on AuditLogActor {
13075
13336
  __typename
13076
13337
  ... on ApiToken {
@@ -13095,7 +13356,7 @@ query GetAuditLogActor($id: ID!) {
13095
13356
  }
13096
13357
  }
13097
13358
 
13098
- ${FRAGMENT28}
13359
+ ${FRAGMENT29}
13099
13360
  `,
13100
13361
  variables: { id },
13101
13362
  constructObject: (data) => AuditLogActorFromJson(data.entity)
@@ -13119,7 +13380,7 @@ var ChannelSnapshotFromJson = (obj) => {
13119
13380
  localChannelReserve: !!obj["channel_snapshot_local_channel_reserve"] ? CurrencyAmountFromJson(obj["channel_snapshot_local_channel_reserve"]) : void 0
13120
13381
  };
13121
13382
  };
13122
- var FRAGMENT29 = `
13383
+ var FRAGMENT30 = `
13123
13384
  fragment ChannelSnapshotFragment on ChannelSnapshot {
13124
13385
  __typename
13125
13386
  channel_snapshot_id: id
@@ -13182,7 +13443,7 @@ query GetChannelSnapshot($id: ID!) {
13182
13443
  }
13183
13444
  }
13184
13445
 
13185
- ${FRAGMENT29}
13446
+ ${FRAGMENT30}
13186
13447
  `,
13187
13448
  variables: { id },
13188
13449
  constructObject: (data) => ChannelSnapshotFromJson(data.entity)
@@ -13482,7 +13743,7 @@ var SignablePayloadFromJson = (obj) => {
13482
13743
  mulTweak: obj["signable_payload_mul_tweak"]
13483
13744
  };
13484
13745
  };
13485
- var FRAGMENT30 = `
13746
+ var FRAGMENT31 = `
13486
13747
  fragment SignablePayloadFragment on SignablePayload {
13487
13748
  __typename
13488
13749
  signable_payload_id: id
@@ -13508,7 +13769,7 @@ query GetSignablePayload($id: ID!) {
13508
13769
  }
13509
13770
  }
13510
13771
 
13511
- ${FRAGMENT30}
13772
+ ${FRAGMENT31}
13512
13773
  `,
13513
13774
  variables: { id },
13514
13775
  constructObject: (data) => SignablePayloadFromJson(data.entity)
@@ -13534,7 +13795,7 @@ var DepositFromJson = (obj) => {
13534
13795
  numConfirmations: obj["deposit_num_confirmations"]
13535
13796
  };
13536
13797
  };
13537
- var FRAGMENT31 = `
13798
+ var FRAGMENT32 = `
13538
13799
  fragment DepositFragment on Deposit {
13539
13800
  __typename
13540
13801
  deposit_id: id
@@ -13578,7 +13839,7 @@ query GetDeposit($id: ID!) {
13578
13839
  }
13579
13840
  }
13580
13841
 
13581
- ${FRAGMENT31}
13842
+ ${FRAGMENT32}
13582
13843
  `,
13583
13844
  variables: { id },
13584
13845
  constructObject: (data) => DepositFromJson(data.entity)
@@ -13630,7 +13891,8 @@ var LightningTransactionFromJson = (obj) => {
13630
13891
  obj["outgoing_payment_uma_post_transaction_data"]?.map(
13631
13892
  (e) => PostTransactionDataFromJson(e)
13632
13893
  ),
13633
- obj["outgoing_payment_payment_preimage"]
13894
+ obj["outgoing_payment_payment_preimage"],
13895
+ obj["outgoing_payment_idempotency_key"]
13634
13896
  );
13635
13897
  }
13636
13898
  if (obj["__typename"] == "RoutingTransaction") {
@@ -13655,7 +13917,7 @@ var LightningTransactionFromJson = (obj) => {
13655
13917
  `Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
13656
13918
  );
13657
13919
  };
13658
- var FRAGMENT32 = `
13920
+ var FRAGMENT33 = `
13659
13921
  fragment LightningTransactionFragment on LightningTransaction {
13660
13922
  __typename
13661
13923
  ... on IncomingPayment {
@@ -14039,6 +14301,7 @@ fragment LightningTransactionFragment on LightningTransaction {
14039
14301
  }
14040
14302
  outgoing_payment_payment_preimage: payment_preimage
14041
14303
  outgoing_payment_is_internal_payment: is_internal_payment
14304
+ outgoing_payment_idempotency_key: idempotency_key
14042
14305
  }
14043
14306
  ... on RoutingTransaction {
14044
14307
  __typename
@@ -14088,7 +14351,7 @@ query GetLightningTransaction($id: ID!) {
14088
14351
  }
14089
14352
  }
14090
14353
 
14091
- ${FRAGMENT32}
14354
+ ${FRAGMENT33}
14092
14355
  `,
14093
14356
  variables: { id },
14094
14357
  constructObject: (data) => LightningTransactionFromJson(data.entity)
@@ -14125,7 +14388,7 @@ var LightsparkNodeOwnerFromJson = (obj) => {
14125
14388
  `Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
14126
14389
  );
14127
14390
  };
14128
- var FRAGMENT33 = `
14391
+ var FRAGMENT34 = `
14129
14392
  fragment LightsparkNodeOwnerFragment on LightsparkNodeOwner {
14130
14393
  __typename
14131
14394
  ... on Account {
@@ -14186,13 +14449,24 @@ query GetLightsparkNodeOwner($id: ID!) {
14186
14449
  }
14187
14450
  }
14188
14451
 
14189
- ${FRAGMENT33}
14452
+ ${FRAGMENT34}
14190
14453
  `,
14191
14454
  variables: { id },
14192
14455
  constructObject: (data) => LightsparkNodeOwnerFromJson(data.entity)
14193
14456
  };
14194
14457
  };
14195
14458
 
14459
+ // src/objects/OnChainFeeTarget.ts
14460
+ var OnChainFeeTarget = /* @__PURE__ */ ((OnChainFeeTarget2) => {
14461
+ OnChainFeeTarget2["FUTURE_VALUE"] = "FUTURE_VALUE";
14462
+ OnChainFeeTarget2["HIGH"] = "HIGH";
14463
+ OnChainFeeTarget2["MEDIUM"] = "MEDIUM";
14464
+ OnChainFeeTarget2["LOW"] = "LOW";
14465
+ OnChainFeeTarget2["BACKGROUND"] = "BACKGROUND";
14466
+ return OnChainFeeTarget2;
14467
+ })(OnChainFeeTarget || {});
14468
+ var OnChainFeeTarget_default = OnChainFeeTarget;
14469
+
14196
14470
  // src/objects/OnChainTransaction.ts
14197
14471
  var import_core14 = require("@lightsparkdev/core");
14198
14472
  var OnChainTransactionFromJson = (obj) => {
@@ -14273,7 +14547,7 @@ var OnChainTransactionFromJson = (obj) => {
14273
14547
  `Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
14274
14548
  );
14275
14549
  };
14276
- var FRAGMENT34 = `
14550
+ var FRAGMENT35 = `
14277
14551
  fragment OnChainTransactionFragment on OnChainTransaction {
14278
14552
  __typename
14279
14553
  ... on ChannelClosingTransaction {
@@ -14416,7 +14690,7 @@ query GetOnChainTransaction($id: ID!) {
14416
14690
  }
14417
14691
  }
14418
14692
 
14419
- ${FRAGMENT34}
14693
+ ${FRAGMENT35}
14420
14694
  `,
14421
14695
  variables: { id },
14422
14696
  constructObject: (data) => OnChainTransactionFromJson(data.entity)
@@ -14443,6 +14717,7 @@ var RemoteSigningSubEventType = /* @__PURE__ */ ((RemoteSigningSubEventType2) =>
14443
14717
  RemoteSigningSubEventType2["RELEASE_PAYMENT_PREIMAGE"] = "RELEASE_PAYMENT_PREIMAGE";
14444
14718
  RemoteSigningSubEventType2["REQUEST_INVOICE_PAYMENT_HASH"] = "REQUEST_INVOICE_PAYMENT_HASH";
14445
14719
  RemoteSigningSubEventType2["REVEAL_COUNTERPARTY_PER_COMMITMENT_SECRET"] = "REVEAL_COUNTERPARTY_PER_COMMITMENT_SECRET";
14720
+ RemoteSigningSubEventType2["VLS_MESSAGE"] = "VLS_MESSAGE";
14446
14721
  return RemoteSigningSubEventType2;
14447
14722
  })(RemoteSigningSubEventType || {});
14448
14723
  var RemoteSigningSubEventType_default = RemoteSigningSubEventType;
@@ -14475,7 +14750,7 @@ var RoutingTransactionFromJson = (obj) => {
14475
14750
  failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
14476
14751
  };
14477
14752
  };
14478
- var FRAGMENT35 = `
14753
+ var FRAGMENT36 = `
14479
14754
  fragment RoutingTransactionFragment on RoutingTransaction {
14480
14755
  __typename
14481
14756
  routing_transaction_id: id
@@ -14523,7 +14798,7 @@ query GetRoutingTransaction($id: ID!) {
14523
14798
  }
14524
14799
  }
14525
14800
 
14526
- ${FRAGMENT35}
14801
+ ${FRAGMENT36}
14527
14802
  `,
14528
14803
  variables: { id },
14529
14804
  constructObject: (data) => RoutingTransactionFromJson(data.entity)
@@ -14539,7 +14814,7 @@ var SignableFromJson = (obj) => {
14539
14814
  typename: "Signable"
14540
14815
  };
14541
14816
  };
14542
- var FRAGMENT36 = `
14817
+ var FRAGMENT37 = `
14543
14818
  fragment SignableFragment on Signable {
14544
14819
  __typename
14545
14820
  signable_id: id
@@ -14557,7 +14832,7 @@ query GetSignable($id: ID!) {
14557
14832
  }
14558
14833
  }
14559
14834
 
14560
- ${FRAGMENT36}
14835
+ ${FRAGMENT37}
14561
14836
  `,
14562
14837
  variables: { id },
14563
14838
  constructObject: (data) => SignableFromJson(data.entity)
@@ -14602,76 +14877,6 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
14602
14877
  })(WebhookEventType || {});
14603
14878
  var WebhookEventType_default = WebhookEventType;
14604
14879
 
14605
- // src/objects/Withdrawal.ts
14606
- var WithdrawalFromJson = (obj) => {
14607
- return {
14608
- id: obj["withdrawal_id"],
14609
- createdAt: obj["withdrawal_created_at"],
14610
- updatedAt: obj["withdrawal_updated_at"],
14611
- status: TransactionStatus_default[obj["withdrawal_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
14612
- amount: CurrencyAmountFromJson(obj["withdrawal_amount"]),
14613
- blockHeight: obj["withdrawal_block_height"],
14614
- destinationAddresses: obj["withdrawal_destination_addresses"],
14615
- originId: obj["withdrawal_origin"].id,
14616
- typename: "Withdrawal",
14617
- resolvedAt: obj["withdrawal_resolved_at"],
14618
- transactionHash: obj["withdrawal_transaction_hash"],
14619
- fees: !!obj["withdrawal_fees"] ? CurrencyAmountFromJson(obj["withdrawal_fees"]) : void 0,
14620
- blockHash: obj["withdrawal_block_hash"],
14621
- numConfirmations: obj["withdrawal_num_confirmations"]
14622
- };
14623
- };
14624
- var FRAGMENT37 = `
14625
- fragment WithdrawalFragment on Withdrawal {
14626
- __typename
14627
- withdrawal_id: id
14628
- withdrawal_created_at: created_at
14629
- withdrawal_updated_at: updated_at
14630
- withdrawal_status: status
14631
- withdrawal_resolved_at: resolved_at
14632
- withdrawal_amount: amount {
14633
- __typename
14634
- currency_amount_original_value: original_value
14635
- currency_amount_original_unit: original_unit
14636
- currency_amount_preferred_currency_unit: preferred_currency_unit
14637
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
14638
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
14639
- }
14640
- withdrawal_transaction_hash: transaction_hash
14641
- withdrawal_fees: fees {
14642
- __typename
14643
- currency_amount_original_value: original_value
14644
- currency_amount_original_unit: original_unit
14645
- currency_amount_preferred_currency_unit: preferred_currency_unit
14646
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
14647
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
14648
- }
14649
- withdrawal_block_hash: block_hash
14650
- withdrawal_block_height: block_height
14651
- withdrawal_destination_addresses: destination_addresses
14652
- withdrawal_num_confirmations: num_confirmations
14653
- withdrawal_origin: origin {
14654
- id
14655
- }
14656
- }`;
14657
- var getWithdrawalQuery = (id) => {
14658
- return {
14659
- queryPayload: `
14660
- query GetWithdrawal($id: ID!) {
14661
- entity(id: $id) {
14662
- ... on Withdrawal {
14663
- ...WithdrawalFragment
14664
- }
14665
- }
14666
- }
14667
-
14668
- ${FRAGMENT37}
14669
- `,
14670
- variables: { id },
14671
- constructObject: (data) => WithdrawalFromJson(data.entity)
14672
- };
14673
- };
14674
-
14675
14880
  // src/webhooks.ts
14676
14881
  var import_core15 = require("@lightsparkdev/core");
14677
14882
  var WEBHOOKS_SIGNATURE_HEADER = "lightspark-signature";
@@ -14722,6 +14927,9 @@ var RemoteSigningWebhookHandler = class {
14722
14927
  this.#masterSeed,
14723
14928
  this.validator
14724
14929
  );
14930
+ if (!response) {
14931
+ return;
14932
+ }
14725
14933
  const variables = JSON.parse(response.variables);
14726
14934
  return this.client.executeRawQuery({
14727
14935
  queryPayload: response.query,
@@ -14752,6 +14960,7 @@ var RemoteSigningWebhookHandler = class {
14752
14960
  LightsparkNodeWithOSK,
14753
14961
  LightsparkNodeWithRemoteSigning,
14754
14962
  NodeAddressType,
14963
+ OnChainFeeTarget,
14755
14964
  OutgoingPayment,
14756
14965
  OutgoingPaymentAttempt,
14757
14966
  OutgoingPaymentAttemptStatus,