@lightsparkdev/lightspark-sdk 1.3.1 → 1.5.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 (92) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{BitcoinNetwork-972b1d01.d.ts → BitcoinNetwork-4f6ea015.d.ts} +2 -2
  3. package/dist/{chunk-Y55D3PD4.js → chunk-ENYS5WAU.js} +712 -476
  4. package/dist/env.d.cts +1 -1
  5. package/dist/env.d.ts +1 -1
  6. package/dist/{index-a5028d74.d.ts → index-f100aa27.d.ts} +726 -702
  7. package/dist/index.cjs +402 -24
  8. package/dist/index.d.cts +3 -3
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +148 -2
  11. package/dist/objects/index.cjs +1339 -1126
  12. package/dist/objects/index.d.cts +2 -2
  13. package/dist/objects/index.d.ts +2 -2
  14. package/dist/objects/index.js +1 -1
  15. package/package.json +1 -1
  16. package/src/client.ts +121 -1
  17. package/src/graphql/RegisterPayment.ts +21 -0
  18. package/src/graphql/ScreenNode.ts +15 -0
  19. package/src/graphql/WithdrawalFeeEstimate.ts +21 -0
  20. package/src/objects/Account.ts +98 -5
  21. package/src/objects/AccountToApiTokensConnection.ts +2 -3
  22. package/src/objects/AccountToChannelsConnection.ts +2 -3
  23. package/src/objects/AccountToNodesConnection.ts +2 -3
  24. package/src/objects/AccountToPaymentRequestsConnection.ts +2 -3
  25. package/src/objects/AccountToTransactionsConnection.ts +6 -7
  26. package/src/objects/AccountToWalletsConnection.ts +2 -3
  27. package/src/objects/AccountToWithdrawalRequestsConnection.ts +71 -0
  28. package/src/objects/ApiToken.ts +5 -6
  29. package/src/objects/Balances.ts +9 -12
  30. package/src/objects/BitcoinNetwork.ts +2 -2
  31. package/src/objects/Channel.ts +7 -10
  32. package/src/objects/ChannelClosingTransaction.ts +3 -4
  33. package/src/objects/ChannelOpeningTransaction.ts +3 -4
  34. package/src/objects/ChannelStatus.ts +5 -9
  35. package/src/objects/ChannelToTransactionsConnection.ts +6 -7
  36. package/src/objects/Connection.ts +85 -3
  37. package/src/objects/CreateApiTokenOutput.ts +3 -3
  38. package/src/objects/CreateLnurlInvoiceInput.ts +2 -3
  39. package/src/objects/CreateTestModePaymentInput.ts +2 -2
  40. package/src/objects/CreateTestModePaymentoutput.ts +2 -3
  41. package/src/objects/CurrencyUnit.ts +11 -17
  42. package/src/objects/Deposit.ts +5 -6
  43. package/src/objects/Entity.ts +21 -6
  44. package/src/objects/FeeEstimate.ts +2 -3
  45. package/src/objects/GraphNode.ts +10 -12
  46. package/src/objects/Hop.ts +5 -6
  47. package/src/objects/IncentivesStatus.ts +2 -3
  48. package/src/objects/IncomingPayment.ts +7 -7
  49. package/src/objects/IncomingPaymentAttempt.ts +2 -2
  50. package/src/objects/IncomingPaymentToAttemptsConnection.ts +2 -3
  51. package/src/objects/Invoice.ts +2 -2
  52. package/src/objects/InvoiceData.ts +4 -5
  53. package/src/objects/LightningTransaction.ts +5 -5
  54. package/src/objects/LightsparkNode.ts +8 -10
  55. package/src/objects/LightsparkNodeOwner.ts +2 -2
  56. package/src/objects/LightsparkNodeToChannelsConnection.ts +2 -3
  57. package/src/objects/LightsparkNodeWithOSK.ts +7 -8
  58. package/src/objects/LightsparkNodeWithRemoteSigning.ts +7 -8
  59. package/src/objects/Node.ts +9 -11
  60. package/src/objects/NodeToAddressesConnection.ts +2 -3
  61. package/src/objects/OnChainTransaction.ts +5 -6
  62. package/src/objects/OutgoingPayment.ts +5 -6
  63. package/src/objects/OutgoingPaymentAttempt.ts +12 -14
  64. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +2 -3
  65. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +2 -3
  66. package/src/objects/PageInfo.ts +3 -3
  67. package/src/objects/PaymentRequest.ts +2 -2
  68. package/src/objects/PaymentRequestData.ts +1 -2
  69. package/src/objects/RegisterPaymentInput.ts +7 -8
  70. package/src/objects/RequestWithdrawalInput.ts +2 -2
  71. package/src/objects/RiskRating.ts +1 -2
  72. package/src/objects/RoutingTransaction.ts +6 -8
  73. package/src/objects/ScreenNodeInput.ts +2 -3
  74. package/src/objects/SetInvoicePaymentHashInput.ts +2 -3
  75. package/src/objects/Signable.ts +2 -2
  76. package/src/objects/SignablePayload.ts +2 -2
  77. package/src/objects/Transaction.ts +3 -4
  78. package/src/objects/TransactionStatus.ts +1 -2
  79. package/src/objects/UmaInvitation.ts +2 -2
  80. package/src/objects/Wallet.ts +97 -8
  81. package/src/objects/WalletStatus.ts +5 -7
  82. package/src/objects/WalletToPaymentRequestsConnection.ts +2 -3
  83. package/src/objects/WalletToTransactionsConnection.ts +2 -3
  84. package/src/objects/WalletToWithdrawalRequestsConnection.ts +70 -0
  85. package/src/objects/Withdrawal.ts +5 -5
  86. package/src/objects/WithdrawalFeeEstimateInput.ts +40 -0
  87. package/src/objects/WithdrawalFeeEstimateOutput.ts +46 -0
  88. package/src/objects/WithdrawalRequest.ts +43 -7
  89. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +2 -3
  90. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +2 -3
  91. package/src/objects/index.ts +4 -0
  92. package/src/tests/integration/general-regtest.test.ts +9 -0
package/dist/index.cjs CHANGED
@@ -1949,7 +1949,7 @@ var import_core9 = require("@lightsparkdev/core");
1949
1949
  // package.json
1950
1950
  var package_default = {
1951
1951
  name: "@lightsparkdev/lightspark-sdk",
1952
- version: "1.3.1",
1952
+ version: "1.5.0",
1953
1953
  description: "Lightspark JS SDK",
1954
1954
  author: "Lightspark Inc.",
1955
1955
  keywords: [
@@ -6975,6 +6975,27 @@ query PaymentRequestsForNode(
6975
6975
  ${FRAGMENT18}
6976
6976
  `;
6977
6977
 
6978
+ // src/graphql/RegisterPayment.ts
6979
+ var RegisterPayment = `
6980
+ mutation RegisterPayment(
6981
+ $provider: ComplianceProvider!
6982
+ $payment_id: ID!
6983
+ $node_pubkey: String!
6984
+ $direction: PaymentDirection!
6985
+ ) {
6986
+ register_payment(input: {
6987
+ provider: $provider
6988
+ payment_id: $payment_id
6989
+ node_pubkey: $node_pubkey
6990
+ direction: $direction
6991
+ }) {
6992
+ payment {
6993
+ id
6994
+ }
6995
+ }
6996
+ }
6997
+ `;
6998
+
6978
6999
  // src/objects/WithdrawalRequest.ts
6979
7000
  var import_auto_bind9 = __toESM(require("auto-bind"), 1);
6980
7001
 
@@ -7162,16 +7183,18 @@ var WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (obj) => {
7162
7183
 
7163
7184
  // src/objects/WithdrawalRequest.ts
7164
7185
  var WithdrawalRequest = class {
7165
- constructor(id, createdAt, updatedAt, amount, bitcoinAddress, withdrawalMode, status, typename, estimatedAmount, completedAt, withdrawalId) {
7186
+ constructor(id, createdAt, updatedAt, requestedAmount, amount, bitcoinAddress, withdrawalMode, status, typename, estimatedAmount, amountWithdrawn, completedAt, withdrawalId) {
7166
7187
  this.id = id;
7167
7188
  this.createdAt = createdAt;
7168
7189
  this.updatedAt = updatedAt;
7190
+ this.requestedAmount = requestedAmount;
7169
7191
  this.amount = amount;
7170
7192
  this.bitcoinAddress = bitcoinAddress;
7171
7193
  this.withdrawalMode = withdrawalMode;
7172
7194
  this.status = status;
7173
7195
  this.typename = typename;
7174
7196
  this.estimatedAmount = estimatedAmount;
7197
+ this.amountWithdrawn = amountWithdrawn;
7175
7198
  this.completedAt = completedAt;
7176
7199
  this.withdrawalId = withdrawalId;
7177
7200
  (0, import_auto_bind9.default)(this);
@@ -7323,8 +7346,12 @@ ${FRAGMENT21}
7323
7346
  withdrawal_request_id: this.id,
7324
7347
  withdrawal_request_created_at: this.createdAt,
7325
7348
  withdrawal_request_updated_at: this.updatedAt,
7349
+ withdrawal_request_requested_amount: CurrencyAmountToJson(
7350
+ this.requestedAmount
7351
+ ),
7326
7352
  withdrawal_request_amount: CurrencyAmountToJson(this.amount),
7327
7353
  withdrawal_request_estimated_amount: this.estimatedAmount ? CurrencyAmountToJson(this.estimatedAmount) : void 0,
7354
+ withdrawal_request_amount_withdrawn: this.amountWithdrawn ? CurrencyAmountToJson(this.amountWithdrawn) : void 0,
7328
7355
  withdrawal_request_bitcoin_address: this.bitcoinAddress,
7329
7356
  withdrawal_request_withdrawal_mode: this.withdrawalMode,
7330
7357
  withdrawal_request_status: this.status,
@@ -7338,12 +7365,14 @@ var WithdrawalRequestFromJson = (obj) => {
7338
7365
  obj["withdrawal_request_id"],
7339
7366
  obj["withdrawal_request_created_at"],
7340
7367
  obj["withdrawal_request_updated_at"],
7368
+ CurrencyAmountFromJson(obj["withdrawal_request_requested_amount"]),
7341
7369
  CurrencyAmountFromJson(obj["withdrawal_request_amount"]),
7342
7370
  obj["withdrawal_request_bitcoin_address"],
7343
7371
  WithdrawalMode_default[obj["withdrawal_request_withdrawal_mode"]] ?? WithdrawalMode_default.FUTURE_VALUE,
7344
7372
  WithdrawalRequestStatus_default[obj["withdrawal_request_status"]] ?? WithdrawalRequestStatus_default.FUTURE_VALUE,
7345
7373
  "WithdrawalRequest",
7346
7374
  !!obj["withdrawal_request_estimated_amount"] ? CurrencyAmountFromJson(obj["withdrawal_request_estimated_amount"]) : void 0,
7375
+ !!obj["withdrawal_request_amount_withdrawn"] ? CurrencyAmountFromJson(obj["withdrawal_request_amount_withdrawn"]) : void 0,
7347
7376
  obj["withdrawal_request_completed_at"],
7348
7377
  obj["withdrawal_request_withdrawal"]?.id ?? void 0
7349
7378
  );
@@ -7354,6 +7383,14 @@ fragment WithdrawalRequestFragment on WithdrawalRequest {
7354
7383
  withdrawal_request_id: id
7355
7384
  withdrawal_request_created_at: created_at
7356
7385
  withdrawal_request_updated_at: updated_at
7386
+ withdrawal_request_requested_amount: requested_amount {
7387
+ __typename
7388
+ currency_amount_original_value: original_value
7389
+ currency_amount_original_unit: original_unit
7390
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7391
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7392
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7393
+ }
7357
7394
  withdrawal_request_amount: amount {
7358
7395
  __typename
7359
7396
  currency_amount_original_value: original_value
@@ -7370,6 +7407,14 @@ fragment WithdrawalRequestFragment on WithdrawalRequest {
7370
7407
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7371
7408
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7372
7409
  }
7410
+ withdrawal_request_amount_withdrawn: amount_withdrawn {
7411
+ __typename
7412
+ currency_amount_original_value: original_value
7413
+ currency_amount_original_unit: original_unit
7414
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7415
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7416
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7417
+ }
7373
7418
  withdrawal_request_bitcoin_address: bitcoin_address
7374
7419
  withdrawal_request_withdrawal_mode: withdrawal_mode
7375
7420
  withdrawal_request_status: status
@@ -7403,6 +7448,21 @@ var RequestWithdrawal = `
7403
7448
  ${FRAGMENT21}
7404
7449
  `;
7405
7450
 
7451
+ // src/graphql/ScreenNode.ts
7452
+ var ScreenNode = `
7453
+ mutation ScreenNode(
7454
+ $provider: ComplianceProvider!
7455
+ $node_pubkey: String!
7456
+ ) {
7457
+ screen_node(input: {
7458
+ provider: $provider
7459
+ node_pubkey: $node_pubkey
7460
+ }) {
7461
+ rating
7462
+ }
7463
+ }
7464
+ `;
7465
+
7406
7466
  // src/graphql/SendPayment.ts
7407
7467
  var SendPayment = `
7408
7468
  mutation SendPayment(
@@ -8341,6 +8401,46 @@ ${FRAGMENT22}
8341
8401
  ${FRAGMENT}
8342
8402
  `;
8343
8403
 
8404
+ // src/objects/WithdrawalFeeEstimateOutput.ts
8405
+ var WithdrawalFeeEstimateOutputFromJson = (obj) => {
8406
+ return {
8407
+ feeEstimate: CurrencyAmountFromJson(
8408
+ obj["withdrawal_fee_estimate_output_fee_estimate"]
8409
+ )
8410
+ };
8411
+ };
8412
+ var FRAGMENT24 = `
8413
+ fragment WithdrawalFeeEstimateOutputFragment on WithdrawalFeeEstimateOutput {
8414
+ __typename
8415
+ withdrawal_fee_estimate_output_fee_estimate: fee_estimate {
8416
+ __typename
8417
+ currency_amount_original_value: original_value
8418
+ currency_amount_original_unit: original_unit
8419
+ currency_amount_preferred_currency_unit: preferred_currency_unit
8420
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8421
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8422
+ }
8423
+ }`;
8424
+
8425
+ // src/graphql/WithdrawalFeeEstimate.ts
8426
+ var WithdrawalFeeEstimate = `
8427
+ query WithdrawalFeeEstimate(
8428
+ $node_id: ID!
8429
+ $amount_sats: Long!
8430
+ $withdrawal_mode: WithdrawalMode!
8431
+ ) {
8432
+ withdrawal_fee_estimate(input: {
8433
+ node_id: $node_id,
8434
+ amount_sats: $amount_sats,
8435
+ withdrawal_mode: $withdrawal_mode
8436
+ }) {
8437
+ ...WithdrawalFeeEstimateOutputFragment
8438
+ }
8439
+ }
8440
+
8441
+ ${FRAGMENT24}
8442
+ `;
8443
+
8344
8444
  // src/objects/Account.ts
8345
8445
  var import_auto_bind12 = __toESM(require("auto-bind"), 1);
8346
8446
 
@@ -8462,7 +8562,7 @@ var LightsparkNodeFromJson = (obj) => {
8462
8562
  `Couldn't find a concrete type for interface LightsparkNode corresponding to the typename=${obj["__typename"]}`
8463
8563
  );
8464
8564
  };
8465
- var FRAGMENT24 = `
8565
+ var FRAGMENT25 = `
8466
8566
  fragment LightsparkNodeFragment on LightsparkNode {
8467
8567
  __typename
8468
8568
  ... on LightsparkNodeWithOSK {
@@ -8736,7 +8836,7 @@ query GetLightsparkNode($id: ID!) {
8736
8836
  }
8737
8837
  }
8738
8838
 
8739
- ${FRAGMENT24}
8839
+ ${FRAGMENT25}
8740
8840
  `,
8741
8841
  variables: { id },
8742
8842
  constructObject: (data) => LightsparkNodeFromJson(data.entity)
@@ -8839,6 +8939,20 @@ var WalletToTransactionsConnectionFromJson = (obj) => {
8839
8939
  };
8840
8940
  };
8841
8941
 
8942
+ // src/objects/WalletToWithdrawalRequestsConnection.ts
8943
+ var WalletToWithdrawalRequestsConnectionFromJson = (obj) => {
8944
+ return {
8945
+ count: obj["wallet_to_withdrawal_requests_connection_count"],
8946
+ pageInfo: PageInfoFromJson(
8947
+ obj["wallet_to_withdrawal_requests_connection_page_info"]
8948
+ ),
8949
+ entities: obj["wallet_to_withdrawal_requests_connection_entities"].map(
8950
+ (e) => WithdrawalRequestFromJson(e)
8951
+ ),
8952
+ typename: "WalletToWithdrawalRequestsConnection"
8953
+ };
8954
+ };
8955
+
8842
8956
  // src/objects/Wallet.ts
8843
8957
  var Wallet = class {
8844
8958
  constructor(id, createdAt, updatedAt, thirdPartyIdentifier, status, typename, lastLoginAt, balances, accountId) {
@@ -9806,6 +9920,86 @@ query FetchWalletTotalAmountReceived($entity_id: ID!, $created_after_date: DateT
9806
9920
  }
9807
9921
  });
9808
9922
  }
9923
+ async getWithdrawalRequests(client, first = void 0, after = void 0, statuses = void 0, createdAfterDate = void 0, createdBeforeDate = void 0) {
9924
+ return await client.executeRawQuery({
9925
+ queryPayload: `
9926
+ query FetchWalletToWithdrawalRequestsConnection($entity_id: ID!, $first: Int, $after: ID, $statuses: [WithdrawalRequestStatus!], $created_after_date: DateTime, $created_before_date: DateTime) {
9927
+ entity(id: $entity_id) {
9928
+ ... on Wallet {
9929
+ withdrawal_requests(, first: $first, after: $after, statuses: $statuses, created_after_date: $created_after_date, created_before_date: $created_before_date) {
9930
+ __typename
9931
+ wallet_to_withdrawal_requests_connection_count: count
9932
+ wallet_to_withdrawal_requests_connection_page_info: page_info {
9933
+ __typename
9934
+ page_info_has_next_page: has_next_page
9935
+ page_info_has_previous_page: has_previous_page
9936
+ page_info_start_cursor: start_cursor
9937
+ page_info_end_cursor: end_cursor
9938
+ }
9939
+ wallet_to_withdrawal_requests_connection_entities: entities {
9940
+ __typename
9941
+ withdrawal_request_id: id
9942
+ withdrawal_request_created_at: created_at
9943
+ withdrawal_request_updated_at: updated_at
9944
+ withdrawal_request_requested_amount: requested_amount {
9945
+ __typename
9946
+ currency_amount_original_value: original_value
9947
+ currency_amount_original_unit: original_unit
9948
+ currency_amount_preferred_currency_unit: preferred_currency_unit
9949
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
9950
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
9951
+ }
9952
+ withdrawal_request_amount: amount {
9953
+ __typename
9954
+ currency_amount_original_value: original_value
9955
+ currency_amount_original_unit: original_unit
9956
+ currency_amount_preferred_currency_unit: preferred_currency_unit
9957
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
9958
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
9959
+ }
9960
+ withdrawal_request_estimated_amount: estimated_amount {
9961
+ __typename
9962
+ currency_amount_original_value: original_value
9963
+ currency_amount_original_unit: original_unit
9964
+ currency_amount_preferred_currency_unit: preferred_currency_unit
9965
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
9966
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
9967
+ }
9968
+ withdrawal_request_amount_withdrawn: amount_withdrawn {
9969
+ __typename
9970
+ currency_amount_original_value: original_value
9971
+ currency_amount_original_unit: original_unit
9972
+ currency_amount_preferred_currency_unit: preferred_currency_unit
9973
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
9974
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
9975
+ }
9976
+ withdrawal_request_bitcoin_address: bitcoin_address
9977
+ withdrawal_request_withdrawal_mode: withdrawal_mode
9978
+ withdrawal_request_status: status
9979
+ withdrawal_request_completed_at: completed_at
9980
+ withdrawal_request_withdrawal: withdrawal {
9981
+ id
9982
+ }
9983
+ }
9984
+ }
9985
+ }
9986
+ }
9987
+ }
9988
+ `,
9989
+ variables: {
9990
+ entity_id: this.id,
9991
+ first,
9992
+ after,
9993
+ statuses,
9994
+ created_after_date: createdAfterDate,
9995
+ created_before_date: createdBeforeDate
9996
+ },
9997
+ constructObject: (json) => {
9998
+ const connection = json["entity"]["withdrawal_requests"];
9999
+ return WalletToWithdrawalRequestsConnectionFromJson(connection);
10000
+ }
10001
+ });
10002
+ }
9809
10003
  async getTotalAmountSent(client, createdAfterDate = void 0, createdBeforeDate = void 0) {
9810
10004
  return await client.executeRawQuery({
9811
10005
  queryPayload: `
@@ -9846,7 +10040,7 @@ query GetWallet($id: ID!) {
9846
10040
  }
9847
10041
  }
9848
10042
 
9849
- ${FRAGMENT25}
10043
+ ${FRAGMENT26}
9850
10044
  `,
9851
10045
  variables: { id },
9852
10046
  constructObject: (data) => WalletFromJson(data.entity)
@@ -9879,7 +10073,7 @@ var WalletFromJson = (obj) => {
9879
10073
  obj["wallet_account"]?.id ?? void 0
9880
10074
  );
9881
10075
  };
9882
- var FRAGMENT25 = `
10076
+ var FRAGMENT26 = `
9883
10077
  fragment WalletFragment on Wallet {
9884
10078
  __typename
9885
10079
  wallet_id: id
@@ -9933,6 +10127,20 @@ var AccountToWalletsConnectionFromJson = (obj) => {
9933
10127
  };
9934
10128
  };
9935
10129
 
10130
+ // src/objects/AccountToWithdrawalRequestsConnection.ts
10131
+ var AccountToWithdrawalRequestsConnectionFromJson = (obj) => {
10132
+ return {
10133
+ count: obj["account_to_withdrawal_requests_connection_count"],
10134
+ pageInfo: PageInfoFromJson(
10135
+ obj["account_to_withdrawal_requests_connection_page_info"]
10136
+ ),
10137
+ entities: obj["account_to_withdrawal_requests_connection_entities"].map(
10138
+ (e) => WithdrawalRequestFromJson(e)
10139
+ ),
10140
+ typename: "AccountToWithdrawalRequestsConnection"
10141
+ };
10142
+ };
10143
+
9936
10144
  // src/objects/Account.ts
9937
10145
  var Account = class {
9938
10146
  constructor(id, createdAt, updatedAt, typename, name) {
@@ -11506,6 +11714,87 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
11506
11714
  }
11507
11715
  });
11508
11716
  }
11717
+ async getWithdrawalRequests(client, first = void 0, after = void 0, bitcoinNetworks = void 0, statuses = void 0, nodeIds = void 0, afterDate = void 0, beforeDate = void 0) {
11718
+ return await client.executeRawQuery({
11719
+ queryPayload: `
11720
+ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $bitcoin_networks: [BitcoinNetwork!], $statuses: [WithdrawalRequestStatus!], $node_ids: [ID!], $after_date: DateTime, $before_date: DateTime) {
11721
+ current_account {
11722
+ ... on Account {
11723
+ withdrawal_requests(, first: $first, after: $after, bitcoin_networks: $bitcoin_networks, statuses: $statuses, node_ids: $node_ids, after_date: $after_date, before_date: $before_date) {
11724
+ __typename
11725
+ account_to_withdrawal_requests_connection_count: count
11726
+ account_to_withdrawal_requests_connection_page_info: page_info {
11727
+ __typename
11728
+ page_info_has_next_page: has_next_page
11729
+ page_info_has_previous_page: has_previous_page
11730
+ page_info_start_cursor: start_cursor
11731
+ page_info_end_cursor: end_cursor
11732
+ }
11733
+ account_to_withdrawal_requests_connection_entities: entities {
11734
+ __typename
11735
+ withdrawal_request_id: id
11736
+ withdrawal_request_created_at: created_at
11737
+ withdrawal_request_updated_at: updated_at
11738
+ withdrawal_request_requested_amount: requested_amount {
11739
+ __typename
11740
+ currency_amount_original_value: original_value
11741
+ currency_amount_original_unit: original_unit
11742
+ currency_amount_preferred_currency_unit: preferred_currency_unit
11743
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
11744
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
11745
+ }
11746
+ withdrawal_request_amount: amount {
11747
+ __typename
11748
+ currency_amount_original_value: original_value
11749
+ currency_amount_original_unit: original_unit
11750
+ currency_amount_preferred_currency_unit: preferred_currency_unit
11751
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
11752
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
11753
+ }
11754
+ withdrawal_request_estimated_amount: estimated_amount {
11755
+ __typename
11756
+ currency_amount_original_value: original_value
11757
+ currency_amount_original_unit: original_unit
11758
+ currency_amount_preferred_currency_unit: preferred_currency_unit
11759
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
11760
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
11761
+ }
11762
+ withdrawal_request_amount_withdrawn: amount_withdrawn {
11763
+ __typename
11764
+ currency_amount_original_value: original_value
11765
+ currency_amount_original_unit: original_unit
11766
+ currency_amount_preferred_currency_unit: preferred_currency_unit
11767
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
11768
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
11769
+ }
11770
+ withdrawal_request_bitcoin_address: bitcoin_address
11771
+ withdrawal_request_withdrawal_mode: withdrawal_mode
11772
+ withdrawal_request_status: status
11773
+ withdrawal_request_completed_at: completed_at
11774
+ withdrawal_request_withdrawal: withdrawal {
11775
+ id
11776
+ }
11777
+ }
11778
+ }
11779
+ }
11780
+ }
11781
+ }
11782
+ `,
11783
+ variables: {
11784
+ first,
11785
+ after,
11786
+ bitcoin_networks: bitcoinNetworks,
11787
+ statuses,
11788
+ node_ids: nodeIds,
11789
+ after_date: afterDate,
11790
+ before_date: beforeDate
11791
+ },
11792
+ constructObject: (json) => {
11793
+ const connection = json["current_account"]["withdrawal_requests"];
11794
+ return AccountToWithdrawalRequestsConnectionFromJson(connection);
11795
+ }
11796
+ });
11797
+ }
11509
11798
  async getWallets(client, first = void 0, after = void 0, thirdPartyIds = void 0) {
11510
11799
  return await client.executeRawQuery({
11511
11800
  queryPayload: `
@@ -11584,7 +11873,7 @@ query GetAccount {
11584
11873
  }
11585
11874
  }
11586
11875
 
11587
- ${FRAGMENT26}
11876
+ ${FRAGMENT27}
11588
11877
  `,
11589
11878
  variables: {},
11590
11879
  constructObject: (data) => AccountFromJson(data.current_account)
@@ -11609,7 +11898,7 @@ var AccountFromJson = (obj) => {
11609
11898
  obj["account_name"]
11610
11899
  );
11611
11900
  };
11612
- var FRAGMENT26 = `
11901
+ var FRAGMENT27 = `
11613
11902
  fragment AccountFragment on Account {
11614
11903
  __typename
11615
11904
  account_id: id
@@ -12116,6 +12405,37 @@ var LightsparkClient = class {
12116
12405
  response.lightning_fee_estimate_for_node.lightning_fee_estimate_output_fee_estimate
12117
12406
  );
12118
12407
  }
12408
+ /**
12409
+ * Returns an estimated amount for the L1 withdrawal fees for the specified node, amount, and
12410
+ * strategy.
12411
+ *
12412
+ * @param nodeId The node from which you'd like to make the withdrawal.
12413
+ * @param amountSats The amount you want to withdraw from this node in Satoshis. Use the special value -1 to withdrawal all funds from this node.
12414
+ * @param withdrawalMode The strategy that should be used to withdraw the funds from this node.
12415
+ * @returns An estimated amount for the L1 withdrawal fees for the specified node, amount, and strategy.
12416
+ */
12417
+ async getWithrawalFeeEstimate(nodeId, amountSats, withdrawalMode) {
12418
+ const response = await this.executeRawQuery({
12419
+ queryPayload: WithdrawalFeeEstimate,
12420
+ variables: {
12421
+ node_id: nodeId,
12422
+ amount_sats: amountSats,
12423
+ withdrawal_mode: withdrawalMode
12424
+ },
12425
+ constructObject: (response2) => {
12426
+ return WithdrawalFeeEstimateOutputFromJson(
12427
+ response2.withdrawal_fee_estimate
12428
+ );
12429
+ }
12430
+ });
12431
+ if (!response) {
12432
+ throw new import_core9.LightsparkException(
12433
+ "WithdrawalFeeEstimateError",
12434
+ "Null or invalid fee estimate response from server"
12435
+ );
12436
+ }
12437
+ return response.feeEstimate;
12438
+ }
12119
12439
  /**
12120
12440
  * Directly unlocks a node with a signing private key or alias.
12121
12441
  *
@@ -12450,6 +12770,64 @@ var LightsparkClient = class {
12450
12770
  }
12451
12771
  });
12452
12772
  }
12773
+ /**
12774
+ * Performs sanction screening on a lightning node against a given compliance provider.
12775
+ *
12776
+ * @param complianceProvider The provider that you want to use to perform the screening. You must have a valid
12777
+ * API token for the provider set in your Lightspark account settings.
12778
+ * @param nodePubKey The public key of the node that needs to be screened.
12779
+ * @returns A RiskRating for the node.
12780
+ */
12781
+ async screenNode(complianceProvider, nodePubKey) {
12782
+ return await this.requester.executeQuery({
12783
+ queryPayload: ScreenNode,
12784
+ variables: {
12785
+ node_pubkey: nodePubKey,
12786
+ provider: complianceProvider
12787
+ },
12788
+ constructObject: (responseJson) => {
12789
+ if (responseJson.screen_node?.rating === void 0) {
12790
+ throw new import_core9.LightsparkException(
12791
+ "ScreenNodeError",
12792
+ "Unable to screen node"
12793
+ );
12794
+ }
12795
+ const rating = responseJson.screen_node.rating;
12796
+ return RiskRating_default[rating] ?? RiskRating_default.FUTURE_VALUE;
12797
+ }
12798
+ });
12799
+ }
12800
+ /**
12801
+ * Registers a succeeded payment with a compliance provider for monitoring.
12802
+ *
12803
+ * @param complianceProvider The provider that you want to use to register the payment. You must have
12804
+ * a valid API token for the provider set in your Lightspark account settings.
12805
+ * @param paymentId The unique ID of the payment
12806
+ * @param nodePubKey The public key of the counterparty node which is the recipient node if the
12807
+ * payment is an outgoing payment and the sender node if the payment is an incoming payment.
12808
+ * @param paymentDirection Indicates whether the payment is an incoming or outgoing payment.
12809
+ * @returns The ID of the payment that was registered.
12810
+ */
12811
+ async registerPayment(complianceProvider, paymentId, nodePubKey, paymentDirection) {
12812
+ return await this.requester.executeQuery({
12813
+ queryPayload: RegisterPayment,
12814
+ variables: {
12815
+ payment_id: paymentId,
12816
+ node_pubkey: nodePubKey,
12817
+ direction: paymentDirection,
12818
+ provider: complianceProvider
12819
+ },
12820
+ constructObject: (responseJson) => {
12821
+ if (!responseJson.register_payment?.payment?.id) {
12822
+ throw new import_core9.LightsparkException(
12823
+ "RegisterPaymentError",
12824
+ "Unable to register payment"
12825
+ );
12826
+ }
12827
+ return responseJson.register_payment.payment.id;
12828
+ }
12829
+ });
12830
+ }
12453
12831
  /**
12454
12832
  * Creates an UMA invitation. If you are part of the incentive program,
12455
12833
  * you should use [createUmaInvitationWithIncentives].
@@ -12928,7 +13306,7 @@ var SignablePayloadFromJson = (obj) => {
12928
13306
  mulTweak: obj["signable_payload_mul_tweak"]
12929
13307
  };
12930
13308
  };
12931
- var FRAGMENT27 = `
13309
+ var FRAGMENT28 = `
12932
13310
  fragment SignablePayloadFragment on SignablePayload {
12933
13311
  __typename
12934
13312
  signable_payload_id: id
@@ -12954,7 +13332,7 @@ query GetSignablePayload($id: ID!) {
12954
13332
  }
12955
13333
  }
12956
13334
 
12957
- ${FRAGMENT27}
13335
+ ${FRAGMENT28}
12958
13336
  `,
12959
13337
  variables: { id },
12960
13338
  constructObject: (data) => SignablePayloadFromJson(data.entity)
@@ -12980,7 +13358,7 @@ var DepositFromJson = (obj) => {
12980
13358
  numConfirmations: obj["deposit_num_confirmations"]
12981
13359
  };
12982
13360
  };
12983
- var FRAGMENT28 = `
13361
+ var FRAGMENT29 = `
12984
13362
  fragment DepositFragment on Deposit {
12985
13363
  __typename
12986
13364
  deposit_id: id
@@ -13024,7 +13402,7 @@ query GetDeposit($id: ID!) {
13024
13402
  }
13025
13403
  }
13026
13404
 
13027
- ${FRAGMENT28}
13405
+ ${FRAGMENT29}
13028
13406
  `,
13029
13407
  variables: { id },
13030
13408
  constructObject: (data) => DepositFromJson(data.entity)
@@ -13097,7 +13475,7 @@ var LightningTransactionFromJson = (obj) => {
13097
13475
  `Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
13098
13476
  );
13099
13477
  };
13100
- var FRAGMENT29 = `
13478
+ var FRAGMENT30 = `
13101
13479
  fragment LightningTransactionFragment on LightningTransaction {
13102
13480
  __typename
13103
13481
  ... on IncomingPayment {
@@ -13526,7 +13904,7 @@ query GetLightningTransaction($id: ID!) {
13526
13904
  }
13527
13905
  }
13528
13906
 
13529
- ${FRAGMENT29}
13907
+ ${FRAGMENT30}
13530
13908
  `,
13531
13909
  variables: { id },
13532
13910
  constructObject: (data) => LightningTransactionFromJson(data.entity)
@@ -13563,7 +13941,7 @@ var LightsparkNodeOwnerFromJson = (obj) => {
13563
13941
  `Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
13564
13942
  );
13565
13943
  };
13566
- var FRAGMENT30 = `
13944
+ var FRAGMENT31 = `
13567
13945
  fragment LightsparkNodeOwnerFragment on LightsparkNodeOwner {
13568
13946
  __typename
13569
13947
  ... on Account {
@@ -13624,7 +14002,7 @@ query GetLightsparkNodeOwner($id: ID!) {
13624
14002
  }
13625
14003
  }
13626
14004
 
13627
- ${FRAGMENT30}
14005
+ ${FRAGMENT31}
13628
14006
  `,
13629
14007
  variables: { id },
13630
14008
  constructObject: (data) => LightsparkNodeOwnerFromJson(data.entity)
@@ -13711,7 +14089,7 @@ var OnChainTransactionFromJson = (obj) => {
13711
14089
  `Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
13712
14090
  );
13713
14091
  };
13714
- var FRAGMENT31 = `
14092
+ var FRAGMENT32 = `
13715
14093
  fragment OnChainTransactionFragment on OnChainTransaction {
13716
14094
  __typename
13717
14095
  ... on ChannelClosingTransaction {
@@ -13854,7 +14232,7 @@ query GetOnChainTransaction($id: ID!) {
13854
14232
  }
13855
14233
  }
13856
14234
 
13857
- ${FRAGMENT31}
14235
+ ${FRAGMENT32}
13858
14236
  `,
13859
14237
  variables: { id },
13860
14238
  constructObject: (data) => OnChainTransactionFromJson(data.entity)
@@ -13913,7 +14291,7 @@ var RoutingTransactionFromJson = (obj) => {
13913
14291
  failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
13914
14292
  };
13915
14293
  };
13916
- var FRAGMENT32 = `
14294
+ var FRAGMENT33 = `
13917
14295
  fragment RoutingTransactionFragment on RoutingTransaction {
13918
14296
  __typename
13919
14297
  routing_transaction_id: id
@@ -13961,7 +14339,7 @@ query GetRoutingTransaction($id: ID!) {
13961
14339
  }
13962
14340
  }
13963
14341
 
13964
- ${FRAGMENT32}
14342
+ ${FRAGMENT33}
13965
14343
  `,
13966
14344
  variables: { id },
13967
14345
  constructObject: (data) => RoutingTransactionFromJson(data.entity)
@@ -13977,7 +14355,7 @@ var SignableFromJson = (obj) => {
13977
14355
  typename: "Signable"
13978
14356
  };
13979
14357
  };
13980
- var FRAGMENT33 = `
14358
+ var FRAGMENT34 = `
13981
14359
  fragment SignableFragment on Signable {
13982
14360
  __typename
13983
14361
  signable_id: id
@@ -13995,7 +14373,7 @@ query GetSignable($id: ID!) {
13995
14373
  }
13996
14374
  }
13997
14375
 
13998
- ${FRAGMENT33}
14376
+ ${FRAGMENT34}
13999
14377
  `,
14000
14378
  variables: { id },
14001
14379
  constructObject: (data) => SignableFromJson(data.entity)
@@ -14058,7 +14436,7 @@ var WithdrawalFromJson = (obj) => {
14058
14436
  numConfirmations: obj["withdrawal_num_confirmations"]
14059
14437
  };
14060
14438
  };
14061
- var FRAGMENT34 = `
14439
+ var FRAGMENT35 = `
14062
14440
  fragment WithdrawalFragment on Withdrawal {
14063
14441
  __typename
14064
14442
  withdrawal_id: id
@@ -14102,7 +14480,7 @@ query GetWithdrawal($id: ID!) {
14102
14480
  }
14103
14481
  }
14104
14482
 
14105
- ${FRAGMENT34}
14483
+ ${FRAGMENT35}
14106
14484
  `,
14107
14485
  variables: { id },
14108
14486
  constructObject: (data) => WithdrawalFromJson(data.entity)