@lightsparkdev/lightspark-sdk 1.1.0 → 1.1.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/dist/index.cjs CHANGED
@@ -1938,7 +1938,7 @@ var import_core9 = require("@lightsparkdev/core");
1938
1938
  // package.json
1939
1939
  var package_default = {
1940
1940
  name: "@lightsparkdev/lightspark-sdk",
1941
- version: "1.1.0",
1941
+ version: "1.1.2",
1942
1942
  description: "Lightspark JS SDK",
1943
1943
  author: "Lightspark Inc.",
1944
1944
  keywords: [
@@ -2018,7 +2018,9 @@ var package_default = {
2018
2018
  "lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
2019
2019
  lint: "eslint .",
2020
2020
  postversion: "yarn build",
2021
- test: "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail",
2021
+ "test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail",
2022
+ test: "yarn test-cmd src/tests/*.test.ts",
2023
+ "test:integration": "yarn test-cmd src/tests/integration/*.test.ts",
2022
2024
  "types:watch": "tsc-absolute --watch",
2023
2025
  types: "tsc"
2024
2026
  },
@@ -4650,7 +4652,7 @@ var FundNode = `
4650
4652
  $node_id: ID!,
4651
4653
  $amountSats: Long
4652
4654
  ) {
4653
- fund_node(input: { node_id: $node_id, amount_sats: $amountMsats }) {
4655
+ fund_node(input: { node_id: $node_id, amount_sats: $amountSats }) {
4654
4656
  amount {
4655
4657
  ...CurrencyAmountFragment
4656
4658
  }
@@ -5544,257 +5546,79 @@ var PayInvoice = `
5544
5546
  ${FRAGMENT16}
5545
5547
  `;
5546
5548
 
5547
- // src/graphql/PayUmaInvoice.ts
5548
- var PayUmaInvoice = `
5549
- mutation PayUmaInvoice(
5550
- $node_id: ID!
5551
- $encoded_invoice: String!
5552
- $timeout_secs: Int!
5553
- $maximum_fees_msats: Long!
5554
- $amount_msats: Long
5555
- ) {
5556
- pay_uma_invoice(
5557
- input: {
5558
- node_id: $node_id
5559
- encoded_invoice: $encoded_invoice
5560
- timeout_secs: $timeout_secs
5561
- maximum_fees_msats: $maximum_fees_msats
5562
- amount_msats: $amount_msats
5563
- }
5564
- ) {
5565
- payment {
5566
- ...OutgoingPaymentFragment
5567
- }
5568
- }
5549
+ // src/objects/PaymentRequest.ts
5550
+ var import_core4 = require("@lightsparkdev/core");
5551
+ var PaymentRequestFromJson = (obj) => {
5552
+ if (obj["__typename"] == "Invoice") {
5553
+ return {
5554
+ id: obj["invoice_id"],
5555
+ createdAt: obj["invoice_created_at"],
5556
+ updatedAt: obj["invoice_updated_at"],
5557
+ data: InvoiceDataFromJson(obj["invoice_data"]),
5558
+ status: PaymentRequestStatus_default[obj["invoice_status"]] ?? PaymentRequestStatus_default.FUTURE_VALUE,
5559
+ typename: "Invoice",
5560
+ amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
5561
+ };
5569
5562
  }
5570
-
5571
- ${FRAGMENT16}
5572
- `;
5573
-
5574
- // src/objects/WithdrawalRequest.ts
5575
- var import_auto_bind10 = __toESM(require("auto-bind"), 1);
5576
-
5577
- // src/objects/WithdrawalMode.ts
5578
- var WithdrawalMode = /* @__PURE__ */ ((WithdrawalMode2) => {
5579
- WithdrawalMode2["FUTURE_VALUE"] = "FUTURE_VALUE";
5580
- WithdrawalMode2["WALLET_ONLY"] = "WALLET_ONLY";
5581
- WithdrawalMode2["WALLET_THEN_CHANNELS"] = "WALLET_THEN_CHANNELS";
5582
- return WithdrawalMode2;
5583
- })(WithdrawalMode || {});
5584
- var WithdrawalMode_default = WithdrawalMode;
5585
-
5586
- // src/objects/WithdrawalRequestStatus.ts
5587
- var WithdrawalRequestStatus = /* @__PURE__ */ ((WithdrawalRequestStatus2) => {
5588
- WithdrawalRequestStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
5589
- WithdrawalRequestStatus2["FAILED"] = "FAILED";
5590
- WithdrawalRequestStatus2["IN_PROGRESS"] = "IN_PROGRESS";
5591
- WithdrawalRequestStatus2["SUCCESSFUL"] = "SUCCESSFUL";
5592
- return WithdrawalRequestStatus2;
5593
- })(WithdrawalRequestStatus || {});
5594
- var WithdrawalRequestStatus_default = WithdrawalRequestStatus;
5595
-
5596
- // src/objects/ChannelClosingTransaction.ts
5597
- var ChannelClosingTransactionFromJson = (obj) => {
5598
- return {
5599
- id: obj["channel_closing_transaction_id"],
5600
- createdAt: obj["channel_closing_transaction_created_at"],
5601
- updatedAt: obj["channel_closing_transaction_updated_at"],
5602
- status: TransactionStatus_default[obj["channel_closing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
5603
- amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
5604
- blockHeight: obj["channel_closing_transaction_block_height"],
5605
- destinationAddresses: obj["channel_closing_transaction_destination_addresses"],
5606
- typename: "ChannelClosingTransaction",
5607
- resolvedAt: obj["channel_closing_transaction_resolved_at"],
5608
- transactionHash: obj["channel_closing_transaction_transaction_hash"],
5609
- fees: !!obj["channel_closing_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"]) : void 0,
5610
- blockHash: obj["channel_closing_transaction_block_hash"],
5611
- numConfirmations: obj["channel_closing_transaction_num_confirmations"],
5612
- channelId: obj["channel_closing_transaction_channel"]?.id ?? void 0
5613
- };
5563
+ throw new import_core4.LightsparkException(
5564
+ "DeserializationError",
5565
+ `Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`
5566
+ );
5614
5567
  };
5615
5568
  var FRAGMENT17 = `
5616
- fragment ChannelClosingTransactionFragment on ChannelClosingTransaction {
5617
- __typename
5618
- channel_closing_transaction_id: id
5619
- channel_closing_transaction_created_at: created_at
5620
- channel_closing_transaction_updated_at: updated_at
5621
- channel_closing_transaction_status: status
5622
- channel_closing_transaction_resolved_at: resolved_at
5623
- channel_closing_transaction_amount: amount {
5624
- __typename
5625
- currency_amount_original_value: original_value
5626
- currency_amount_original_unit: original_unit
5627
- currency_amount_preferred_currency_unit: preferred_currency_unit
5628
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5629
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5630
- }
5631
- channel_closing_transaction_transaction_hash: transaction_hash
5632
- channel_closing_transaction_fees: fees {
5633
- __typename
5634
- currency_amount_original_value: original_value
5635
- currency_amount_original_unit: original_unit
5636
- currency_amount_preferred_currency_unit: preferred_currency_unit
5637
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5638
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5639
- }
5640
- channel_closing_transaction_block_hash: block_hash
5641
- channel_closing_transaction_block_height: block_height
5642
- channel_closing_transaction_destination_addresses: destination_addresses
5643
- channel_closing_transaction_num_confirmations: num_confirmations
5644
- channel_closing_transaction_channel: channel {
5645
- id
5646
- }
5647
- }`;
5648
- var getChannelClosingTransactionQuery = (id) => {
5649
- return {
5650
- queryPayload: `
5651
- query GetChannelClosingTransaction($id: ID!) {
5652
- entity(id: $id) {
5653
- ... on ChannelClosingTransaction {
5654
- ...ChannelClosingTransactionFragment
5655
- }
5656
- }
5657
- }
5658
-
5659
- ${FRAGMENT17}
5660
- `,
5661
- variables: { id },
5662
- constructObject: (data) => ChannelClosingTransactionFromJson(data.entity)
5663
- };
5664
- };
5665
-
5666
- // src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts
5667
- var WithdrawalRequestToChannelClosingTransactionsConnectionFromJson = (obj) => {
5668
- return {
5669
- pageInfo: PageInfoFromJson(
5670
- obj["withdrawal_request_to_channel_closing_transactions_connection_page_info"]
5671
- ),
5672
- count: obj["withdrawal_request_to_channel_closing_transactions_connection_count"],
5673
- entities: obj["withdrawal_request_to_channel_closing_transactions_connection_entities"].map((e) => ChannelClosingTransactionFromJson(e))
5674
- };
5675
- };
5676
-
5677
- // src/objects/ChannelOpeningTransaction.ts
5678
- var ChannelOpeningTransactionFromJson = (obj) => {
5679
- return {
5680
- id: obj["channel_opening_transaction_id"],
5681
- createdAt: obj["channel_opening_transaction_created_at"],
5682
- updatedAt: obj["channel_opening_transaction_updated_at"],
5683
- status: TransactionStatus_default[obj["channel_opening_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
5684
- amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
5685
- blockHeight: obj["channel_opening_transaction_block_height"],
5686
- destinationAddresses: obj["channel_opening_transaction_destination_addresses"],
5687
- typename: "ChannelOpeningTransaction",
5688
- resolvedAt: obj["channel_opening_transaction_resolved_at"],
5689
- transactionHash: obj["channel_opening_transaction_transaction_hash"],
5690
- fees: !!obj["channel_opening_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"]) : void 0,
5691
- blockHash: obj["channel_opening_transaction_block_hash"],
5692
- numConfirmations: obj["channel_opening_transaction_num_confirmations"],
5693
- channelId: obj["channel_opening_transaction_channel"]?.id ?? void 0
5694
- };
5695
- };
5696
- var FRAGMENT18 = `
5697
- fragment ChannelOpeningTransactionFragment on ChannelOpeningTransaction {
5569
+ fragment PaymentRequestFragment on PaymentRequest {
5698
5570
  __typename
5699
- channel_opening_transaction_id: id
5700
- channel_opening_transaction_created_at: created_at
5701
- channel_opening_transaction_updated_at: updated_at
5702
- channel_opening_transaction_status: status
5703
- channel_opening_transaction_resolved_at: resolved_at
5704
- channel_opening_transaction_amount: amount {
5705
- __typename
5706
- currency_amount_original_value: original_value
5707
- currency_amount_original_unit: original_unit
5708
- currency_amount_preferred_currency_unit: preferred_currency_unit
5709
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5710
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5711
- }
5712
- channel_opening_transaction_transaction_hash: transaction_hash
5713
- channel_opening_transaction_fees: fees {
5571
+ ... on Invoice {
5714
5572
  __typename
5715
- currency_amount_original_value: original_value
5716
- currency_amount_original_unit: original_unit
5717
- currency_amount_preferred_currency_unit: preferred_currency_unit
5718
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5719
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5720
- }
5721
- channel_opening_transaction_block_hash: block_hash
5722
- channel_opening_transaction_block_height: block_height
5723
- channel_opening_transaction_destination_addresses: destination_addresses
5724
- channel_opening_transaction_num_confirmations: num_confirmations
5725
- channel_opening_transaction_channel: channel {
5726
- id
5727
- }
5728
- }`;
5729
- var getChannelOpeningTransactionQuery = (id) => {
5730
- return {
5731
- queryPayload: `
5732
- query GetChannelOpeningTransaction($id: ID!) {
5733
- entity(id: $id) {
5734
- ... on ChannelOpeningTransaction {
5735
- ...ChannelOpeningTransactionFragment
5736
- }
5737
- }
5738
- }
5739
-
5740
- ${FRAGMENT18}
5741
- `,
5742
- variables: { id },
5743
- constructObject: (data) => ChannelOpeningTransactionFromJson(data.entity)
5744
- };
5745
- };
5746
-
5747
- // src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts
5748
- var WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (obj) => {
5749
- return {
5750
- pageInfo: PageInfoFromJson(
5751
- obj["withdrawal_request_to_channel_opening_transactions_connection_page_info"]
5752
- ),
5753
- count: obj["withdrawal_request_to_channel_opening_transactions_connection_count"],
5754
- entities: obj["withdrawal_request_to_channel_opening_transactions_connection_entities"].map((e) => ChannelOpeningTransactionFromJson(e))
5755
- };
5756
- };
5757
-
5758
- // src/objects/WithdrawalRequest.ts
5759
- var WithdrawalRequest = class {
5760
- constructor(id, createdAt, updatedAt, amount, bitcoinAddress, withdrawalMode, status, typename, estimatedAmount, completedAt, withdrawalId) {
5761
- this.id = id;
5762
- this.createdAt = createdAt;
5763
- this.updatedAt = updatedAt;
5764
- this.amount = amount;
5765
- this.bitcoinAddress = bitcoinAddress;
5766
- this.withdrawalMode = withdrawalMode;
5767
- this.status = status;
5768
- this.typename = typename;
5769
- this.estimatedAmount = estimatedAmount;
5770
- this.completedAt = completedAt;
5771
- this.withdrawalId = withdrawalId;
5772
- (0, import_auto_bind10.default)(this);
5773
- }
5774
- async getChannelClosingTransactions(client, first = void 0) {
5775
- return await client.executeRawQuery({
5776
- queryPayload: `
5777
- query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: ID!, $first: Int) {
5778
- entity(id: $entity_id) {
5779
- ... on WithdrawalRequest {
5780
- channel_closing_transactions(, first: $first) {
5781
- __typename
5782
- withdrawal_request_to_channel_closing_transactions_connection_page_info: page_info {
5783
- __typename
5784
- page_info_has_next_page: has_next_page
5785
- page_info_has_previous_page: has_previous_page
5786
- page_info_start_cursor: start_cursor
5787
- page_info_end_cursor: end_cursor
5788
- }
5789
- withdrawal_request_to_channel_closing_transactions_connection_count: count
5790
- withdrawal_request_to_channel_closing_transactions_connection_entities: entities {
5573
+ invoice_id: id
5574
+ invoice_created_at: created_at
5575
+ invoice_updated_at: updated_at
5576
+ invoice_data: data {
5577
+ __typename
5578
+ invoice_data_encoded_payment_request: encoded_payment_request
5579
+ invoice_data_bitcoin_network: bitcoin_network
5580
+ invoice_data_payment_hash: payment_hash
5581
+ invoice_data_amount: amount {
5582
+ __typename
5583
+ currency_amount_original_value: original_value
5584
+ currency_amount_original_unit: original_unit
5585
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5586
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5587
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5588
+ }
5589
+ invoice_data_created_at: created_at
5590
+ invoice_data_expires_at: expires_at
5591
+ invoice_data_memo: memo
5592
+ invoice_data_destination: destination {
5593
+ __typename
5594
+ ... on GraphNode {
5791
5595
  __typename
5792
- channel_closing_transaction_id: id
5793
- channel_closing_transaction_created_at: created_at
5794
- channel_closing_transaction_updated_at: updated_at
5795
- channel_closing_transaction_status: status
5796
- channel_closing_transaction_resolved_at: resolved_at
5797
- channel_closing_transaction_amount: amount {
5596
+ graph_node_id: id
5597
+ graph_node_created_at: created_at
5598
+ graph_node_updated_at: updated_at
5599
+ graph_node_alias: alias
5600
+ graph_node_bitcoin_network: bitcoin_network
5601
+ graph_node_color: color
5602
+ graph_node_conductivity: conductivity
5603
+ graph_node_display_name: display_name
5604
+ graph_node_public_key: public_key
5605
+ }
5606
+ ... on LightsparkNodeWithOSK {
5607
+ __typename
5608
+ lightspark_node_with_o_s_k_id: id
5609
+ lightspark_node_with_o_s_k_created_at: created_at
5610
+ lightspark_node_with_o_s_k_updated_at: updated_at
5611
+ lightspark_node_with_o_s_k_alias: alias
5612
+ lightspark_node_with_o_s_k_bitcoin_network: bitcoin_network
5613
+ lightspark_node_with_o_s_k_color: color
5614
+ lightspark_node_with_o_s_k_conductivity: conductivity
5615
+ lightspark_node_with_o_s_k_display_name: display_name
5616
+ lightspark_node_with_o_s_k_public_key: public_key
5617
+ lightspark_node_with_o_s_k_owner: owner {
5618
+ id
5619
+ }
5620
+ lightspark_node_with_o_s_k_status: status
5621
+ lightspark_node_with_o_s_k_total_balance: total_balance {
5798
5622
  __typename
5799
5623
  currency_amount_original_value: original_value
5800
5624
  currency_amount_original_unit: original_unit
@@ -5802,8 +5626,7 @@ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: I
5802
5626
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5803
5627
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5804
5628
  }
5805
- channel_closing_transaction_transaction_hash: transaction_hash
5806
- channel_closing_transaction_fees: fees {
5629
+ lightspark_node_with_o_s_k_total_local_balance: total_local_balance {
5807
5630
  __typename
5808
5631
  currency_amount_original_value: original_value
5809
5632
  currency_amount_original_unit: original_unit
@@ -5811,52 +5634,96 @@ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: I
5811
5634
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5812
5635
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5813
5636
  }
5814
- channel_closing_transaction_block_hash: block_hash
5815
- channel_closing_transaction_block_height: block_height
5816
- channel_closing_transaction_destination_addresses: destination_addresses
5817
- channel_closing_transaction_num_confirmations: num_confirmations
5818
- channel_closing_transaction_channel: channel {
5819
- id
5637
+ lightspark_node_with_o_s_k_local_balance: local_balance {
5638
+ __typename
5639
+ currency_amount_original_value: original_value
5640
+ currency_amount_original_unit: original_unit
5641
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5642
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5643
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5644
+ }
5645
+ lightspark_node_with_o_s_k_remote_balance: remote_balance {
5646
+ __typename
5647
+ currency_amount_original_value: original_value
5648
+ currency_amount_original_unit: original_unit
5649
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5650
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5651
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5652
+ }
5653
+ lightspark_node_with_o_s_k_blockchain_balance: blockchain_balance {
5654
+ __typename
5655
+ blockchain_balance_total_balance: total_balance {
5656
+ __typename
5657
+ currency_amount_original_value: original_value
5658
+ currency_amount_original_unit: original_unit
5659
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5660
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5661
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5662
+ }
5663
+ blockchain_balance_confirmed_balance: confirmed_balance {
5664
+ __typename
5665
+ currency_amount_original_value: original_value
5666
+ currency_amount_original_unit: original_unit
5667
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5668
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5669
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5670
+ }
5671
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
5672
+ __typename
5673
+ currency_amount_original_value: original_value
5674
+ currency_amount_original_unit: original_unit
5675
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5676
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5677
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5678
+ }
5679
+ blockchain_balance_locked_balance: locked_balance {
5680
+ __typename
5681
+ currency_amount_original_value: original_value
5682
+ currency_amount_original_unit: original_unit
5683
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5684
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5685
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5686
+ }
5687
+ blockchain_balance_required_reserve: required_reserve {
5688
+ __typename
5689
+ currency_amount_original_value: original_value
5690
+ currency_amount_original_unit: original_unit
5691
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5692
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5693
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5694
+ }
5695
+ blockchain_balance_available_balance: available_balance {
5696
+ __typename
5697
+ currency_amount_original_value: original_value
5698
+ currency_amount_original_unit: original_unit
5699
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5700
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5701
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5702
+ }
5703
+ }
5704
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
5705
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
5706
+ __typename
5707
+ secret_encrypted_value: encrypted_value
5708
+ secret_cipher: cipher
5820
5709
  }
5821
5710
  }
5822
- }
5823
- }
5824
- }
5825
- }
5826
- `,
5827
- variables: { entity_id: this.id, first },
5828
- constructObject: (json) => {
5829
- const connection = json["entity"]["channel_closing_transactions"];
5830
- return WithdrawalRequestToChannelClosingTransactionsConnectionFromJson(
5831
- connection
5832
- );
5833
- }
5834
- });
5835
- }
5836
- async getChannelOpeningTransactions(client, first = void 0) {
5837
- return await client.executeRawQuery({
5838
- queryPayload: `
5839
- query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: ID!, $first: Int) {
5840
- entity(id: $entity_id) {
5841
- ... on WithdrawalRequest {
5842
- channel_opening_transactions(, first: $first) {
5843
- __typename
5844
- withdrawal_request_to_channel_opening_transactions_connection_page_info: page_info {
5845
- __typename
5846
- page_info_has_next_page: has_next_page
5847
- page_info_has_previous_page: has_previous_page
5848
- page_info_start_cursor: start_cursor
5849
- page_info_end_cursor: end_cursor
5850
- }
5851
- withdrawal_request_to_channel_opening_transactions_connection_count: count
5852
- withdrawal_request_to_channel_opening_transactions_connection_entities: entities {
5711
+ ... on LightsparkNodeWithRemoteSigning {
5853
5712
  __typename
5854
- channel_opening_transaction_id: id
5855
- channel_opening_transaction_created_at: created_at
5856
- channel_opening_transaction_updated_at: updated_at
5857
- channel_opening_transaction_status: status
5858
- channel_opening_transaction_resolved_at: resolved_at
5859
- channel_opening_transaction_amount: amount {
5713
+ lightspark_node_with_remote_signing_id: id
5714
+ lightspark_node_with_remote_signing_created_at: created_at
5715
+ lightspark_node_with_remote_signing_updated_at: updated_at
5716
+ lightspark_node_with_remote_signing_alias: alias
5717
+ lightspark_node_with_remote_signing_bitcoin_network: bitcoin_network
5718
+ lightspark_node_with_remote_signing_color: color
5719
+ lightspark_node_with_remote_signing_conductivity: conductivity
5720
+ lightspark_node_with_remote_signing_display_name: display_name
5721
+ lightspark_node_with_remote_signing_public_key: public_key
5722
+ lightspark_node_with_remote_signing_owner: owner {
5723
+ id
5724
+ }
5725
+ lightspark_node_with_remote_signing_status: status
5726
+ lightspark_node_with_remote_signing_total_balance: total_balance {
5860
5727
  __typename
5861
5728
  currency_amount_original_value: original_value
5862
5729
  currency_amount_original_unit: original_unit
@@ -5864,8 +5731,7 @@ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: I
5864
5731
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5865
5732
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5866
5733
  }
5867
- channel_opening_transaction_transaction_hash: transaction_hash
5868
- channel_opening_transaction_fees: fees {
5734
+ lightspark_node_with_remote_signing_total_local_balance: total_local_balance {
5869
5735
  __typename
5870
5736
  currency_amount_original_value: original_value
5871
5737
  currency_amount_original_unit: original_unit
@@ -5873,132 +5739,153 @@ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: I
5873
5739
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5874
5740
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5875
5741
  }
5876
- channel_opening_transaction_block_hash: block_hash
5877
- channel_opening_transaction_block_height: block_height
5878
- channel_opening_transaction_destination_addresses: destination_addresses
5879
- channel_opening_transaction_num_confirmations: num_confirmations
5880
- channel_opening_transaction_channel: channel {
5881
- id
5742
+ lightspark_node_with_remote_signing_local_balance: local_balance {
5743
+ __typename
5744
+ currency_amount_original_value: original_value
5745
+ currency_amount_original_unit: original_unit
5746
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5747
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5748
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5882
5749
  }
5883
- }
5884
- }
5885
- }
5886
- }
5887
- }
5888
- `,
5889
- variables: { entity_id: this.id, first },
5890
- constructObject: (json) => {
5891
- const connection = json["entity"]["channel_opening_transactions"];
5892
- return WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson(
5893
- connection
5894
- );
5895
- }
5896
- });
5897
- }
5898
- static getWithdrawalRequestQuery(id) {
5899
- return {
5900
- queryPayload: `
5901
- query GetWithdrawalRequest($id: ID!) {
5902
- entity(id: $id) {
5903
- ... on WithdrawalRequest {
5904
- ...WithdrawalRequestFragment
5905
- }
5906
- }
5907
- }
5908
-
5909
- ${FRAGMENT19}
5910
- `,
5911
- variables: { id },
5912
- constructObject: (data) => WithdrawalRequestFromJson(data.entity)
5913
- };
5914
- }
5915
- };
5916
- var WithdrawalRequestFromJson = (obj) => {
5917
- return new WithdrawalRequest(
5918
- obj["withdrawal_request_id"],
5919
- obj["withdrawal_request_created_at"],
5920
- obj["withdrawal_request_updated_at"],
5921
- CurrencyAmountFromJson(obj["withdrawal_request_amount"]),
5922
- obj["withdrawal_request_bitcoin_address"],
5923
- WithdrawalMode_default[obj["withdrawal_request_withdrawal_mode"]] ?? WithdrawalMode_default.FUTURE_VALUE,
5924
- WithdrawalRequestStatus_default[obj["withdrawal_request_status"]] ?? WithdrawalRequestStatus_default.FUTURE_VALUE,
5925
- "WithdrawalRequest",
5926
- !!obj["withdrawal_request_estimated_amount"] ? CurrencyAmountFromJson(obj["withdrawal_request_estimated_amount"]) : void 0,
5927
- obj["withdrawal_request_completed_at"],
5928
- obj["withdrawal_request_withdrawal"]?.id ?? void 0
5929
- );
5930
- };
5931
- var FRAGMENT19 = `
5932
- fragment WithdrawalRequestFragment on WithdrawalRequest {
5933
- __typename
5934
- withdrawal_request_id: id
5935
- withdrawal_request_created_at: created_at
5936
- withdrawal_request_updated_at: updated_at
5937
- withdrawal_request_amount: amount {
5938
- __typename
5939
- currency_amount_original_value: original_value
5940
- currency_amount_original_unit: original_unit
5941
- currency_amount_preferred_currency_unit: preferred_currency_unit
5942
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5943
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5944
- }
5945
- withdrawal_request_estimated_amount: estimated_amount {
5946
- __typename
5947
- currency_amount_original_value: original_value
5948
- currency_amount_original_unit: original_unit
5949
- currency_amount_preferred_currency_unit: preferred_currency_unit
5950
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5951
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5952
- }
5953
- withdrawal_request_bitcoin_address: bitcoin_address
5954
- withdrawal_request_withdrawal_mode: withdrawal_mode
5955
- withdrawal_request_status: status
5956
- withdrawal_request_completed_at: completed_at
5957
- withdrawal_request_withdrawal: withdrawal {
5958
- id
5750
+ lightspark_node_with_remote_signing_remote_balance: remote_balance {
5751
+ __typename
5752
+ currency_amount_original_value: original_value
5753
+ currency_amount_original_unit: original_unit
5754
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5755
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5756
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5757
+ }
5758
+ lightspark_node_with_remote_signing_blockchain_balance: blockchain_balance {
5759
+ __typename
5760
+ blockchain_balance_total_balance: total_balance {
5761
+ __typename
5762
+ currency_amount_original_value: original_value
5763
+ currency_amount_original_unit: original_unit
5764
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5765
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5766
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5767
+ }
5768
+ blockchain_balance_confirmed_balance: confirmed_balance {
5769
+ __typename
5770
+ currency_amount_original_value: original_value
5771
+ currency_amount_original_unit: original_unit
5772
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5773
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5774
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5775
+ }
5776
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
5777
+ __typename
5778
+ currency_amount_original_value: original_value
5779
+ currency_amount_original_unit: original_unit
5780
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5781
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5782
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5783
+ }
5784
+ blockchain_balance_locked_balance: locked_balance {
5785
+ __typename
5786
+ currency_amount_original_value: original_value
5787
+ currency_amount_original_unit: original_unit
5788
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5789
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5790
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5791
+ }
5792
+ blockchain_balance_required_reserve: required_reserve {
5793
+ __typename
5794
+ currency_amount_original_value: original_value
5795
+ currency_amount_original_unit: original_unit
5796
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5797
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5798
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5799
+ }
5800
+ blockchain_balance_available_balance: available_balance {
5801
+ __typename
5802
+ currency_amount_original_value: original_value
5803
+ currency_amount_original_unit: original_unit
5804
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5805
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5806
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5807
+ }
5808
+ }
5809
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
5810
+ }
5811
+ }
5812
+ }
5813
+ invoice_status: status
5814
+ invoice_amount_paid: amount_paid {
5815
+ __typename
5816
+ currency_amount_original_value: original_value
5817
+ currency_amount_original_unit: original_unit
5818
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5819
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5820
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5821
+ }
5959
5822
  }
5960
5823
  }`;
5961
- var WithdrawalRequest_default = WithdrawalRequest;
5824
+ var getPaymentRequestQuery = (id) => {
5825
+ return {
5826
+ queryPayload: `
5827
+ query GetPaymentRequest($id: ID!) {
5828
+ entity(id: $id) {
5829
+ ... on PaymentRequest {
5830
+ ...PaymentRequestFragment
5831
+ }
5832
+ }
5833
+ }
5962
5834
 
5963
- // src/graphql/RequestWithdrawal.ts
5964
- var RequestWithdrawal = `
5965
- mutation RequestWithdrawal(
5966
- $node_id: ID!
5967
- $bitcoin_address: String!
5968
- $amount_sats: Long!
5969
- $withdrawal_mode: WithdrawalMode!
5970
- ) {
5971
- request_withdrawal(input: {
5972
- node_id: $node_id
5973
- bitcoin_address: $bitcoin_address
5974
- amount_sats: $amount_sats
5975
- withdrawal_mode: $withdrawal_mode
5976
- }) {
5977
- request {
5978
- ...WithdrawalRequestFragment
5835
+ ${FRAGMENT17}
5836
+ `,
5837
+ variables: { id },
5838
+ constructObject: (data) => PaymentRequestFromJson(data.entity)
5839
+ };
5840
+ };
5841
+
5842
+ // src/graphql/PaymentRequestsForNode.ts
5843
+ var PaymentRequestsForNode = `
5844
+ query PaymentRequestsForNode(
5845
+ $network: BitcoinNetwork!,
5846
+ $nodeId: ID!,
5847
+ $numTransactions: Int,
5848
+ $afterDate: DateTime,
5849
+ ) {
5850
+ current_account {
5851
+ id
5852
+ name
5853
+ recent_payment_requests: payment_requests(
5854
+ first: $numTransactions
5855
+ bitcoin_network: $network
5856
+ lightning_node_id: $nodeId
5857
+ after_date: $afterDate
5858
+ ) {
5859
+ count
5860
+ entities {
5861
+ ...PaymentRequestFragment
5862
+ __typename
5863
+ }
5864
+ __typename
5979
5865
  }
5866
+ __typename
5980
5867
  }
5981
- }
5868
+ }
5982
5869
 
5983
- ${FRAGMENT19}
5870
+ ${FRAGMENT17}
5984
5871
  `;
5985
5872
 
5986
- // src/graphql/SendPayment.ts
5987
- var SendPayment = `
5988
- mutation SendPayment(
5873
+ // src/graphql/PayUmaInvoice.ts
5874
+ var PayUmaInvoice = `
5875
+ mutation PayUmaInvoice(
5989
5876
  $node_id: ID!
5990
- $destination_public_key: String!
5877
+ $encoded_invoice: String!
5991
5878
  $timeout_secs: Int!
5992
- $amount_msats: Long!
5993
5879
  $maximum_fees_msats: Long!
5880
+ $amount_msats: Long
5994
5881
  ) {
5995
- send_payment(
5882
+ pay_uma_invoice(
5996
5883
  input: {
5997
5884
  node_id: $node_id
5998
- destination_public_key: $destination_public_key
5885
+ encoded_invoice: $encoded_invoice
5999
5886
  timeout_secs: $timeout_secs
6000
- amount_msats: $amount_msats
6001
5887
  maximum_fees_msats: $maximum_fees_msats
5888
+ amount_msats: $amount_msats
6002
5889
  }
6003
5890
  ) {
6004
5891
  payment {
@@ -6010,1638 +5897,1588 @@ var SendPayment = `
6010
5897
  ${FRAGMENT16}
6011
5898
  `;
6012
5899
 
6013
- // src/objects/Transaction.ts
6014
- var import_core4 = require("@lightsparkdev/core");
5900
+ // src/objects/WithdrawalRequest.ts
5901
+ var import_auto_bind10 = __toESM(require("auto-bind"), 1);
6015
5902
 
6016
- // src/objects/RoutingTransactionFailureReason.ts
6017
- var RoutingTransactionFailureReason = /* @__PURE__ */ ((RoutingTransactionFailureReason2) => {
6018
- RoutingTransactionFailureReason2["FUTURE_VALUE"] = "FUTURE_VALUE";
6019
- RoutingTransactionFailureReason2["INCOMING_LINK_FAILURE"] = "INCOMING_LINK_FAILURE";
6020
- RoutingTransactionFailureReason2["OUTGOING_LINK_FAILURE"] = "OUTGOING_LINK_FAILURE";
6021
- RoutingTransactionFailureReason2["FORWARDING_FAILURE"] = "FORWARDING_FAILURE";
6022
- return RoutingTransactionFailureReason2;
6023
- })(RoutingTransactionFailureReason || {});
6024
- var RoutingTransactionFailureReason_default = RoutingTransactionFailureReason;
5903
+ // src/objects/WithdrawalMode.ts
5904
+ var WithdrawalMode = /* @__PURE__ */ ((WithdrawalMode2) => {
5905
+ WithdrawalMode2["FUTURE_VALUE"] = "FUTURE_VALUE";
5906
+ WithdrawalMode2["WALLET_ONLY"] = "WALLET_ONLY";
5907
+ WithdrawalMode2["WALLET_THEN_CHANNELS"] = "WALLET_THEN_CHANNELS";
5908
+ return WithdrawalMode2;
5909
+ })(WithdrawalMode || {});
5910
+ var WithdrawalMode_default = WithdrawalMode;
6025
5911
 
6026
- // src/objects/Transaction.ts
6027
- var TransactionFromJson = (obj) => {
6028
- if (obj["__typename"] == "ChannelClosingTransaction") {
6029
- return {
6030
- id: obj["channel_closing_transaction_id"],
6031
- createdAt: obj["channel_closing_transaction_created_at"],
6032
- updatedAt: obj["channel_closing_transaction_updated_at"],
6033
- status: TransactionStatus_default[obj["channel_closing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6034
- amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
6035
- blockHeight: obj["channel_closing_transaction_block_height"],
6036
- destinationAddresses: obj["channel_closing_transaction_destination_addresses"],
6037
- typename: "ChannelClosingTransaction",
6038
- resolvedAt: obj["channel_closing_transaction_resolved_at"],
6039
- transactionHash: obj["channel_closing_transaction_transaction_hash"],
6040
- fees: !!obj["channel_closing_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"]) : void 0,
6041
- blockHash: obj["channel_closing_transaction_block_hash"],
6042
- numConfirmations: obj["channel_closing_transaction_num_confirmations"],
6043
- channelId: obj["channel_closing_transaction_channel"]?.id ?? void 0
6044
- };
6045
- }
6046
- if (obj["__typename"] == "ChannelOpeningTransaction") {
6047
- return {
6048
- id: obj["channel_opening_transaction_id"],
6049
- createdAt: obj["channel_opening_transaction_created_at"],
6050
- updatedAt: obj["channel_opening_transaction_updated_at"],
6051
- status: TransactionStatus_default[obj["channel_opening_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6052
- amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
6053
- blockHeight: obj["channel_opening_transaction_block_height"],
6054
- destinationAddresses: obj["channel_opening_transaction_destination_addresses"],
6055
- typename: "ChannelOpeningTransaction",
6056
- resolvedAt: obj["channel_opening_transaction_resolved_at"],
6057
- transactionHash: obj["channel_opening_transaction_transaction_hash"],
6058
- fees: !!obj["channel_opening_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"]) : void 0,
6059
- blockHash: obj["channel_opening_transaction_block_hash"],
6060
- numConfirmations: obj["channel_opening_transaction_num_confirmations"],
6061
- channelId: obj["channel_opening_transaction_channel"]?.id ?? void 0
6062
- };
6063
- }
6064
- if (obj["__typename"] == "Deposit") {
6065
- return {
6066
- id: obj["deposit_id"],
6067
- createdAt: obj["deposit_created_at"],
6068
- updatedAt: obj["deposit_updated_at"],
6069
- status: TransactionStatus_default[obj["deposit_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6070
- amount: CurrencyAmountFromJson(obj["deposit_amount"]),
6071
- blockHeight: obj["deposit_block_height"],
6072
- destinationAddresses: obj["deposit_destination_addresses"],
6073
- destinationId: obj["deposit_destination"].id,
6074
- typename: "Deposit",
6075
- resolvedAt: obj["deposit_resolved_at"],
6076
- transactionHash: obj["deposit_transaction_hash"],
6077
- fees: !!obj["deposit_fees"] ? CurrencyAmountFromJson(obj["deposit_fees"]) : void 0,
6078
- blockHash: obj["deposit_block_hash"],
6079
- numConfirmations: obj["deposit_num_confirmations"]
6080
- };
6081
- }
6082
- if (obj["__typename"] == "IncomingPayment") {
6083
- return new IncomingPayment_default(
6084
- obj["incoming_payment_id"],
6085
- obj["incoming_payment_created_at"],
6086
- obj["incoming_payment_updated_at"],
6087
- TransactionStatus_default[obj["incoming_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6088
- CurrencyAmountFromJson(obj["incoming_payment_amount"]),
6089
- obj["incoming_payment_destination"].id,
6090
- "IncomingPayment",
6091
- obj["incoming_payment_resolved_at"],
6092
- obj["incoming_payment_transaction_hash"],
6093
- obj["incoming_payment_payment_request"]?.id ?? void 0,
6094
- obj["incoming_payment_uma_post_transaction_data"]?.map(
6095
- (e) => PostTransactionDataFromJson(e)
6096
- )
6097
- );
6098
- }
6099
- if (obj["__typename"] == "OutgoingPayment") {
6100
- return new OutgoingPayment_default(
6101
- obj["outgoing_payment_id"],
6102
- obj["outgoing_payment_created_at"],
6103
- obj["outgoing_payment_updated_at"],
6104
- TransactionStatus_default[obj["outgoing_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6105
- CurrencyAmountFromJson(obj["outgoing_payment_amount"]),
6106
- obj["outgoing_payment_origin"].id,
6107
- "OutgoingPayment",
6108
- obj["outgoing_payment_resolved_at"],
6109
- obj["outgoing_payment_transaction_hash"],
6110
- obj["outgoing_payment_destination"]?.id ?? void 0,
6111
- !!obj["outgoing_payment_fees"] ? CurrencyAmountFromJson(obj["outgoing_payment_fees"]) : void 0,
6112
- !!obj["outgoing_payment_payment_request_data"] ? PaymentRequestDataFromJson(
6113
- obj["outgoing_payment_payment_request_data"]
6114
- ) : void 0,
6115
- !!obj["outgoing_payment_failure_reason"] ? PaymentFailureReason_default[obj["outgoing_payment_failure_reason"]] ?? PaymentFailureReason_default.FUTURE_VALUE : null,
6116
- !!obj["outgoing_payment_failure_message"] ? RichTextFromJson(obj["outgoing_payment_failure_message"]) : void 0,
6117
- obj["outgoing_payment_uma_post_transaction_data"]?.map(
6118
- (e) => PostTransactionDataFromJson(e)
6119
- )
6120
- );
6121
- }
6122
- if (obj["__typename"] == "RoutingTransaction") {
6123
- return {
6124
- id: obj["routing_transaction_id"],
6125
- createdAt: obj["routing_transaction_created_at"],
6126
- updatedAt: obj["routing_transaction_updated_at"],
6127
- status: TransactionStatus_default[obj["routing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6128
- amount: CurrencyAmountFromJson(obj["routing_transaction_amount"]),
6129
- typename: "RoutingTransaction",
6130
- resolvedAt: obj["routing_transaction_resolved_at"],
6131
- transactionHash: obj["routing_transaction_transaction_hash"],
6132
- incomingChannelId: obj["routing_transaction_incoming_channel"]?.id ?? void 0,
6133
- outgoingChannelId: obj["routing_transaction_outgoing_channel"]?.id ?? void 0,
6134
- fees: !!obj["routing_transaction_fees"] ? CurrencyAmountFromJson(obj["routing_transaction_fees"]) : void 0,
6135
- failureMessage: !!obj["routing_transaction_failure_message"] ? RichTextFromJson(obj["routing_transaction_failure_message"]) : void 0,
6136
- failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
6137
- };
6138
- }
6139
- if (obj["__typename"] == "Withdrawal") {
6140
- return {
6141
- id: obj["withdrawal_id"],
6142
- createdAt: obj["withdrawal_created_at"],
6143
- updatedAt: obj["withdrawal_updated_at"],
6144
- status: TransactionStatus_default[obj["withdrawal_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6145
- amount: CurrencyAmountFromJson(obj["withdrawal_amount"]),
6146
- blockHeight: obj["withdrawal_block_height"],
6147
- destinationAddresses: obj["withdrawal_destination_addresses"],
6148
- originId: obj["withdrawal_origin"].id,
6149
- typename: "Withdrawal",
6150
- resolvedAt: obj["withdrawal_resolved_at"],
6151
- transactionHash: obj["withdrawal_transaction_hash"],
6152
- fees: !!obj["withdrawal_fees"] ? CurrencyAmountFromJson(obj["withdrawal_fees"]) : void 0,
6153
- blockHash: obj["withdrawal_block_hash"],
6154
- numConfirmations: obj["withdrawal_num_confirmations"]
6155
- };
6156
- }
6157
- throw new import_core4.LightsparkException(
6158
- "DeserializationError",
6159
- `Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
6160
- );
5912
+ // src/objects/WithdrawalRequestStatus.ts
5913
+ var WithdrawalRequestStatus = /* @__PURE__ */ ((WithdrawalRequestStatus2) => {
5914
+ WithdrawalRequestStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
5915
+ WithdrawalRequestStatus2["FAILED"] = "FAILED";
5916
+ WithdrawalRequestStatus2["IN_PROGRESS"] = "IN_PROGRESS";
5917
+ WithdrawalRequestStatus2["SUCCESSFUL"] = "SUCCESSFUL";
5918
+ return WithdrawalRequestStatus2;
5919
+ })(WithdrawalRequestStatus || {});
5920
+ var WithdrawalRequestStatus_default = WithdrawalRequestStatus;
5921
+
5922
+ // src/objects/ChannelClosingTransaction.ts
5923
+ var ChannelClosingTransactionFromJson = (obj) => {
5924
+ return {
5925
+ id: obj["channel_closing_transaction_id"],
5926
+ createdAt: obj["channel_closing_transaction_created_at"],
5927
+ updatedAt: obj["channel_closing_transaction_updated_at"],
5928
+ status: TransactionStatus_default[obj["channel_closing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
5929
+ amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
5930
+ blockHeight: obj["channel_closing_transaction_block_height"],
5931
+ destinationAddresses: obj["channel_closing_transaction_destination_addresses"],
5932
+ typename: "ChannelClosingTransaction",
5933
+ resolvedAt: obj["channel_closing_transaction_resolved_at"],
5934
+ transactionHash: obj["channel_closing_transaction_transaction_hash"],
5935
+ fees: !!obj["channel_closing_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"]) : void 0,
5936
+ blockHash: obj["channel_closing_transaction_block_hash"],
5937
+ numConfirmations: obj["channel_closing_transaction_num_confirmations"],
5938
+ channelId: obj["channel_closing_transaction_channel"]?.id ?? void 0
5939
+ };
6161
5940
  };
6162
- var FRAGMENT20 = `
6163
- fragment TransactionFragment on Transaction {
5941
+ var FRAGMENT18 = `
5942
+ fragment ChannelClosingTransactionFragment on ChannelClosingTransaction {
6164
5943
  __typename
6165
- ... on ChannelClosingTransaction {
5944
+ channel_closing_transaction_id: id
5945
+ channel_closing_transaction_created_at: created_at
5946
+ channel_closing_transaction_updated_at: updated_at
5947
+ channel_closing_transaction_status: status
5948
+ channel_closing_transaction_resolved_at: resolved_at
5949
+ channel_closing_transaction_amount: amount {
6166
5950
  __typename
6167
- channel_closing_transaction_id: id
6168
- channel_closing_transaction_created_at: created_at
6169
- channel_closing_transaction_updated_at: updated_at
6170
- channel_closing_transaction_status: status
6171
- channel_closing_transaction_resolved_at: resolved_at
6172
- channel_closing_transaction_amount: amount {
6173
- __typename
6174
- currency_amount_original_value: original_value
6175
- currency_amount_original_unit: original_unit
6176
- currency_amount_preferred_currency_unit: preferred_currency_unit
6177
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6178
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6179
- }
6180
- channel_closing_transaction_transaction_hash: transaction_hash
6181
- channel_closing_transaction_fees: fees {
6182
- __typename
6183
- currency_amount_original_value: original_value
6184
- currency_amount_original_unit: original_unit
6185
- currency_amount_preferred_currency_unit: preferred_currency_unit
6186
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6187
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6188
- }
6189
- channel_closing_transaction_block_hash: block_hash
6190
- channel_closing_transaction_block_height: block_height
6191
- channel_closing_transaction_destination_addresses: destination_addresses
6192
- channel_closing_transaction_num_confirmations: num_confirmations
6193
- channel_closing_transaction_channel: channel {
6194
- id
6195
- }
5951
+ currency_amount_original_value: original_value
5952
+ currency_amount_original_unit: original_unit
5953
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5954
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5955
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6196
5956
  }
6197
- ... on ChannelOpeningTransaction {
5957
+ channel_closing_transaction_transaction_hash: transaction_hash
5958
+ channel_closing_transaction_fees: fees {
6198
5959
  __typename
6199
- channel_opening_transaction_id: id
6200
- channel_opening_transaction_created_at: created_at
6201
- channel_opening_transaction_updated_at: updated_at
6202
- channel_opening_transaction_status: status
6203
- channel_opening_transaction_resolved_at: resolved_at
6204
- channel_opening_transaction_amount: amount {
6205
- __typename
6206
- currency_amount_original_value: original_value
6207
- currency_amount_original_unit: original_unit
6208
- currency_amount_preferred_currency_unit: preferred_currency_unit
6209
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6210
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6211
- }
6212
- channel_opening_transaction_transaction_hash: transaction_hash
6213
- channel_opening_transaction_fees: fees {
6214
- __typename
6215
- currency_amount_original_value: original_value
6216
- currency_amount_original_unit: original_unit
6217
- currency_amount_preferred_currency_unit: preferred_currency_unit
6218
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6219
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6220
- }
6221
- channel_opening_transaction_block_hash: block_hash
6222
- channel_opening_transaction_block_height: block_height
6223
- channel_opening_transaction_destination_addresses: destination_addresses
6224
- channel_opening_transaction_num_confirmations: num_confirmations
6225
- channel_opening_transaction_channel: channel {
6226
- id
6227
- }
5960
+ currency_amount_original_value: original_value
5961
+ currency_amount_original_unit: original_unit
5962
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5963
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5964
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6228
5965
  }
6229
- ... on Deposit {
6230
- __typename
6231
- deposit_id: id
6232
- deposit_created_at: created_at
6233
- deposit_updated_at: updated_at
6234
- deposit_status: status
6235
- deposit_resolved_at: resolved_at
6236
- deposit_amount: amount {
6237
- __typename
6238
- currency_amount_original_value: original_value
6239
- currency_amount_original_unit: original_unit
6240
- currency_amount_preferred_currency_unit: preferred_currency_unit
6241
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6242
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6243
- }
6244
- deposit_transaction_hash: transaction_hash
6245
- deposit_fees: fees {
6246
- __typename
6247
- currency_amount_original_value: original_value
6248
- currency_amount_original_unit: original_unit
6249
- currency_amount_preferred_currency_unit: preferred_currency_unit
6250
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6251
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6252
- }
6253
- deposit_block_hash: block_hash
6254
- deposit_block_height: block_height
6255
- deposit_destination_addresses: destination_addresses
6256
- deposit_num_confirmations: num_confirmations
6257
- deposit_destination: destination {
6258
- id
6259
- }
5966
+ channel_closing_transaction_block_hash: block_hash
5967
+ channel_closing_transaction_block_height: block_height
5968
+ channel_closing_transaction_destination_addresses: destination_addresses
5969
+ channel_closing_transaction_num_confirmations: num_confirmations
5970
+ channel_closing_transaction_channel: channel {
5971
+ id
6260
5972
  }
6261
- ... on IncomingPayment {
6262
- __typename
6263
- incoming_payment_id: id
6264
- incoming_payment_created_at: created_at
6265
- incoming_payment_updated_at: updated_at
6266
- incoming_payment_status: status
6267
- incoming_payment_resolved_at: resolved_at
6268
- incoming_payment_amount: amount {
6269
- __typename
6270
- currency_amount_original_value: original_value
6271
- currency_amount_original_unit: original_unit
6272
- currency_amount_preferred_currency_unit: preferred_currency_unit
6273
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6274
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6275
- }
6276
- incoming_payment_transaction_hash: transaction_hash
6277
- incoming_payment_destination: destination {
6278
- id
6279
- }
6280
- incoming_payment_payment_request: payment_request {
6281
- id
6282
- }
6283
- incoming_payment_uma_post_transaction_data: uma_post_transaction_data {
6284
- __typename
6285
- post_transaction_data_utxo: utxo
6286
- post_transaction_data_amount: amount {
6287
- __typename
6288
- currency_amount_original_value: original_value
6289
- currency_amount_original_unit: original_unit
6290
- currency_amount_preferred_currency_unit: preferred_currency_unit
6291
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6292
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6293
- }
5973
+ }`;
5974
+ var getChannelClosingTransactionQuery = (id) => {
5975
+ return {
5976
+ queryPayload: `
5977
+ query GetChannelClosingTransaction($id: ID!) {
5978
+ entity(id: $id) {
5979
+ ... on ChannelClosingTransaction {
5980
+ ...ChannelClosingTransactionFragment
6294
5981
  }
6295
5982
  }
6296
- ... on OutgoingPayment {
5983
+ }
5984
+
5985
+ ${FRAGMENT18}
5986
+ `,
5987
+ variables: { id },
5988
+ constructObject: (data) => ChannelClosingTransactionFromJson(data.entity)
5989
+ };
5990
+ };
5991
+
5992
+ // src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts
5993
+ var WithdrawalRequestToChannelClosingTransactionsConnectionFromJson = (obj) => {
5994
+ return {
5995
+ pageInfo: PageInfoFromJson(
5996
+ obj["withdrawal_request_to_channel_closing_transactions_connection_page_info"]
5997
+ ),
5998
+ count: obj["withdrawal_request_to_channel_closing_transactions_connection_count"],
5999
+ entities: obj["withdrawal_request_to_channel_closing_transactions_connection_entities"].map((e) => ChannelClosingTransactionFromJson(e))
6000
+ };
6001
+ };
6002
+
6003
+ // src/objects/ChannelOpeningTransaction.ts
6004
+ var ChannelOpeningTransactionFromJson = (obj) => {
6005
+ return {
6006
+ id: obj["channel_opening_transaction_id"],
6007
+ createdAt: obj["channel_opening_transaction_created_at"],
6008
+ updatedAt: obj["channel_opening_transaction_updated_at"],
6009
+ status: TransactionStatus_default[obj["channel_opening_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6010
+ amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
6011
+ blockHeight: obj["channel_opening_transaction_block_height"],
6012
+ destinationAddresses: obj["channel_opening_transaction_destination_addresses"],
6013
+ typename: "ChannelOpeningTransaction",
6014
+ resolvedAt: obj["channel_opening_transaction_resolved_at"],
6015
+ transactionHash: obj["channel_opening_transaction_transaction_hash"],
6016
+ fees: !!obj["channel_opening_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"]) : void 0,
6017
+ blockHash: obj["channel_opening_transaction_block_hash"],
6018
+ numConfirmations: obj["channel_opening_transaction_num_confirmations"],
6019
+ channelId: obj["channel_opening_transaction_channel"]?.id ?? void 0
6020
+ };
6021
+ };
6022
+ var FRAGMENT19 = `
6023
+ fragment ChannelOpeningTransactionFragment on ChannelOpeningTransaction {
6024
+ __typename
6025
+ channel_opening_transaction_id: id
6026
+ channel_opening_transaction_created_at: created_at
6027
+ channel_opening_transaction_updated_at: updated_at
6028
+ channel_opening_transaction_status: status
6029
+ channel_opening_transaction_resolved_at: resolved_at
6030
+ channel_opening_transaction_amount: amount {
6297
6031
  __typename
6298
- outgoing_payment_id: id
6299
- outgoing_payment_created_at: created_at
6300
- outgoing_payment_updated_at: updated_at
6301
- outgoing_payment_status: status
6302
- outgoing_payment_resolved_at: resolved_at
6303
- outgoing_payment_amount: amount {
6304
- __typename
6305
- currency_amount_original_value: original_value
6306
- currency_amount_original_unit: original_unit
6307
- currency_amount_preferred_currency_unit: preferred_currency_unit
6308
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6309
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6310
- }
6311
- outgoing_payment_transaction_hash: transaction_hash
6312
- outgoing_payment_origin: origin {
6313
- id
6314
- }
6315
- outgoing_payment_destination: destination {
6316
- id
6317
- }
6318
- outgoing_payment_fees: fees {
6319
- __typename
6320
- currency_amount_original_value: original_value
6321
- currency_amount_original_unit: original_unit
6322
- currency_amount_preferred_currency_unit: preferred_currency_unit
6323
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6324
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6032
+ currency_amount_original_value: original_value
6033
+ currency_amount_original_unit: original_unit
6034
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6035
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6036
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6037
+ }
6038
+ channel_opening_transaction_transaction_hash: transaction_hash
6039
+ channel_opening_transaction_fees: fees {
6040
+ __typename
6041
+ currency_amount_original_value: original_value
6042
+ currency_amount_original_unit: original_unit
6043
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6044
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6045
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6046
+ }
6047
+ channel_opening_transaction_block_hash: block_hash
6048
+ channel_opening_transaction_block_height: block_height
6049
+ channel_opening_transaction_destination_addresses: destination_addresses
6050
+ channel_opening_transaction_num_confirmations: num_confirmations
6051
+ channel_opening_transaction_channel: channel {
6052
+ id
6053
+ }
6054
+ }`;
6055
+ var getChannelOpeningTransactionQuery = (id) => {
6056
+ return {
6057
+ queryPayload: `
6058
+ query GetChannelOpeningTransaction($id: ID!) {
6059
+ entity(id: $id) {
6060
+ ... on ChannelOpeningTransaction {
6061
+ ...ChannelOpeningTransactionFragment
6325
6062
  }
6326
- outgoing_payment_payment_request_data: payment_request_data {
6327
- __typename
6328
- ... on InvoiceData {
6063
+ }
6064
+ }
6065
+
6066
+ ${FRAGMENT19}
6067
+ `,
6068
+ variables: { id },
6069
+ constructObject: (data) => ChannelOpeningTransactionFromJson(data.entity)
6070
+ };
6071
+ };
6072
+
6073
+ // src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts
6074
+ var WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (obj) => {
6075
+ return {
6076
+ pageInfo: PageInfoFromJson(
6077
+ obj["withdrawal_request_to_channel_opening_transactions_connection_page_info"]
6078
+ ),
6079
+ count: obj["withdrawal_request_to_channel_opening_transactions_connection_count"],
6080
+ entities: obj["withdrawal_request_to_channel_opening_transactions_connection_entities"].map((e) => ChannelOpeningTransactionFromJson(e))
6081
+ };
6082
+ };
6083
+
6084
+ // src/objects/WithdrawalRequest.ts
6085
+ var WithdrawalRequest = class {
6086
+ constructor(id, createdAt, updatedAt, amount, bitcoinAddress, withdrawalMode, status, typename, estimatedAmount, completedAt, withdrawalId) {
6087
+ this.id = id;
6088
+ this.createdAt = createdAt;
6089
+ this.updatedAt = updatedAt;
6090
+ this.amount = amount;
6091
+ this.bitcoinAddress = bitcoinAddress;
6092
+ this.withdrawalMode = withdrawalMode;
6093
+ this.status = status;
6094
+ this.typename = typename;
6095
+ this.estimatedAmount = estimatedAmount;
6096
+ this.completedAt = completedAt;
6097
+ this.withdrawalId = withdrawalId;
6098
+ (0, import_auto_bind10.default)(this);
6099
+ }
6100
+ async getChannelClosingTransactions(client, first = void 0) {
6101
+ return await client.executeRawQuery({
6102
+ queryPayload: `
6103
+ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: ID!, $first: Int) {
6104
+ entity(id: $entity_id) {
6105
+ ... on WithdrawalRequest {
6106
+ channel_closing_transactions(, first: $first) {
6329
6107
  __typename
6330
- invoice_data_encoded_payment_request: encoded_payment_request
6331
- invoice_data_bitcoin_network: bitcoin_network
6332
- invoice_data_payment_hash: payment_hash
6333
- invoice_data_amount: amount {
6108
+ withdrawal_request_to_channel_closing_transactions_connection_page_info: page_info {
6334
6109
  __typename
6335
- currency_amount_original_value: original_value
6336
- currency_amount_original_unit: original_unit
6337
- currency_amount_preferred_currency_unit: preferred_currency_unit
6338
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6339
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6110
+ page_info_has_next_page: has_next_page
6111
+ page_info_has_previous_page: has_previous_page
6112
+ page_info_start_cursor: start_cursor
6113
+ page_info_end_cursor: end_cursor
6340
6114
  }
6341
- invoice_data_created_at: created_at
6342
- invoice_data_expires_at: expires_at
6343
- invoice_data_memo: memo
6344
- invoice_data_destination: destination {
6115
+ withdrawal_request_to_channel_closing_transactions_connection_count: count
6116
+ withdrawal_request_to_channel_closing_transactions_connection_entities: entities {
6345
6117
  __typename
6346
- ... on GraphNode {
6118
+ channel_closing_transaction_id: id
6119
+ channel_closing_transaction_created_at: created_at
6120
+ channel_closing_transaction_updated_at: updated_at
6121
+ channel_closing_transaction_status: status
6122
+ channel_closing_transaction_resolved_at: resolved_at
6123
+ channel_closing_transaction_amount: amount {
6347
6124
  __typename
6348
- graph_node_id: id
6349
- graph_node_created_at: created_at
6350
- graph_node_updated_at: updated_at
6351
- graph_node_alias: alias
6352
- graph_node_bitcoin_network: bitcoin_network
6353
- graph_node_color: color
6354
- graph_node_conductivity: conductivity
6355
- graph_node_display_name: display_name
6356
- graph_node_public_key: public_key
6125
+ currency_amount_original_value: original_value
6126
+ currency_amount_original_unit: original_unit
6127
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6128
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6129
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6357
6130
  }
6358
- ... on LightsparkNodeWithOSK {
6131
+ channel_closing_transaction_transaction_hash: transaction_hash
6132
+ channel_closing_transaction_fees: fees {
6359
6133
  __typename
6360
- lightspark_node_with_o_s_k_id: id
6361
- lightspark_node_with_o_s_k_created_at: created_at
6362
- lightspark_node_with_o_s_k_updated_at: updated_at
6363
- lightspark_node_with_o_s_k_alias: alias
6364
- lightspark_node_with_o_s_k_bitcoin_network: bitcoin_network
6365
- lightspark_node_with_o_s_k_color: color
6366
- lightspark_node_with_o_s_k_conductivity: conductivity
6367
- lightspark_node_with_o_s_k_display_name: display_name
6368
- lightspark_node_with_o_s_k_public_key: public_key
6369
- lightspark_node_with_o_s_k_owner: owner {
6370
- id
6371
- }
6372
- lightspark_node_with_o_s_k_status: status
6373
- lightspark_node_with_o_s_k_total_balance: total_balance {
6374
- __typename
6375
- currency_amount_original_value: original_value
6376
- currency_amount_original_unit: original_unit
6377
- currency_amount_preferred_currency_unit: preferred_currency_unit
6378
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6379
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6380
- }
6381
- lightspark_node_with_o_s_k_total_local_balance: total_local_balance {
6382
- __typename
6383
- currency_amount_original_value: original_value
6384
- currency_amount_original_unit: original_unit
6385
- currency_amount_preferred_currency_unit: preferred_currency_unit
6386
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6387
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6388
- }
6389
- lightspark_node_with_o_s_k_local_balance: local_balance {
6390
- __typename
6391
- currency_amount_original_value: original_value
6392
- currency_amount_original_unit: original_unit
6393
- currency_amount_preferred_currency_unit: preferred_currency_unit
6394
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6395
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6396
- }
6397
- lightspark_node_with_o_s_k_remote_balance: remote_balance {
6398
- __typename
6399
- currency_amount_original_value: original_value
6400
- currency_amount_original_unit: original_unit
6401
- currency_amount_preferred_currency_unit: preferred_currency_unit
6402
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6403
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6404
- }
6405
- lightspark_node_with_o_s_k_blockchain_balance: blockchain_balance {
6406
- __typename
6407
- blockchain_balance_total_balance: total_balance {
6408
- __typename
6409
- currency_amount_original_value: original_value
6410
- currency_amount_original_unit: original_unit
6411
- currency_amount_preferred_currency_unit: preferred_currency_unit
6412
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6413
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6414
- }
6415
- blockchain_balance_confirmed_balance: confirmed_balance {
6416
- __typename
6417
- currency_amount_original_value: original_value
6418
- currency_amount_original_unit: original_unit
6419
- currency_amount_preferred_currency_unit: preferred_currency_unit
6420
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6421
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6422
- }
6423
- blockchain_balance_unconfirmed_balance: unconfirmed_balance {
6424
- __typename
6425
- currency_amount_original_value: original_value
6426
- currency_amount_original_unit: original_unit
6427
- currency_amount_preferred_currency_unit: preferred_currency_unit
6428
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6429
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6430
- }
6431
- blockchain_balance_locked_balance: locked_balance {
6432
- __typename
6433
- currency_amount_original_value: original_value
6434
- currency_amount_original_unit: original_unit
6435
- currency_amount_preferred_currency_unit: preferred_currency_unit
6436
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6437
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6438
- }
6439
- blockchain_balance_required_reserve: required_reserve {
6440
- __typename
6441
- currency_amount_original_value: original_value
6442
- currency_amount_original_unit: original_unit
6443
- currency_amount_preferred_currency_unit: preferred_currency_unit
6444
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6445
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6446
- }
6447
- blockchain_balance_available_balance: available_balance {
6448
- __typename
6449
- currency_amount_original_value: original_value
6450
- currency_amount_original_unit: original_unit
6451
- currency_amount_preferred_currency_unit: preferred_currency_unit
6452
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6453
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6454
- }
6455
- }
6456
- lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
6457
- lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
6458
- __typename
6459
- secret_encrypted_value: encrypted_value
6460
- secret_cipher: cipher
6461
- }
6134
+ currency_amount_original_value: original_value
6135
+ currency_amount_original_unit: original_unit
6136
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6137
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6138
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6462
6139
  }
6463
- ... on LightsparkNodeWithRemoteSigning {
6464
- __typename
6465
- lightspark_node_with_remote_signing_id: id
6466
- lightspark_node_with_remote_signing_created_at: created_at
6467
- lightspark_node_with_remote_signing_updated_at: updated_at
6468
- lightspark_node_with_remote_signing_alias: alias
6469
- lightspark_node_with_remote_signing_bitcoin_network: bitcoin_network
6470
- lightspark_node_with_remote_signing_color: color
6471
- lightspark_node_with_remote_signing_conductivity: conductivity
6472
- lightspark_node_with_remote_signing_display_name: display_name
6473
- lightspark_node_with_remote_signing_public_key: public_key
6474
- lightspark_node_with_remote_signing_owner: owner {
6475
- id
6476
- }
6477
- lightspark_node_with_remote_signing_status: status
6478
- lightspark_node_with_remote_signing_total_balance: total_balance {
6479
- __typename
6480
- currency_amount_original_value: original_value
6481
- currency_amount_original_unit: original_unit
6482
- currency_amount_preferred_currency_unit: preferred_currency_unit
6483
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6484
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6485
- }
6486
- lightspark_node_with_remote_signing_total_local_balance: total_local_balance {
6487
- __typename
6488
- currency_amount_original_value: original_value
6489
- currency_amount_original_unit: original_unit
6490
- currency_amount_preferred_currency_unit: preferred_currency_unit
6491
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6492
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6493
- }
6494
- lightspark_node_with_remote_signing_local_balance: local_balance {
6495
- __typename
6496
- currency_amount_original_value: original_value
6497
- currency_amount_original_unit: original_unit
6498
- currency_amount_preferred_currency_unit: preferred_currency_unit
6499
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6500
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6501
- }
6502
- lightspark_node_with_remote_signing_remote_balance: remote_balance {
6503
- __typename
6504
- currency_amount_original_value: original_value
6505
- currency_amount_original_unit: original_unit
6506
- currency_amount_preferred_currency_unit: preferred_currency_unit
6507
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6508
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6509
- }
6510
- lightspark_node_with_remote_signing_blockchain_balance: blockchain_balance {
6511
- __typename
6512
- blockchain_balance_total_balance: total_balance {
6513
- __typename
6514
- currency_amount_original_value: original_value
6515
- currency_amount_original_unit: original_unit
6516
- currency_amount_preferred_currency_unit: preferred_currency_unit
6517
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6518
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6519
- }
6520
- blockchain_balance_confirmed_balance: confirmed_balance {
6521
- __typename
6522
- currency_amount_original_value: original_value
6523
- currency_amount_original_unit: original_unit
6524
- currency_amount_preferred_currency_unit: preferred_currency_unit
6525
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6526
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6527
- }
6528
- blockchain_balance_unconfirmed_balance: unconfirmed_balance {
6529
- __typename
6530
- currency_amount_original_value: original_value
6531
- currency_amount_original_unit: original_unit
6532
- currency_amount_preferred_currency_unit: preferred_currency_unit
6533
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6534
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6535
- }
6536
- blockchain_balance_locked_balance: locked_balance {
6537
- __typename
6538
- currency_amount_original_value: original_value
6539
- currency_amount_original_unit: original_unit
6540
- currency_amount_preferred_currency_unit: preferred_currency_unit
6541
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6542
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6543
- }
6544
- blockchain_balance_required_reserve: required_reserve {
6545
- __typename
6546
- currency_amount_original_value: original_value
6547
- currency_amount_original_unit: original_unit
6548
- currency_amount_preferred_currency_unit: preferred_currency_unit
6549
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6550
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6551
- }
6552
- blockchain_balance_available_balance: available_balance {
6553
- __typename
6554
- currency_amount_original_value: original_value
6555
- currency_amount_original_unit: original_unit
6556
- currency_amount_preferred_currency_unit: preferred_currency_unit
6557
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6558
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6559
- }
6560
- }
6561
- lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
6140
+ channel_closing_transaction_block_hash: block_hash
6141
+ channel_closing_transaction_block_height: block_height
6142
+ channel_closing_transaction_destination_addresses: destination_addresses
6143
+ channel_closing_transaction_num_confirmations: num_confirmations
6144
+ channel_closing_transaction_channel: channel {
6145
+ id
6562
6146
  }
6563
6147
  }
6564
6148
  }
6565
6149
  }
6566
- outgoing_payment_failure_reason: failure_reason
6567
- outgoing_payment_failure_message: failure_message {
6568
- __typename
6569
- rich_text_text: text
6570
- }
6571
- outgoing_payment_uma_post_transaction_data: uma_post_transaction_data {
6572
- __typename
6573
- post_transaction_data_utxo: utxo
6574
- post_transaction_data_amount: amount {
6150
+ }
6151
+ }
6152
+ `,
6153
+ variables: { entity_id: this.id, first },
6154
+ constructObject: (json) => {
6155
+ const connection = json["entity"]["channel_closing_transactions"];
6156
+ return WithdrawalRequestToChannelClosingTransactionsConnectionFromJson(
6157
+ connection
6158
+ );
6159
+ }
6160
+ });
6161
+ }
6162
+ async getChannelOpeningTransactions(client, first = void 0) {
6163
+ return await client.executeRawQuery({
6164
+ queryPayload: `
6165
+ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: ID!, $first: Int) {
6166
+ entity(id: $entity_id) {
6167
+ ... on WithdrawalRequest {
6168
+ channel_opening_transactions(, first: $first) {
6575
6169
  __typename
6576
- currency_amount_original_value: original_value
6577
- currency_amount_original_unit: original_unit
6578
- currency_amount_preferred_currency_unit: preferred_currency_unit
6579
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6580
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6170
+ withdrawal_request_to_channel_opening_transactions_connection_page_info: page_info {
6171
+ __typename
6172
+ page_info_has_next_page: has_next_page
6173
+ page_info_has_previous_page: has_previous_page
6174
+ page_info_start_cursor: start_cursor
6175
+ page_info_end_cursor: end_cursor
6176
+ }
6177
+ withdrawal_request_to_channel_opening_transactions_connection_count: count
6178
+ withdrawal_request_to_channel_opening_transactions_connection_entities: entities {
6179
+ __typename
6180
+ channel_opening_transaction_id: id
6181
+ channel_opening_transaction_created_at: created_at
6182
+ channel_opening_transaction_updated_at: updated_at
6183
+ channel_opening_transaction_status: status
6184
+ channel_opening_transaction_resolved_at: resolved_at
6185
+ channel_opening_transaction_amount: amount {
6186
+ __typename
6187
+ currency_amount_original_value: original_value
6188
+ currency_amount_original_unit: original_unit
6189
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6190
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6191
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6192
+ }
6193
+ channel_opening_transaction_transaction_hash: transaction_hash
6194
+ channel_opening_transaction_fees: fees {
6195
+ __typename
6196
+ currency_amount_original_value: original_value
6197
+ currency_amount_original_unit: original_unit
6198
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6199
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6200
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6201
+ }
6202
+ channel_opening_transaction_block_hash: block_hash
6203
+ channel_opening_transaction_block_height: block_height
6204
+ channel_opening_transaction_destination_addresses: destination_addresses
6205
+ channel_opening_transaction_num_confirmations: num_confirmations
6206
+ channel_opening_transaction_channel: channel {
6207
+ id
6208
+ }
6209
+ }
6581
6210
  }
6582
6211
  }
6583
6212
  }
6584
- ... on RoutingTransaction {
6585
- __typename
6586
- routing_transaction_id: id
6587
- routing_transaction_created_at: created_at
6588
- routing_transaction_updated_at: updated_at
6589
- routing_transaction_status: status
6590
- routing_transaction_resolved_at: resolved_at
6591
- routing_transaction_amount: amount {
6592
- __typename
6593
- currency_amount_original_value: original_value
6594
- currency_amount_original_unit: original_unit
6595
- currency_amount_preferred_currency_unit: preferred_currency_unit
6596
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6597
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6598
- }
6599
- routing_transaction_transaction_hash: transaction_hash
6600
- routing_transaction_incoming_channel: incoming_channel {
6601
- id
6602
- }
6603
- routing_transaction_outgoing_channel: outgoing_channel {
6604
- id
6605
- }
6606
- routing_transaction_fees: fees {
6607
- __typename
6608
- currency_amount_original_value: original_value
6609
- currency_amount_original_unit: original_unit
6610
- currency_amount_preferred_currency_unit: preferred_currency_unit
6611
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6612
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6613
- }
6614
- routing_transaction_failure_message: failure_message {
6615
- __typename
6616
- rich_text_text: text
6617
- }
6618
- routing_transaction_failure_reason: failure_reason
6619
- }
6620
- ... on Withdrawal {
6621
- __typename
6622
- withdrawal_id: id
6623
- withdrawal_created_at: created_at
6624
- withdrawal_updated_at: updated_at
6625
- withdrawal_status: status
6626
- withdrawal_resolved_at: resolved_at
6627
- withdrawal_amount: amount {
6628
- __typename
6629
- currency_amount_original_value: original_value
6630
- currency_amount_original_unit: original_unit
6631
- currency_amount_preferred_currency_unit: preferred_currency_unit
6632
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6633
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6634
- }
6635
- withdrawal_transaction_hash: transaction_hash
6636
- withdrawal_fees: fees {
6637
- __typename
6638
- currency_amount_original_value: original_value
6639
- currency_amount_original_unit: original_unit
6640
- currency_amount_preferred_currency_unit: preferred_currency_unit
6641
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6642
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6643
- }
6644
- withdrawal_block_hash: block_hash
6645
- withdrawal_block_height: block_height
6646
- withdrawal_destination_addresses: destination_addresses
6647
- withdrawal_num_confirmations: num_confirmations
6648
- withdrawal_origin: origin {
6649
- id
6650
- }
6651
- }
6652
- }`;
6653
- var getTransactionQuery = (id) => {
6654
- return {
6655
- queryPayload: `
6656
- query GetTransaction($id: ID!) {
6213
+ }
6214
+ `,
6215
+ variables: { entity_id: this.id, first },
6216
+ constructObject: (json) => {
6217
+ const connection = json["entity"]["channel_opening_transactions"];
6218
+ return WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson(
6219
+ connection
6220
+ );
6221
+ }
6222
+ });
6223
+ }
6224
+ static getWithdrawalRequestQuery(id) {
6225
+ return {
6226
+ queryPayload: `
6227
+ query GetWithdrawalRequest($id: ID!) {
6657
6228
  entity(id: $id) {
6658
- ... on Transaction {
6659
- ...TransactionFragment
6229
+ ... on WithdrawalRequest {
6230
+ ...WithdrawalRequestFragment
6660
6231
  }
6661
6232
  }
6662
6233
  }
6663
6234
 
6664
6235
  ${FRAGMENT20}
6665
6236
  `,
6666
- variables: { id },
6667
- constructObject: (data) => TransactionFromJson(data.entity)
6668
- };
6237
+ variables: { id },
6238
+ constructObject: (data) => WithdrawalRequestFromJson(data.entity)
6239
+ };
6240
+ }
6669
6241
  };
6670
-
6671
- // src/graphql/SingleNodeDashboard.ts
6672
- var SingleNodeDashboard = `
6673
- query SingleNodeDashboard(
6674
- $network: BitcoinNetwork!,
6675
- $nodeId: ID!,
6676
- $numTransactions: Int,
6677
- $transactionsAfterDate: DateTime,
6678
- $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
6679
- $transaction_statuses: [TransactionStatus!] = null
6680
- ) {
6681
- current_account {
6242
+ var WithdrawalRequestFromJson = (obj) => {
6243
+ return new WithdrawalRequest(
6244
+ obj["withdrawal_request_id"],
6245
+ obj["withdrawal_request_created_at"],
6246
+ obj["withdrawal_request_updated_at"],
6247
+ CurrencyAmountFromJson(obj["withdrawal_request_amount"]),
6248
+ obj["withdrawal_request_bitcoin_address"],
6249
+ WithdrawalMode_default[obj["withdrawal_request_withdrawal_mode"]] ?? WithdrawalMode_default.FUTURE_VALUE,
6250
+ WithdrawalRequestStatus_default[obj["withdrawal_request_status"]] ?? WithdrawalRequestStatus_default.FUTURE_VALUE,
6251
+ "WithdrawalRequest",
6252
+ !!obj["withdrawal_request_estimated_amount"] ? CurrencyAmountFromJson(obj["withdrawal_request_estimated_amount"]) : void 0,
6253
+ obj["withdrawal_request_completed_at"],
6254
+ obj["withdrawal_request_withdrawal"]?.id ?? void 0
6255
+ );
6256
+ };
6257
+ var FRAGMENT20 = `
6258
+ fragment WithdrawalRequestFragment on WithdrawalRequest {
6259
+ __typename
6260
+ withdrawal_request_id: id
6261
+ withdrawal_request_created_at: created_at
6262
+ withdrawal_request_updated_at: updated_at
6263
+ withdrawal_request_amount: amount {
6264
+ __typename
6265
+ currency_amount_original_value: original_value
6266
+ currency_amount_original_unit: original_unit
6267
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6268
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6269
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6270
+ }
6271
+ withdrawal_request_estimated_amount: estimated_amount {
6272
+ __typename
6273
+ currency_amount_original_value: original_value
6274
+ currency_amount_original_unit: original_unit
6275
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6276
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6277
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6278
+ }
6279
+ withdrawal_request_bitcoin_address: bitcoin_address
6280
+ withdrawal_request_withdrawal_mode: withdrawal_mode
6281
+ withdrawal_request_status: status
6282
+ withdrawal_request_completed_at: completed_at
6283
+ withdrawal_request_withdrawal: withdrawal {
6682
6284
  id
6683
- name
6684
- dashboard_overview_nodes: nodes(
6685
- first: 1
6686
- bitcoin_networks: [$network]
6687
- node_ids: [$nodeId]
6688
- ) {
6689
- count
6690
- entities {
6691
- color
6692
- display_name
6693
- id
6694
- addresses(first: 1) {
6695
- entities {
6696
- address
6697
- type
6698
- __typename
6699
- }
6700
- count
6701
- __typename
6702
- }
6703
- public_key
6704
- status
6705
- total_local_balance {
6706
- ...CurrencyAmountFragment
6707
- }
6708
- local_balance {
6709
- ...CurrencyAmountFragment
6710
- }
6711
- remote_balance {
6712
- ...CurrencyAmountFragment
6713
- }
6714
- blockchain_balance {
6715
- confirmed_balance {
6716
- ...CurrencyAmountFragment
6717
- }
6718
- unconfirmed_balance {
6719
- ...CurrencyAmountFragment
6720
- }
6721
- available_balance {
6722
- ...CurrencyAmountFragment
6723
- }
6724
- total_balance {
6725
- ...CurrencyAmountFragment
6726
- }
6727
- __typename
6728
- }
6729
- __typename
6730
- }
6731
- __typename
6732
- }
6733
- blockchain_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
6734
- total_balance: total_balance {
6735
- ...CurrencyAmountFragment
6736
- }
6737
- required_reserve {
6738
- ...CurrencyAmountFragment
6739
- }
6740
- available_balance {
6741
- ...CurrencyAmountFragment
6742
- }
6743
- unconfirmed_balance {
6744
- ...CurrencyAmountFragment
6745
- }
6746
- confirmed_balance {
6747
- ...CurrencyAmountFragment
6748
- }
6749
- __typename
6750
- }
6751
- local_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
6752
- ...CurrencyAmountFragment
6753
- }
6754
- remote_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
6755
- ...CurrencyAmountFragment
6756
- }
6757
- recent_transactions: transactions(
6758
- first: $numTransactions
6759
- types: $transactionTypes
6760
- bitcoin_network: $network
6761
- lightning_node_id: $nodeId
6762
- statuses: $transaction_statuses
6763
- after_date: $transactionsAfterDate
6764
- ) {
6765
- count
6766
- total_amount_transacted {
6767
- ...CurrencyAmountFragment
6768
- }
6769
- entities {
6770
- ...TransactionFragment
6771
- __typename
6772
- }
6773
- __typename
6285
+ }
6286
+ }`;
6287
+ var WithdrawalRequest_default = WithdrawalRequest;
6288
+
6289
+ // src/graphql/RequestWithdrawal.ts
6290
+ var RequestWithdrawal = `
6291
+ mutation RequestWithdrawal(
6292
+ $node_id: ID!
6293
+ $bitcoin_address: String!
6294
+ $amount_sats: Long!
6295
+ $withdrawal_mode: WithdrawalMode!
6296
+ ) {
6297
+ request_withdrawal(input: {
6298
+ node_id: $node_id
6299
+ bitcoin_address: $bitcoin_address
6300
+ amount_sats: $amount_sats
6301
+ withdrawal_mode: $withdrawal_mode
6302
+ }) {
6303
+ request {
6304
+ ...WithdrawalRequestFragment
6774
6305
  }
6775
- __typename
6776
6306
  }
6777
- }
6307
+ }
6778
6308
 
6779
- ${FRAGMENT20}
6780
- ${FRAGMENT}
6309
+ ${FRAGMENT20}
6781
6310
  `;
6782
6311
 
6783
- // src/graphql/TransactionsForNode.ts
6784
- var TransactionsForNode = `
6785
- query TransactionsForNode(
6786
- $network: BitcoinNetwork!,
6787
- $nodeId: ID!,
6788
- $numTransactions: Int,
6789
- $afterDate: DateTime,
6790
- $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
6791
- $transaction_statuses: [TransactionStatus!] = null
6792
- ) {
6793
- current_account {
6794
- id
6795
- name
6796
- recent_transactions: transactions(
6797
- first: $numTransactions
6798
- types: $transactionTypes
6799
- bitcoin_network: $network
6800
- lightning_node_id: $nodeId
6801
- statuses: $transaction_statuses
6802
- after_date: $afterDate
6803
- ) {
6804
- count
6805
- total_amount_transacted {
6806
- ...CurrencyAmountFragment
6807
- }
6808
- entities {
6809
- ...TransactionFragment
6810
- __typename
6811
- }
6812
- __typename
6813
- }
6814
- __typename
6815
- }
6816
- }
6817
-
6818
- ${FRAGMENT20}
6819
- ${FRAGMENT}
6820
- `;
6821
-
6822
- // src/objects/TransactionUpdate.ts
6823
- var TransactionUpdateFromJson = (obj) => {
6824
- return {
6825
- id: obj["id"],
6826
- createdAt: obj["created_at"],
6827
- updatedAt: obj["updated_at"],
6828
- status: TransactionStatus_default[obj["status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6829
- amount: CurrencyAmountFromJson(obj["amount"]),
6830
- typename: obj["__typename"] ?? "TransactionUpdate",
6831
- resolvedAt: obj["resolved_at"],
6832
- transactionHash: obj["transaction_hash"]
6833
- };
6834
- };
6835
- var FRAGMENT21 = `
6836
- fragment TransactionUpdateFragment on Transaction {
6837
- __typename
6838
- id
6839
- created_at
6840
- updated_at
6841
- status
6842
- resolved_at
6843
- amount {
6844
- __typename
6845
- currency_amount_original_value: original_value
6846
- currency_amount_original_unit: original_unit
6847
- currency_amount_preferred_currency_unit: preferred_currency_unit
6848
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6849
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6850
- }
6851
- transaction_hash
6852
- }`;
6853
-
6854
- // src/graphql/TransactionSubscription.ts
6855
- var TransactionSubscription = `
6856
- subscription TransactionSubscription(
6857
- $nodeIds: [ID!]!
6858
- ) {
6859
- transactions(node_ids: $nodeIds) {
6860
- ...TransactionUpdateFragment
6861
- __typename
6312
+ // src/graphql/SendPayment.ts
6313
+ var SendPayment = `
6314
+ mutation SendPayment(
6315
+ $node_id: ID!
6316
+ $destination_public_key: String!
6317
+ $timeout_secs: Int!
6318
+ $amount_msats: Long!
6319
+ $maximum_fees_msats: Long!
6320
+ ) {
6321
+ send_payment(
6322
+ input: {
6323
+ node_id: $node_id
6324
+ destination_public_key: $destination_public_key
6325
+ timeout_secs: $timeout_secs
6326
+ amount_msats: $amount_msats
6327
+ maximum_fees_msats: $maximum_fees_msats
6328
+ }
6329
+ ) {
6330
+ payment {
6331
+ ...OutgoingPaymentFragment
6332
+ }
6862
6333
  }
6863
- }
6334
+ }
6864
6335
 
6865
- ${FRAGMENT21}
6336
+ ${FRAGMENT16}
6866
6337
  `;
6867
6338
 
6868
- // src/NodeKeyLoaderCache.ts
6869
- var import_core6 = require("@lightsparkdev/core");
6870
-
6871
- // src/SigningKeyLoader.ts
6339
+ // src/objects/Transaction.ts
6872
6340
  var import_core5 = require("@lightsparkdev/core");
6873
6341
 
6874
- // src/graphql/RecoverNodeSigningKey.ts
6875
- var RecoverNodeSigningKey = `
6876
- query RecoverNodeSigningKey($nodeId: ID!) {
6877
- entity(id: $nodeId) {
6878
- __typename
6879
- ... on LightsparkNodeWithOSK {
6880
- encrypted_signing_private_key {
6881
- encrypted_value
6882
- cipher
6883
- }
6884
- }
6885
- }
6886
- }
6887
- `;
6342
+ // src/objects/RoutingTransactionFailureReason.ts
6343
+ var RoutingTransactionFailureReason = /* @__PURE__ */ ((RoutingTransactionFailureReason2) => {
6344
+ RoutingTransactionFailureReason2["FUTURE_VALUE"] = "FUTURE_VALUE";
6345
+ RoutingTransactionFailureReason2["INCOMING_LINK_FAILURE"] = "INCOMING_LINK_FAILURE";
6346
+ RoutingTransactionFailureReason2["OUTGOING_LINK_FAILURE"] = "OUTGOING_LINK_FAILURE";
6347
+ RoutingTransactionFailureReason2["FORWARDING_FAILURE"] = "FORWARDING_FAILURE";
6348
+ return RoutingTransactionFailureReason2;
6349
+ })(RoutingTransactionFailureReason || {});
6350
+ var RoutingTransactionFailureReason_default = RoutingTransactionFailureReason;
6888
6351
 
6889
- // src/SigningKeyLoader.ts
6890
- var SIGNING_KEY_PATH = "m/5";
6891
- function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
6892
- return args.password !== void 0;
6893
- }
6894
- function isMasterSeedSigningKeyLoaderArgs(args) {
6895
- return args.masterSeed !== void 0;
6896
- }
6897
- var NodeIdAndPasswordSigningKeyLoader = class {
6898
- nodeId;
6899
- password;
6900
- requester;
6901
- cryptoImpl;
6902
- constructor(args, requester, cryptoImpl) {
6903
- this.nodeId = args.nodeId;
6904
- this.password = args.password;
6905
- this.requester = requester;
6906
- this.cryptoImpl = cryptoImpl;
6352
+ // src/objects/Transaction.ts
6353
+ var TransactionFromJson = (obj) => {
6354
+ if (obj["__typename"] == "ChannelClosingTransaction") {
6355
+ return {
6356
+ id: obj["channel_closing_transaction_id"],
6357
+ createdAt: obj["channel_closing_transaction_created_at"],
6358
+ updatedAt: obj["channel_closing_transaction_updated_at"],
6359
+ status: TransactionStatus_default[obj["channel_closing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6360
+ amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
6361
+ blockHeight: obj["channel_closing_transaction_block_height"],
6362
+ destinationAddresses: obj["channel_closing_transaction_destination_addresses"],
6363
+ typename: "ChannelClosingTransaction",
6364
+ resolvedAt: obj["channel_closing_transaction_resolved_at"],
6365
+ transactionHash: obj["channel_closing_transaction_transaction_hash"],
6366
+ fees: !!obj["channel_closing_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"]) : void 0,
6367
+ blockHash: obj["channel_closing_transaction_block_hash"],
6368
+ numConfirmations: obj["channel_closing_transaction_num_confirmations"],
6369
+ channelId: obj["channel_closing_transaction_channel"]?.id ?? void 0
6370
+ };
6907
6371
  }
6908
- async loadSigningKey() {
6909
- const encryptedKey = await this.recoverNodeSigningKey();
6910
- if (!encryptedKey) {
6911
- console.warn("No encrypted key found for node " + this.nodeId);
6912
- return;
6913
- }
6914
- const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
6915
- encryptedKey.cipher,
6916
- encryptedKey.encrypted_value,
6917
- this.password
6372
+ if (obj["__typename"] == "ChannelOpeningTransaction") {
6373
+ return {
6374
+ id: obj["channel_opening_transaction_id"],
6375
+ createdAt: obj["channel_opening_transaction_created_at"],
6376
+ updatedAt: obj["channel_opening_transaction_updated_at"],
6377
+ status: TransactionStatus_default[obj["channel_opening_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6378
+ amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
6379
+ blockHeight: obj["channel_opening_transaction_block_height"],
6380
+ destinationAddresses: obj["channel_opening_transaction_destination_addresses"],
6381
+ typename: "ChannelOpeningTransaction",
6382
+ resolvedAt: obj["channel_opening_transaction_resolved_at"],
6383
+ transactionHash: obj["channel_opening_transaction_transaction_hash"],
6384
+ fees: !!obj["channel_opening_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"]) : void 0,
6385
+ blockHash: obj["channel_opening_transaction_block_hash"],
6386
+ numConfirmations: obj["channel_opening_transaction_num_confirmations"],
6387
+ channelId: obj["channel_opening_transaction_channel"]?.id ?? void 0
6388
+ };
6389
+ }
6390
+ if (obj["__typename"] == "Deposit") {
6391
+ return {
6392
+ id: obj["deposit_id"],
6393
+ createdAt: obj["deposit_created_at"],
6394
+ updatedAt: obj["deposit_updated_at"],
6395
+ status: TransactionStatus_default[obj["deposit_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6396
+ amount: CurrencyAmountFromJson(obj["deposit_amount"]),
6397
+ blockHeight: obj["deposit_block_height"],
6398
+ destinationAddresses: obj["deposit_destination_addresses"],
6399
+ destinationId: obj["deposit_destination"].id,
6400
+ typename: "Deposit",
6401
+ resolvedAt: obj["deposit_resolved_at"],
6402
+ transactionHash: obj["deposit_transaction_hash"],
6403
+ fees: !!obj["deposit_fees"] ? CurrencyAmountFromJson(obj["deposit_fees"]) : void 0,
6404
+ blockHash: obj["deposit_block_hash"],
6405
+ numConfirmations: obj["deposit_num_confirmations"]
6406
+ };
6407
+ }
6408
+ if (obj["__typename"] == "IncomingPayment") {
6409
+ return new IncomingPayment_default(
6410
+ obj["incoming_payment_id"],
6411
+ obj["incoming_payment_created_at"],
6412
+ obj["incoming_payment_updated_at"],
6413
+ TransactionStatus_default[obj["incoming_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6414
+ CurrencyAmountFromJson(obj["incoming_payment_amount"]),
6415
+ obj["incoming_payment_destination"].id,
6416
+ "IncomingPayment",
6417
+ obj["incoming_payment_resolved_at"],
6418
+ obj["incoming_payment_transaction_hash"],
6419
+ obj["incoming_payment_payment_request"]?.id ?? void 0,
6420
+ obj["incoming_payment_uma_post_transaction_data"]?.map(
6421
+ (e) => PostTransactionDataFromJson(e)
6422
+ )
6918
6423
  );
6919
- if (!signingPrivateKey) {
6920
- throw new import_core5.LightsparkSigningException(
6921
- "Unable to decrypt signing key with provided password. Please try again."
6922
- );
6923
- }
6924
- let signingPrivateKeyPEM = "";
6925
- if (new Uint8Array(signingPrivateKey)[0] === 48) {
6926
- signingPrivateKeyPEM = (0, import_core5.b64encode)(signingPrivateKey);
6927
- } else {
6928
- const dec = new TextDecoder();
6929
- signingPrivateKeyPEM = dec.decode(signingPrivateKey);
6930
- }
6931
- return { key: signingPrivateKeyPEM, type: import_core5.SigningKeyType.RSASigningKey };
6932
6424
  }
6933
- async recoverNodeSigningKey() {
6934
- const response = await this.requester.makeRawRequest(
6935
- RecoverNodeSigningKey,
6936
- { nodeId: this.nodeId }
6425
+ if (obj["__typename"] == "OutgoingPayment") {
6426
+ return new OutgoingPayment_default(
6427
+ obj["outgoing_payment_id"],
6428
+ obj["outgoing_payment_created_at"],
6429
+ obj["outgoing_payment_updated_at"],
6430
+ TransactionStatus_default[obj["outgoing_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6431
+ CurrencyAmountFromJson(obj["outgoing_payment_amount"]),
6432
+ obj["outgoing_payment_origin"].id,
6433
+ "OutgoingPayment",
6434
+ obj["outgoing_payment_resolved_at"],
6435
+ obj["outgoing_payment_transaction_hash"],
6436
+ obj["outgoing_payment_destination"]?.id ?? void 0,
6437
+ !!obj["outgoing_payment_fees"] ? CurrencyAmountFromJson(obj["outgoing_payment_fees"]) : void 0,
6438
+ !!obj["outgoing_payment_payment_request_data"] ? PaymentRequestDataFromJson(
6439
+ obj["outgoing_payment_payment_request_data"]
6440
+ ) : void 0,
6441
+ !!obj["outgoing_payment_failure_reason"] ? PaymentFailureReason_default[obj["outgoing_payment_failure_reason"]] ?? PaymentFailureReason_default.FUTURE_VALUE : null,
6442
+ !!obj["outgoing_payment_failure_message"] ? RichTextFromJson(obj["outgoing_payment_failure_message"]) : void 0,
6443
+ obj["outgoing_payment_uma_post_transaction_data"]?.map(
6444
+ (e) => PostTransactionDataFromJson(e)
6445
+ )
6937
6446
  );
6938
- const nodeEntity = response.entity;
6939
- if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
6940
- return nodeEntity.encrypted_signing_private_key;
6941
- }
6942
- return null;
6943
6447
  }
6944
- };
6945
- var MasterSeedSigningKeyLoader = class {
6946
- masterSeed;
6947
- network;
6948
- constructor(args) {
6949
- this.masterSeed = args.masterSeed;
6950
- this.network = args.network;
6448
+ if (obj["__typename"] == "RoutingTransaction") {
6449
+ return {
6450
+ id: obj["routing_transaction_id"],
6451
+ createdAt: obj["routing_transaction_created_at"],
6452
+ updatedAt: obj["routing_transaction_updated_at"],
6453
+ status: TransactionStatus_default[obj["routing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6454
+ amount: CurrencyAmountFromJson(obj["routing_transaction_amount"]),
6455
+ typename: "RoutingTransaction",
6456
+ resolvedAt: obj["routing_transaction_resolved_at"],
6457
+ transactionHash: obj["routing_transaction_transaction_hash"],
6458
+ incomingChannelId: obj["routing_transaction_incoming_channel"]?.id ?? void 0,
6459
+ outgoingChannelId: obj["routing_transaction_outgoing_channel"]?.id ?? void 0,
6460
+ fees: !!obj["routing_transaction_fees"] ? CurrencyAmountFromJson(obj["routing_transaction_fees"]) : void 0,
6461
+ failureMessage: !!obj["routing_transaction_failure_message"] ? RichTextFromJson(obj["routing_transaction_failure_message"]) : void 0,
6462
+ failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
6463
+ };
6951
6464
  }
6952
- async loadSigningKey() {
6953
- if (import_core5.isBrowser) {
6954
- throw new import_core5.LightsparkSigningException(
6955
- "Browser environments not supported for master seed signing key loader."
6956
- );
6957
- }
6958
- const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
6959
- let cryptoLibNetwork;
6960
- switch (this.network) {
6961
- case BitcoinNetwork_default.MAINNET:
6962
- cryptoLibNetwork = Network.Bitcoin;
6963
- break;
6964
- case BitcoinNetwork_default.TESTNET:
6965
- cryptoLibNetwork = Network.Testnet;
6966
- break;
6967
- case BitcoinNetwork_default.REGTEST:
6968
- cryptoLibNetwork = Network.Regtest;
6969
- break;
6970
- default:
6971
- throw new Error(
6972
- `Unsupported lightspark_crypto network ${this.network}.`
6973
- );
6974
- }
6975
- const lightsparkSigner = LightsparkSigner.from_bytes(
6976
- this.masterSeed,
6977
- cryptoLibNetwork
6978
- );
6979
- const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
6980
- return { key: privateKey, type: import_core5.SigningKeyType.Secp256k1SigningKey };
6465
+ if (obj["__typename"] == "Withdrawal") {
6466
+ return {
6467
+ id: obj["withdrawal_id"],
6468
+ createdAt: obj["withdrawal_created_at"],
6469
+ updatedAt: obj["withdrawal_updated_at"],
6470
+ status: TransactionStatus_default[obj["withdrawal_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
6471
+ amount: CurrencyAmountFromJson(obj["withdrawal_amount"]),
6472
+ blockHeight: obj["withdrawal_block_height"],
6473
+ destinationAddresses: obj["withdrawal_destination_addresses"],
6474
+ originId: obj["withdrawal_origin"].id,
6475
+ typename: "Withdrawal",
6476
+ resolvedAt: obj["withdrawal_resolved_at"],
6477
+ transactionHash: obj["withdrawal_transaction_hash"],
6478
+ fees: !!obj["withdrawal_fees"] ? CurrencyAmountFromJson(obj["withdrawal_fees"]) : void 0,
6479
+ blockHash: obj["withdrawal_block_hash"],
6480
+ numConfirmations: obj["withdrawal_num_confirmations"]
6481
+ };
6981
6482
  }
6483
+ throw new import_core5.LightsparkException(
6484
+ "DeserializationError",
6485
+ `Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
6486
+ );
6982
6487
  };
6983
-
6984
- // src/NodeKeyLoaderCache.ts
6985
- var NodeKeyLoaderCache = class {
6986
- constructor(nodeKeyCache, cryptoImpl = import_core6.DefaultCrypto) {
6987
- this.nodeKeyCache = nodeKeyCache;
6988
- this.cryptoImpl = cryptoImpl;
6989
- this.idToLoader = /* @__PURE__ */ new Map();
6990
- }
6991
- idToLoader;
6992
- /**
6993
- * Sets the signing key loader for a node.
6994
- * Instantiates a signing key loader based on the type of args passed in by the user.
6995
- *
6996
- * @param nodeId The ID of the node to get the key for
6997
- * @param loaderArgs Loader arguments for loading the key
6998
- * @param requester Requester used for loading the key
6999
- */
7000
- setLoader(nodeId, loaderArgs, requester) {
7001
- let loader;
7002
- if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
7003
- loader = new NodeIdAndPasswordSigningKeyLoader(
7004
- { nodeId, ...loaderArgs },
7005
- requester,
7006
- this.cryptoImpl
7007
- );
7008
- } else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
7009
- loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
7010
- } else {
7011
- throw new import_core6.LightsparkSigningException("Invalid signing key loader args");
6488
+ var FRAGMENT21 = `
6489
+ fragment TransactionFragment on Transaction {
6490
+ __typename
6491
+ ... on ChannelClosingTransaction {
6492
+ __typename
6493
+ channel_closing_transaction_id: id
6494
+ channel_closing_transaction_created_at: created_at
6495
+ channel_closing_transaction_updated_at: updated_at
6496
+ channel_closing_transaction_status: status
6497
+ channel_closing_transaction_resolved_at: resolved_at
6498
+ channel_closing_transaction_amount: amount {
6499
+ __typename
6500
+ currency_amount_original_value: original_value
6501
+ currency_amount_original_unit: original_unit
6502
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6503
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6504
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6505
+ }
6506
+ channel_closing_transaction_transaction_hash: transaction_hash
6507
+ channel_closing_transaction_fees: fees {
6508
+ __typename
6509
+ currency_amount_original_value: original_value
6510
+ currency_amount_original_unit: original_unit
6511
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6512
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6513
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6514
+ }
6515
+ channel_closing_transaction_block_hash: block_hash
6516
+ channel_closing_transaction_block_height: block_height
6517
+ channel_closing_transaction_destination_addresses: destination_addresses
6518
+ channel_closing_transaction_num_confirmations: num_confirmations
6519
+ channel_closing_transaction_channel: channel {
6520
+ id
6521
+ }
7012
6522
  }
7013
- this.idToLoader.set(nodeId, loader);
7014
- }
7015
- /**
7016
- * Gets the key for a node using the loader set by [setLoader]
7017
- *
7018
- * @param id The ID of the node to get the key for
7019
- * @returns The loaded key
7020
- */
7021
- async getKeyWithLoader(id) {
7022
- if (this.nodeKeyCache.hasKey(id)) {
7023
- return this.nodeKeyCache.getKey(id);
6523
+ ... on ChannelOpeningTransaction {
6524
+ __typename
6525
+ channel_opening_transaction_id: id
6526
+ channel_opening_transaction_created_at: created_at
6527
+ channel_opening_transaction_updated_at: updated_at
6528
+ channel_opening_transaction_status: status
6529
+ channel_opening_transaction_resolved_at: resolved_at
6530
+ channel_opening_transaction_amount: amount {
6531
+ __typename
6532
+ currency_amount_original_value: original_value
6533
+ currency_amount_original_unit: original_unit
6534
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6535
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6536
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6537
+ }
6538
+ channel_opening_transaction_transaction_hash: transaction_hash
6539
+ channel_opening_transaction_fees: fees {
6540
+ __typename
6541
+ currency_amount_original_value: original_value
6542
+ currency_amount_original_unit: original_unit
6543
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6544
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6545
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6546
+ }
6547
+ channel_opening_transaction_block_hash: block_hash
6548
+ channel_opening_transaction_block_height: block_height
6549
+ channel_opening_transaction_destination_addresses: destination_addresses
6550
+ channel_opening_transaction_num_confirmations: num_confirmations
6551
+ channel_opening_transaction_channel: channel {
6552
+ id
6553
+ }
7024
6554
  }
7025
- const loader = this.idToLoader.get(id);
7026
- if (!loader) {
7027
- throw new import_core6.LightsparkSigningException(
7028
- "No signing key loader found for node " + id
7029
- );
6555
+ ... on Deposit {
6556
+ __typename
6557
+ deposit_id: id
6558
+ deposit_created_at: created_at
6559
+ deposit_updated_at: updated_at
6560
+ deposit_status: status
6561
+ deposit_resolved_at: resolved_at
6562
+ deposit_amount: amount {
6563
+ __typename
6564
+ currency_amount_original_value: original_value
6565
+ currency_amount_original_unit: original_unit
6566
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6567
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6568
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6569
+ }
6570
+ deposit_transaction_hash: transaction_hash
6571
+ deposit_fees: fees {
6572
+ __typename
6573
+ currency_amount_original_value: original_value
6574
+ currency_amount_original_unit: original_unit
6575
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6576
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6577
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6578
+ }
6579
+ deposit_block_hash: block_hash
6580
+ deposit_block_height: block_height
6581
+ deposit_destination_addresses: destination_addresses
6582
+ deposit_num_confirmations: num_confirmations
6583
+ deposit_destination: destination {
6584
+ id
6585
+ }
7030
6586
  }
7031
- const loaderResult = await loader.loadSigningKey();
7032
- if (!loaderResult) {
7033
- return;
6587
+ ... on IncomingPayment {
6588
+ __typename
6589
+ incoming_payment_id: id
6590
+ incoming_payment_created_at: created_at
6591
+ incoming_payment_updated_at: updated_at
6592
+ incoming_payment_status: status
6593
+ incoming_payment_resolved_at: resolved_at
6594
+ incoming_payment_amount: amount {
6595
+ __typename
6596
+ currency_amount_original_value: original_value
6597
+ currency_amount_original_unit: original_unit
6598
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6599
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6600
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6601
+ }
6602
+ incoming_payment_transaction_hash: transaction_hash
6603
+ incoming_payment_destination: destination {
6604
+ id
6605
+ }
6606
+ incoming_payment_payment_request: payment_request {
6607
+ id
6608
+ }
6609
+ incoming_payment_uma_post_transaction_data: uma_post_transaction_data {
6610
+ __typename
6611
+ post_transaction_data_utxo: utxo
6612
+ post_transaction_data_amount: amount {
6613
+ __typename
6614
+ currency_amount_original_value: original_value
6615
+ currency_amount_original_unit: original_unit
6616
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6617
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6618
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6619
+ }
6620
+ }
7034
6621
  }
7035
- const key = await this.nodeKeyCache.loadKey(
7036
- id,
7037
- { key: loaderResult.key },
7038
- loaderResult.type
7039
- );
7040
- return key || void 0;
7041
- }
7042
- };
7043
-
7044
- // src/objects/Account.ts
7045
- var import_auto_bind14 = __toESM(require("auto-bind"), 1);
7046
-
7047
- // src/objects/AccountToApiTokensConnection.ts
7048
- var AccountToApiTokensConnectionFromJson = (obj) => {
7049
- return {
7050
- count: obj["account_to_api_tokens_connection_count"],
7051
- pageInfo: PageInfoFromJson(
7052
- obj["account_to_api_tokens_connection_page_info"]
7053
- ),
7054
- entities: obj["account_to_api_tokens_connection_entities"].map(
7055
- (e) => ApiTokenFromJson(e)
7056
- ),
7057
- typename: "AccountToApiTokensConnection"
7058
- };
7059
- };
7060
-
7061
- // src/objects/AccountToChannelsConnection.ts
7062
- var import_auto_bind11 = __toESM(require("auto-bind"), 1);
7063
- var AccountToChannelsConnection = class {
7064
- constructor(count, entities) {
7065
- this.count = count;
7066
- this.entities = entities;
7067
- (0, import_auto_bind11.default)(this);
7068
- }
7069
- };
7070
- var AccountToChannelsConnectionFromJson = (obj) => {
7071
- return new AccountToChannelsConnection(
7072
- obj["account_to_channels_connection_count"],
7073
- obj["account_to_channels_connection_entities"].map(
7074
- (e) => ChannelFromJson(e)
7075
- )
7076
- );
7077
- };
7078
- var AccountToChannelsConnection_default = AccountToChannelsConnection;
7079
-
7080
- // src/objects/LightsparkNode.ts
7081
- var import_core7 = require("@lightsparkdev/core");
7082
- var import_auto_bind12 = __toESM(require("auto-bind"), 1);
7083
- var LightsparkNode = class {
7084
- constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, ownerId, umaPrescreeningUtxos, typename, alias, color, conductivity, publicKey, status, totalBalance, totalLocalBalance, localBalance, remoteBalance, blockchainBalance) {
7085
- this.id = id;
7086
- this.createdAt = createdAt;
7087
- this.updatedAt = updatedAt;
7088
- this.bitcoinNetwork = bitcoinNetwork;
7089
- this.displayName = displayName;
7090
- this.ownerId = ownerId;
7091
- this.umaPrescreeningUtxos = umaPrescreeningUtxos;
7092
- this.typename = typename;
7093
- this.alias = alias;
7094
- this.color = color;
7095
- this.conductivity = conductivity;
7096
- this.publicKey = publicKey;
7097
- this.status = status;
7098
- this.totalBalance = totalBalance;
7099
- this.totalLocalBalance = totalLocalBalance;
7100
- this.localBalance = localBalance;
7101
- this.remoteBalance = remoteBalance;
7102
- this.blockchainBalance = blockchainBalance;
7103
- (0, import_auto_bind12.default)(this);
7104
- }
7105
- async getAddresses(client, first = void 0, types = void 0) {
7106
- return await client.executeRawQuery({
7107
- queryPayload: `
7108
- query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
7109
- entity(id: $entity_id) {
7110
- ... on LightsparkNode {
7111
- addresses(, first: $first, types: $types) {
6622
+ ... on OutgoingPayment {
6623
+ __typename
6624
+ outgoing_payment_id: id
6625
+ outgoing_payment_created_at: created_at
6626
+ outgoing_payment_updated_at: updated_at
6627
+ outgoing_payment_status: status
6628
+ outgoing_payment_resolved_at: resolved_at
6629
+ outgoing_payment_amount: amount {
6630
+ __typename
6631
+ currency_amount_original_value: original_value
6632
+ currency_amount_original_unit: original_unit
6633
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6634
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6635
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6636
+ }
6637
+ outgoing_payment_transaction_hash: transaction_hash
6638
+ outgoing_payment_origin: origin {
6639
+ id
6640
+ }
6641
+ outgoing_payment_destination: destination {
6642
+ id
6643
+ }
6644
+ outgoing_payment_fees: fees {
6645
+ __typename
6646
+ currency_amount_original_value: original_value
6647
+ currency_amount_original_unit: original_unit
6648
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6649
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6650
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6651
+ }
6652
+ outgoing_payment_payment_request_data: payment_request_data {
6653
+ __typename
6654
+ ... on InvoiceData {
7112
6655
  __typename
7113
- node_to_addresses_connection_count: count
7114
- node_to_addresses_connection_entities: entities {
6656
+ invoice_data_encoded_payment_request: encoded_payment_request
6657
+ invoice_data_bitcoin_network: bitcoin_network
6658
+ invoice_data_payment_hash: payment_hash
6659
+ invoice_data_amount: amount {
7115
6660
  __typename
7116
- node_address_address: address
7117
- node_address_type: type
6661
+ currency_amount_original_value: original_value
6662
+ currency_amount_original_unit: original_unit
6663
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6664
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6665
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6666
+ }
6667
+ invoice_data_created_at: created_at
6668
+ invoice_data_expires_at: expires_at
6669
+ invoice_data_memo: memo
6670
+ invoice_data_destination: destination {
6671
+ __typename
6672
+ ... on GraphNode {
6673
+ __typename
6674
+ graph_node_id: id
6675
+ graph_node_created_at: created_at
6676
+ graph_node_updated_at: updated_at
6677
+ graph_node_alias: alias
6678
+ graph_node_bitcoin_network: bitcoin_network
6679
+ graph_node_color: color
6680
+ graph_node_conductivity: conductivity
6681
+ graph_node_display_name: display_name
6682
+ graph_node_public_key: public_key
6683
+ }
6684
+ ... on LightsparkNodeWithOSK {
6685
+ __typename
6686
+ lightspark_node_with_o_s_k_id: id
6687
+ lightspark_node_with_o_s_k_created_at: created_at
6688
+ lightspark_node_with_o_s_k_updated_at: updated_at
6689
+ lightspark_node_with_o_s_k_alias: alias
6690
+ lightspark_node_with_o_s_k_bitcoin_network: bitcoin_network
6691
+ lightspark_node_with_o_s_k_color: color
6692
+ lightspark_node_with_o_s_k_conductivity: conductivity
6693
+ lightspark_node_with_o_s_k_display_name: display_name
6694
+ lightspark_node_with_o_s_k_public_key: public_key
6695
+ lightspark_node_with_o_s_k_owner: owner {
6696
+ id
6697
+ }
6698
+ lightspark_node_with_o_s_k_status: status
6699
+ lightspark_node_with_o_s_k_total_balance: total_balance {
6700
+ __typename
6701
+ currency_amount_original_value: original_value
6702
+ currency_amount_original_unit: original_unit
6703
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6704
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6705
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6706
+ }
6707
+ lightspark_node_with_o_s_k_total_local_balance: total_local_balance {
6708
+ __typename
6709
+ currency_amount_original_value: original_value
6710
+ currency_amount_original_unit: original_unit
6711
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6712
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6713
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6714
+ }
6715
+ lightspark_node_with_o_s_k_local_balance: local_balance {
6716
+ __typename
6717
+ currency_amount_original_value: original_value
6718
+ currency_amount_original_unit: original_unit
6719
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6720
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6721
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6722
+ }
6723
+ lightspark_node_with_o_s_k_remote_balance: remote_balance {
6724
+ __typename
6725
+ currency_amount_original_value: original_value
6726
+ currency_amount_original_unit: original_unit
6727
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6728
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6729
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6730
+ }
6731
+ lightspark_node_with_o_s_k_blockchain_balance: blockchain_balance {
6732
+ __typename
6733
+ blockchain_balance_total_balance: total_balance {
6734
+ __typename
6735
+ currency_amount_original_value: original_value
6736
+ currency_amount_original_unit: original_unit
6737
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6738
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6739
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6740
+ }
6741
+ blockchain_balance_confirmed_balance: confirmed_balance {
6742
+ __typename
6743
+ currency_amount_original_value: original_value
6744
+ currency_amount_original_unit: original_unit
6745
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6746
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6747
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6748
+ }
6749
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
6750
+ __typename
6751
+ currency_amount_original_value: original_value
6752
+ currency_amount_original_unit: original_unit
6753
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6754
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6755
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6756
+ }
6757
+ blockchain_balance_locked_balance: locked_balance {
6758
+ __typename
6759
+ currency_amount_original_value: original_value
6760
+ currency_amount_original_unit: original_unit
6761
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6762
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6763
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6764
+ }
6765
+ blockchain_balance_required_reserve: required_reserve {
6766
+ __typename
6767
+ currency_amount_original_value: original_value
6768
+ currency_amount_original_unit: original_unit
6769
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6770
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6771
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6772
+ }
6773
+ blockchain_balance_available_balance: available_balance {
6774
+ __typename
6775
+ currency_amount_original_value: original_value
6776
+ currency_amount_original_unit: original_unit
6777
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6778
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6779
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6780
+ }
6781
+ }
6782
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
6783
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
6784
+ __typename
6785
+ secret_encrypted_value: encrypted_value
6786
+ secret_cipher: cipher
6787
+ }
6788
+ }
6789
+ ... on LightsparkNodeWithRemoteSigning {
6790
+ __typename
6791
+ lightspark_node_with_remote_signing_id: id
6792
+ lightspark_node_with_remote_signing_created_at: created_at
6793
+ lightspark_node_with_remote_signing_updated_at: updated_at
6794
+ lightspark_node_with_remote_signing_alias: alias
6795
+ lightspark_node_with_remote_signing_bitcoin_network: bitcoin_network
6796
+ lightspark_node_with_remote_signing_color: color
6797
+ lightspark_node_with_remote_signing_conductivity: conductivity
6798
+ lightspark_node_with_remote_signing_display_name: display_name
6799
+ lightspark_node_with_remote_signing_public_key: public_key
6800
+ lightspark_node_with_remote_signing_owner: owner {
6801
+ id
6802
+ }
6803
+ lightspark_node_with_remote_signing_status: status
6804
+ lightspark_node_with_remote_signing_total_balance: total_balance {
6805
+ __typename
6806
+ currency_amount_original_value: original_value
6807
+ currency_amount_original_unit: original_unit
6808
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6809
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6810
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6811
+ }
6812
+ lightspark_node_with_remote_signing_total_local_balance: total_local_balance {
6813
+ __typename
6814
+ currency_amount_original_value: original_value
6815
+ currency_amount_original_unit: original_unit
6816
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6817
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6818
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6819
+ }
6820
+ lightspark_node_with_remote_signing_local_balance: local_balance {
6821
+ __typename
6822
+ currency_amount_original_value: original_value
6823
+ currency_amount_original_unit: original_unit
6824
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6825
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6826
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6827
+ }
6828
+ lightspark_node_with_remote_signing_remote_balance: remote_balance {
6829
+ __typename
6830
+ currency_amount_original_value: original_value
6831
+ currency_amount_original_unit: original_unit
6832
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6833
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6834
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6835
+ }
6836
+ lightspark_node_with_remote_signing_blockchain_balance: blockchain_balance {
6837
+ __typename
6838
+ blockchain_balance_total_balance: total_balance {
6839
+ __typename
6840
+ currency_amount_original_value: original_value
6841
+ currency_amount_original_unit: original_unit
6842
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6843
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6844
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6845
+ }
6846
+ blockchain_balance_confirmed_balance: confirmed_balance {
6847
+ __typename
6848
+ currency_amount_original_value: original_value
6849
+ currency_amount_original_unit: original_unit
6850
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6851
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6852
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6853
+ }
6854
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
6855
+ __typename
6856
+ currency_amount_original_value: original_value
6857
+ currency_amount_original_unit: original_unit
6858
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6859
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6860
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6861
+ }
6862
+ blockchain_balance_locked_balance: locked_balance {
6863
+ __typename
6864
+ currency_amount_original_value: original_value
6865
+ currency_amount_original_unit: original_unit
6866
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6867
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6868
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6869
+ }
6870
+ blockchain_balance_required_reserve: required_reserve {
6871
+ __typename
6872
+ currency_amount_original_value: original_value
6873
+ currency_amount_original_unit: original_unit
6874
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6875
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6876
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6877
+ }
6878
+ blockchain_balance_available_balance: available_balance {
6879
+ __typename
6880
+ currency_amount_original_value: original_value
6881
+ currency_amount_original_unit: original_unit
6882
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6883
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6884
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6885
+ }
6886
+ }
6887
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
6888
+ }
7118
6889
  }
7119
6890
  }
7120
6891
  }
6892
+ outgoing_payment_failure_reason: failure_reason
6893
+ outgoing_payment_failure_message: failure_message {
6894
+ __typename
6895
+ rich_text_text: text
6896
+ }
6897
+ outgoing_payment_uma_post_transaction_data: uma_post_transaction_data {
6898
+ __typename
6899
+ post_transaction_data_utxo: utxo
6900
+ post_transaction_data_amount: amount {
6901
+ __typename
6902
+ currency_amount_original_value: original_value
6903
+ currency_amount_original_unit: original_unit
6904
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6905
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6906
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6907
+ }
6908
+ }
6909
+ }
6910
+ ... on RoutingTransaction {
6911
+ __typename
6912
+ routing_transaction_id: id
6913
+ routing_transaction_created_at: created_at
6914
+ routing_transaction_updated_at: updated_at
6915
+ routing_transaction_status: status
6916
+ routing_transaction_resolved_at: resolved_at
6917
+ routing_transaction_amount: amount {
6918
+ __typename
6919
+ currency_amount_original_value: original_value
6920
+ currency_amount_original_unit: original_unit
6921
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6922
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6923
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6924
+ }
6925
+ routing_transaction_transaction_hash: transaction_hash
6926
+ routing_transaction_incoming_channel: incoming_channel {
6927
+ id
6928
+ }
6929
+ routing_transaction_outgoing_channel: outgoing_channel {
6930
+ id
6931
+ }
6932
+ routing_transaction_fees: fees {
6933
+ __typename
6934
+ currency_amount_original_value: original_value
6935
+ currency_amount_original_unit: original_unit
6936
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6937
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6938
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6939
+ }
6940
+ routing_transaction_failure_message: failure_message {
6941
+ __typename
6942
+ rich_text_text: text
6943
+ }
6944
+ routing_transaction_failure_reason: failure_reason
6945
+ }
6946
+ ... on Withdrawal {
6947
+ __typename
6948
+ withdrawal_id: id
6949
+ withdrawal_created_at: created_at
6950
+ withdrawal_updated_at: updated_at
6951
+ withdrawal_status: status
6952
+ withdrawal_resolved_at: resolved_at
6953
+ withdrawal_amount: amount {
6954
+ __typename
6955
+ currency_amount_original_value: original_value
6956
+ currency_amount_original_unit: original_unit
6957
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6958
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6959
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6960
+ }
6961
+ withdrawal_transaction_hash: transaction_hash
6962
+ withdrawal_fees: fees {
6963
+ __typename
6964
+ currency_amount_original_value: original_value
6965
+ currency_amount_original_unit: original_unit
6966
+ currency_amount_preferred_currency_unit: preferred_currency_unit
6967
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
6968
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
6969
+ }
6970
+ withdrawal_block_hash: block_hash
6971
+ withdrawal_block_height: block_height
6972
+ withdrawal_destination_addresses: destination_addresses
6973
+ withdrawal_num_confirmations: num_confirmations
6974
+ withdrawal_origin: origin {
6975
+ id
6976
+ }
6977
+ }
6978
+ }`;
6979
+ var getTransactionQuery = (id) => {
6980
+ return {
6981
+ queryPayload: `
6982
+ query GetTransaction($id: ID!) {
6983
+ entity(id: $id) {
6984
+ ... on Transaction {
6985
+ ...TransactionFragment
6986
+ }
7121
6987
  }
7122
6988
  }
6989
+
6990
+ ${FRAGMENT21}
7123
6991
  `,
7124
- variables: { entity_id: this.id, first, types },
7125
- constructObject: (json) => {
7126
- const connection = json["entity"]["addresses"];
7127
- return NodeToAddressesConnectionFromJson(connection);
7128
- }
7129
- });
7130
- }
7131
- async getChannels(client, first = void 0, statuses = void 0, after = void 0) {
7132
- return await client.executeRawQuery({
7133
- queryPayload: `
7134
- query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!], $after: String) {
7135
- entity(id: $entity_id) {
7136
- ... on LightsparkNode {
7137
- channels(, first: $first, statuses: $statuses, after: $after) {
7138
- __typename
7139
- lightspark_node_to_channels_connection_count: count
7140
- lightspark_node_to_channels_connection_page_info: page_info {
7141
- __typename
7142
- page_info_has_next_page: has_next_page
7143
- page_info_has_previous_page: has_previous_page
7144
- page_info_start_cursor: start_cursor
7145
- page_info_end_cursor: end_cursor
7146
- }
7147
- lightspark_node_to_channels_connection_entities: entities {
7148
- __typename
7149
- channel_id: id
7150
- channel_created_at: created_at
7151
- channel_updated_at: updated_at
7152
- channel_funding_transaction: funding_transaction {
7153
- id
7154
- }
7155
- channel_capacity: capacity {
7156
- __typename
7157
- currency_amount_original_value: original_value
7158
- currency_amount_original_unit: original_unit
7159
- currency_amount_preferred_currency_unit: preferred_currency_unit
7160
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7161
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7162
- }
7163
- channel_local_balance: local_balance {
7164
- __typename
7165
- currency_amount_original_value: original_value
7166
- currency_amount_original_unit: original_unit
7167
- currency_amount_preferred_currency_unit: preferred_currency_unit
7168
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7169
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7170
- }
7171
- channel_local_unsettled_balance: local_unsettled_balance {
7172
- __typename
7173
- currency_amount_original_value: original_value
7174
- currency_amount_original_unit: original_unit
7175
- currency_amount_preferred_currency_unit: preferred_currency_unit
7176
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7177
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7178
- }
7179
- channel_remote_balance: remote_balance {
7180
- __typename
7181
- currency_amount_original_value: original_value
7182
- currency_amount_original_unit: original_unit
7183
- currency_amount_preferred_currency_unit: preferred_currency_unit
7184
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7185
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7186
- }
7187
- channel_remote_unsettled_balance: remote_unsettled_balance {
7188
- __typename
7189
- currency_amount_original_value: original_value
7190
- currency_amount_original_unit: original_unit
7191
- currency_amount_preferred_currency_unit: preferred_currency_unit
7192
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7193
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7194
- }
7195
- channel_unsettled_balance: unsettled_balance {
7196
- __typename
7197
- currency_amount_original_value: original_value
7198
- currency_amount_original_unit: original_unit
7199
- currency_amount_preferred_currency_unit: preferred_currency_unit
7200
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7201
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7202
- }
7203
- channel_total_balance: total_balance {
6992
+ variables: { id },
6993
+ constructObject: (data) => TransactionFromJson(data.entity)
6994
+ };
6995
+ };
6996
+
6997
+ // src/graphql/SingleNodeDashboard.ts
6998
+ var SingleNodeDashboard = `
6999
+ query SingleNodeDashboard(
7000
+ $network: BitcoinNetwork!,
7001
+ $nodeId: ID!,
7002
+ $numTransactions: Int,
7003
+ $transactionsAfterDate: DateTime,
7004
+ $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
7005
+ $transaction_statuses: [TransactionStatus!] = null
7006
+ ) {
7007
+ current_account {
7008
+ id
7009
+ name
7010
+ dashboard_overview_nodes: nodes(
7011
+ first: 1
7012
+ bitcoin_networks: [$network]
7013
+ node_ids: [$nodeId]
7014
+ ) {
7015
+ count
7016
+ entities {
7017
+ color
7018
+ display_name
7019
+ id
7020
+ addresses(first: 1) {
7021
+ entities {
7022
+ address
7023
+ type
7204
7024
  __typename
7205
- currency_amount_original_value: original_value
7206
- currency_amount_original_unit: original_unit
7207
- currency_amount_preferred_currency_unit: preferred_currency_unit
7208
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7209
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7210
7025
  }
7211
- channel_status: status
7212
- channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
7213
- channel_commit_fee: commit_fee {
7214
- __typename
7215
- currency_amount_original_value: original_value
7216
- currency_amount_original_unit: original_unit
7217
- currency_amount_preferred_currency_unit: preferred_currency_unit
7218
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7219
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7026
+ count
7027
+ __typename
7028
+ }
7029
+ public_key
7030
+ status
7031
+ total_local_balance {
7032
+ ...CurrencyAmountFragment
7033
+ }
7034
+ local_balance {
7035
+ ...CurrencyAmountFragment
7036
+ }
7037
+ remote_balance {
7038
+ ...CurrencyAmountFragment
7039
+ }
7040
+ blockchain_balance {
7041
+ confirmed_balance {
7042
+ ...CurrencyAmountFragment
7220
7043
  }
7221
- channel_fees: fees {
7222
- __typename
7223
- channel_fees_base_fee: base_fee {
7224
- __typename
7225
- currency_amount_original_value: original_value
7226
- currency_amount_original_unit: original_unit
7227
- currency_amount_preferred_currency_unit: preferred_currency_unit
7228
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7229
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7230
- }
7231
- channel_fees_fee_rate_per_mil: fee_rate_per_mil
7044
+ unconfirmed_balance {
7045
+ ...CurrencyAmountFragment
7232
7046
  }
7233
- channel_remote_node: remote_node {
7234
- id
7047
+ available_balance {
7048
+ ...CurrencyAmountFragment
7235
7049
  }
7236
- channel_local_node: local_node {
7237
- id
7050
+ total_balance {
7051
+ ...CurrencyAmountFragment
7238
7052
  }
7239
- channel_short_channel_id: short_channel_id
7053
+ __typename
7240
7054
  }
7055
+ __typename
7056
+ }
7057
+ __typename
7058
+ }
7059
+ blockchain_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
7060
+ total_balance: total_balance {
7061
+ ...CurrencyAmountFragment
7062
+ }
7063
+ required_reserve {
7064
+ ...CurrencyAmountFragment
7065
+ }
7066
+ available_balance {
7067
+ ...CurrencyAmountFragment
7068
+ }
7069
+ unconfirmed_balance {
7070
+ ...CurrencyAmountFragment
7071
+ }
7072
+ confirmed_balance {
7073
+ ...CurrencyAmountFragment
7074
+ }
7075
+ __typename
7076
+ }
7077
+ local_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
7078
+ ...CurrencyAmountFragment
7079
+ }
7080
+ remote_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
7081
+ ...CurrencyAmountFragment
7082
+ }
7083
+ recent_transactions: transactions(
7084
+ first: $numTransactions
7085
+ types: $transactionTypes
7086
+ bitcoin_network: $network
7087
+ lightning_node_id: $nodeId
7088
+ statuses: $transaction_statuses
7089
+ after_date: $transactionsAfterDate
7090
+ ) {
7091
+ count
7092
+ total_amount_transacted {
7093
+ ...CurrencyAmountFragment
7094
+ }
7095
+ entities {
7096
+ ...TransactionFragment
7097
+ __typename
7241
7098
  }
7099
+ __typename
7242
7100
  }
7101
+ __typename
7243
7102
  }
7244
7103
  }
7245
- `,
7246
- variables: {
7247
- entity_id: this.id,
7248
- first,
7249
- statuses,
7250
- after
7251
- },
7252
- constructObject: (json) => {
7253
- const connection = json["entity"]["channels"];
7254
- return LightsparkNodeToChannelsConnectionFromJson(connection);
7104
+
7105
+ ${FRAGMENT21}
7106
+ ${FRAGMENT}
7107
+ `;
7108
+
7109
+ // src/graphql/TransactionsForNode.ts
7110
+ var TransactionsForNode = `
7111
+ query TransactionsForNode(
7112
+ $network: BitcoinNetwork!,
7113
+ $nodeId: ID!,
7114
+ $numTransactions: Int,
7115
+ $afterDate: DateTime,
7116
+ $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
7117
+ $transaction_statuses: [TransactionStatus!] = null
7118
+ ) {
7119
+ current_account {
7120
+ id
7121
+ name
7122
+ recent_transactions: transactions(
7123
+ first: $numTransactions
7124
+ types: $transactionTypes
7125
+ bitcoin_network: $network
7126
+ lightning_node_id: $nodeId
7127
+ statuses: $transaction_statuses
7128
+ after_date: $afterDate
7129
+ ) {
7130
+ count
7131
+ total_amount_transacted {
7132
+ ...CurrencyAmountFragment
7133
+ }
7134
+ entities {
7135
+ ...TransactionFragment
7136
+ __typename
7137
+ }
7138
+ __typename
7139
+ }
7140
+ __typename
7141
+ }
7142
+ }
7143
+
7144
+ ${FRAGMENT21}
7145
+ ${FRAGMENT}
7146
+ `;
7147
+
7148
+ // src/objects/TransactionUpdate.ts
7149
+ var TransactionUpdateFromJson = (obj) => {
7150
+ return {
7151
+ id: obj["id"],
7152
+ createdAt: obj["created_at"],
7153
+ updatedAt: obj["updated_at"],
7154
+ status: TransactionStatus_default[obj["status"]] ?? TransactionStatus_default.FUTURE_VALUE,
7155
+ amount: CurrencyAmountFromJson(obj["amount"]),
7156
+ typename: obj["__typename"] ?? "TransactionUpdate",
7157
+ resolvedAt: obj["resolved_at"],
7158
+ transactionHash: obj["transaction_hash"]
7159
+ };
7160
+ };
7161
+ var FRAGMENT22 = `
7162
+ fragment TransactionUpdateFragment on Transaction {
7163
+ __typename
7164
+ id
7165
+ created_at
7166
+ updated_at
7167
+ status
7168
+ resolved_at
7169
+ amount {
7170
+ __typename
7171
+ currency_amount_original_value: original_value
7172
+ currency_amount_original_unit: original_unit
7173
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7174
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7175
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7176
+ }
7177
+ transaction_hash
7178
+ }`;
7179
+
7180
+ // src/graphql/TransactionSubscription.ts
7181
+ var TransactionSubscription = `
7182
+ subscription TransactionSubscription(
7183
+ $nodeIds: [ID!]!
7184
+ ) {
7185
+ transactions(node_ids: $nodeIds) {
7186
+ ...TransactionUpdateFragment
7187
+ __typename
7188
+ }
7189
+ }
7190
+
7191
+ ${FRAGMENT22}
7192
+ `;
7193
+
7194
+ // src/NodeKeyLoaderCache.ts
7195
+ var import_core7 = require("@lightsparkdev/core");
7196
+
7197
+ // src/SigningKeyLoader.ts
7198
+ var import_core6 = require("@lightsparkdev/core");
7199
+
7200
+ // src/graphql/RecoverNodeSigningKey.ts
7201
+ var RecoverNodeSigningKey = `
7202
+ query RecoverNodeSigningKey($nodeId: ID!) {
7203
+ entity(id: $nodeId) {
7204
+ __typename
7205
+ ... on LightsparkNodeWithOSK {
7206
+ encrypted_signing_private_key {
7207
+ encrypted_value
7208
+ cipher
7209
+ }
7255
7210
  }
7256
- });
7211
+ }
7257
7212
  }
7258
- static getLightsparkNodeQuery(id) {
7259
- return {
7260
- queryPayload: `
7261
- query GetLightsparkNode($id: ID!) {
7262
- entity(id: $id) {
7263
- ... on LightsparkNode {
7264
- ...LightsparkNodeFragment
7265
- }
7213
+ `;
7214
+
7215
+ // src/SigningKeyLoader.ts
7216
+ var SIGNING_KEY_PATH = "m/5";
7217
+ function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
7218
+ return args.password !== void 0;
7219
+ }
7220
+ function isMasterSeedSigningKeyLoaderArgs(args) {
7221
+ return args.masterSeed !== void 0;
7222
+ }
7223
+ var NodeIdAndPasswordSigningKeyLoader = class {
7224
+ nodeId;
7225
+ password;
7226
+ requester;
7227
+ cryptoImpl;
7228
+ constructor(args, requester, cryptoImpl) {
7229
+ this.nodeId = args.nodeId;
7230
+ this.password = args.password;
7231
+ this.requester = requester;
7232
+ this.cryptoImpl = cryptoImpl;
7233
+ }
7234
+ async loadSigningKey() {
7235
+ const encryptedKey = await this.recoverNodeSigningKey();
7236
+ if (!encryptedKey) {
7237
+ console.warn("No encrypted key found for node " + this.nodeId);
7238
+ return;
7239
+ }
7240
+ const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
7241
+ encryptedKey.cipher,
7242
+ encryptedKey.encrypted_value,
7243
+ this.password
7244
+ );
7245
+ if (!signingPrivateKey) {
7246
+ throw new import_core6.LightsparkSigningException(
7247
+ "Unable to decrypt signing key with provided password. Please try again."
7248
+ );
7249
+ }
7250
+ let signingPrivateKeyPEM = "";
7251
+ if (new Uint8Array(signingPrivateKey)[0] === 48) {
7252
+ signingPrivateKeyPEM = (0, import_core6.b64encode)(signingPrivateKey);
7253
+ } else {
7254
+ const dec = new TextDecoder();
7255
+ signingPrivateKeyPEM = dec.decode(signingPrivateKey);
7256
+ }
7257
+ return { key: signingPrivateKeyPEM, type: import_core6.SigningKeyType.RSASigningKey };
7258
+ }
7259
+ async recoverNodeSigningKey() {
7260
+ const response = await this.requester.makeRawRequest(
7261
+ RecoverNodeSigningKey,
7262
+ { nodeId: this.nodeId }
7263
+ );
7264
+ const nodeEntity = response.entity;
7265
+ if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
7266
+ return nodeEntity.encrypted_signing_private_key;
7266
7267
  }
7267
- }
7268
-
7269
- ${FRAGMENT22}
7270
- `,
7271
- variables: { id },
7272
- constructObject: (data) => LightsparkNodeFromJson(data.entity)
7273
- };
7268
+ return null;
7274
7269
  }
7275
7270
  };
7276
- var LightsparkNodeFromJson = (obj) => {
7277
- if (obj["__typename"] == "LightsparkNodeWithOSK") {
7278
- return new LightsparkNodeWithOSK_default(
7279
- obj["lightspark_node_with_o_s_k_id"],
7280
- obj["lightspark_node_with_o_s_k_created_at"],
7281
- obj["lightspark_node_with_o_s_k_updated_at"],
7282
- BitcoinNetwork_default[obj["lightspark_node_with_o_s_k_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
7283
- obj["lightspark_node_with_o_s_k_display_name"],
7284
- obj["lightspark_node_with_o_s_k_owner"].id,
7285
- obj["lightspark_node_with_o_s_k_uma_prescreening_utxos"],
7286
- "LightsparkNodeWithOSK",
7287
- obj["lightspark_node_with_o_s_k_alias"],
7288
- obj["lightspark_node_with_o_s_k_color"],
7289
- obj["lightspark_node_with_o_s_k_conductivity"],
7290
- obj["lightspark_node_with_o_s_k_public_key"],
7291
- !!obj["lightspark_node_with_o_s_k_status"] ? LightsparkNodeStatus_default[obj["lightspark_node_with_o_s_k_status"]] ?? LightsparkNodeStatus_default.FUTURE_VALUE : null,
7292
- !!obj["lightspark_node_with_o_s_k_total_balance"] ? CurrencyAmountFromJson(
7293
- obj["lightspark_node_with_o_s_k_total_balance"]
7294
- ) : void 0,
7295
- !!obj["lightspark_node_with_o_s_k_total_local_balance"] ? CurrencyAmountFromJson(
7296
- obj["lightspark_node_with_o_s_k_total_local_balance"]
7297
- ) : void 0,
7298
- !!obj["lightspark_node_with_o_s_k_local_balance"] ? CurrencyAmountFromJson(
7299
- obj["lightspark_node_with_o_s_k_local_balance"]
7300
- ) : void 0,
7301
- !!obj["lightspark_node_with_o_s_k_remote_balance"] ? CurrencyAmountFromJson(
7302
- obj["lightspark_node_with_o_s_k_remote_balance"]
7303
- ) : void 0,
7304
- !!obj["lightspark_node_with_o_s_k_blockchain_balance"] ? BlockchainBalanceFromJson(
7305
- obj["lightspark_node_with_o_s_k_blockchain_balance"]
7306
- ) : void 0,
7307
- !!obj["lightspark_node_with_o_s_k_encrypted_signing_private_key"] ? SecretFromJson(
7308
- obj["lightspark_node_with_o_s_k_encrypted_signing_private_key"]
7309
- ) : void 0
7310
- );
7271
+ var MasterSeedSigningKeyLoader = class {
7272
+ masterSeed;
7273
+ network;
7274
+ constructor(args) {
7275
+ this.masterSeed = args.masterSeed;
7276
+ this.network = args.network;
7311
7277
  }
7312
- if (obj["__typename"] == "LightsparkNodeWithRemoteSigning") {
7313
- return new LightsparkNodeWithRemoteSigning_default(
7314
- obj["lightspark_node_with_remote_signing_id"],
7315
- obj["lightspark_node_with_remote_signing_created_at"],
7316
- obj["lightspark_node_with_remote_signing_updated_at"],
7317
- BitcoinNetwork_default[obj["lightspark_node_with_remote_signing_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
7318
- obj["lightspark_node_with_remote_signing_display_name"],
7319
- obj["lightspark_node_with_remote_signing_owner"].id,
7320
- obj["lightspark_node_with_remote_signing_uma_prescreening_utxos"],
7321
- "LightsparkNodeWithRemoteSigning",
7322
- obj["lightspark_node_with_remote_signing_alias"],
7323
- obj["lightspark_node_with_remote_signing_color"],
7324
- obj["lightspark_node_with_remote_signing_conductivity"],
7325
- obj["lightspark_node_with_remote_signing_public_key"],
7326
- !!obj["lightspark_node_with_remote_signing_status"] ? LightsparkNodeStatus_default[obj["lightspark_node_with_remote_signing_status"]] ?? LightsparkNodeStatus_default.FUTURE_VALUE : null,
7327
- !!obj["lightspark_node_with_remote_signing_total_balance"] ? CurrencyAmountFromJson(
7328
- obj["lightspark_node_with_remote_signing_total_balance"]
7329
- ) : void 0,
7330
- !!obj["lightspark_node_with_remote_signing_total_local_balance"] ? CurrencyAmountFromJson(
7331
- obj["lightspark_node_with_remote_signing_total_local_balance"]
7332
- ) : void 0,
7333
- !!obj["lightspark_node_with_remote_signing_local_balance"] ? CurrencyAmountFromJson(
7334
- obj["lightspark_node_with_remote_signing_local_balance"]
7335
- ) : void 0,
7336
- !!obj["lightspark_node_with_remote_signing_remote_balance"] ? CurrencyAmountFromJson(
7337
- obj["lightspark_node_with_remote_signing_remote_balance"]
7338
- ) : void 0,
7339
- !!obj["lightspark_node_with_remote_signing_blockchain_balance"] ? BlockchainBalanceFromJson(
7340
- obj["lightspark_node_with_remote_signing_blockchain_balance"]
7341
- ) : void 0
7278
+ async loadSigningKey() {
7279
+ if (import_core6.isBrowser) {
7280
+ throw new import_core6.LightsparkSigningException(
7281
+ "Browser environments not supported for master seed signing key loader."
7282
+ );
7283
+ }
7284
+ const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
7285
+ let cryptoLibNetwork;
7286
+ switch (this.network) {
7287
+ case BitcoinNetwork_default.MAINNET:
7288
+ cryptoLibNetwork = Network.Bitcoin;
7289
+ break;
7290
+ case BitcoinNetwork_default.TESTNET:
7291
+ cryptoLibNetwork = Network.Testnet;
7292
+ break;
7293
+ case BitcoinNetwork_default.REGTEST:
7294
+ cryptoLibNetwork = Network.Regtest;
7295
+ break;
7296
+ default:
7297
+ throw new Error(
7298
+ `Unsupported lightspark_crypto network ${this.network}.`
7299
+ );
7300
+ }
7301
+ const lightsparkSigner = LightsparkSigner.from_bytes(
7302
+ this.masterSeed,
7303
+ cryptoLibNetwork
7342
7304
  );
7305
+ const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
7306
+ return { key: privateKey, type: import_core6.SigningKeyType.Secp256k1SigningKey };
7343
7307
  }
7344
- throw new import_core7.LightsparkException(
7345
- "DeserializationError",
7346
- `Couldn't find a concrete type for interface LightsparkNode corresponding to the typename=${obj["__typename"]}`
7347
- );
7348
7308
  };
7349
- var FRAGMENT22 = `
7350
- fragment LightsparkNodeFragment on LightsparkNode {
7351
- __typename
7352
- ... on LightsparkNodeWithOSK {
7353
- __typename
7354
- lightspark_node_with_o_s_k_id: id
7355
- lightspark_node_with_o_s_k_created_at: created_at
7356
- lightspark_node_with_o_s_k_updated_at: updated_at
7357
- lightspark_node_with_o_s_k_alias: alias
7358
- lightspark_node_with_o_s_k_bitcoin_network: bitcoin_network
7359
- lightspark_node_with_o_s_k_color: color
7360
- lightspark_node_with_o_s_k_conductivity: conductivity
7361
- lightspark_node_with_o_s_k_display_name: display_name
7362
- lightspark_node_with_o_s_k_public_key: public_key
7363
- lightspark_node_with_o_s_k_owner: owner {
7364
- id
7365
- }
7366
- lightspark_node_with_o_s_k_status: status
7367
- lightspark_node_with_o_s_k_total_balance: total_balance {
7368
- __typename
7369
- currency_amount_original_value: original_value
7370
- currency_amount_original_unit: original_unit
7371
- currency_amount_preferred_currency_unit: preferred_currency_unit
7372
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7373
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7374
- }
7375
- lightspark_node_with_o_s_k_total_local_balance: total_local_balance {
7376
- __typename
7377
- currency_amount_original_value: original_value
7378
- currency_amount_original_unit: original_unit
7379
- currency_amount_preferred_currency_unit: preferred_currency_unit
7380
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7381
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7382
- }
7383
- lightspark_node_with_o_s_k_local_balance: local_balance {
7384
- __typename
7385
- currency_amount_original_value: original_value
7386
- currency_amount_original_unit: original_unit
7387
- currency_amount_preferred_currency_unit: preferred_currency_unit
7388
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7389
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7390
- }
7391
- lightspark_node_with_o_s_k_remote_balance: remote_balance {
7392
- __typename
7393
- currency_amount_original_value: original_value
7394
- currency_amount_original_unit: original_unit
7395
- currency_amount_preferred_currency_unit: preferred_currency_unit
7396
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7397
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7398
- }
7399
- lightspark_node_with_o_s_k_blockchain_balance: blockchain_balance {
7400
- __typename
7401
- blockchain_balance_total_balance: total_balance {
7402
- __typename
7403
- currency_amount_original_value: original_value
7404
- currency_amount_original_unit: original_unit
7405
- currency_amount_preferred_currency_unit: preferred_currency_unit
7406
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7407
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7408
- }
7409
- blockchain_balance_confirmed_balance: confirmed_balance {
7410
- __typename
7411
- currency_amount_original_value: original_value
7412
- currency_amount_original_unit: original_unit
7413
- currency_amount_preferred_currency_unit: preferred_currency_unit
7414
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7415
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7416
- }
7417
- blockchain_balance_unconfirmed_balance: unconfirmed_balance {
7418
- __typename
7419
- currency_amount_original_value: original_value
7420
- currency_amount_original_unit: original_unit
7421
- currency_amount_preferred_currency_unit: preferred_currency_unit
7422
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7423
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7424
- }
7425
- blockchain_balance_locked_balance: locked_balance {
7426
- __typename
7427
- currency_amount_original_value: original_value
7428
- currency_amount_original_unit: original_unit
7429
- currency_amount_preferred_currency_unit: preferred_currency_unit
7430
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7431
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7432
- }
7433
- blockchain_balance_required_reserve: required_reserve {
7434
- __typename
7435
- currency_amount_original_value: original_value
7436
- currency_amount_original_unit: original_unit
7437
- currency_amount_preferred_currency_unit: preferred_currency_unit
7438
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7439
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7440
- }
7441
- blockchain_balance_available_balance: available_balance {
7442
- __typename
7443
- currency_amount_original_value: original_value
7444
- currency_amount_original_unit: original_unit
7445
- currency_amount_preferred_currency_unit: preferred_currency_unit
7446
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7447
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7448
- }
7449
- }
7450
- lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
7451
- lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
7452
- __typename
7453
- secret_encrypted_value: encrypted_value
7454
- secret_cipher: cipher
7455
- }
7309
+
7310
+ // src/NodeKeyLoaderCache.ts
7311
+ var NodeKeyLoaderCache = class {
7312
+ constructor(nodeKeyCache, cryptoImpl = import_core7.DefaultCrypto) {
7313
+ this.nodeKeyCache = nodeKeyCache;
7314
+ this.cryptoImpl = cryptoImpl;
7315
+ this.idToLoader = /* @__PURE__ */ new Map();
7316
+ }
7317
+ idToLoader;
7318
+ /**
7319
+ * Sets the signing key loader for a node.
7320
+ * Instantiates a signing key loader based on the type of args passed in by the user.
7321
+ *
7322
+ * @param nodeId The ID of the node to get the key for
7323
+ * @param loaderArgs Loader arguments for loading the key
7324
+ * @param requester Requester used for loading the key
7325
+ */
7326
+ setLoader(nodeId, loaderArgs, requester) {
7327
+ let loader;
7328
+ if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
7329
+ loader = new NodeIdAndPasswordSigningKeyLoader(
7330
+ { nodeId, ...loaderArgs },
7331
+ requester,
7332
+ this.cryptoImpl
7333
+ );
7334
+ } else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
7335
+ loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
7336
+ } else {
7337
+ throw new import_core7.LightsparkSigningException("Invalid signing key loader args");
7338
+ }
7339
+ this.idToLoader.set(nodeId, loader);
7340
+ }
7341
+ /**
7342
+ * Gets the key for a node using the loader set by [setLoader]
7343
+ *
7344
+ * @param id The ID of the node to get the key for
7345
+ * @returns The loaded key
7346
+ */
7347
+ async getKeyWithLoader(id) {
7348
+ if (this.nodeKeyCache.hasKey(id)) {
7349
+ return this.nodeKeyCache.getKey(id);
7350
+ }
7351
+ const loader = this.idToLoader.get(id);
7352
+ if (!loader) {
7353
+ throw new import_core7.LightsparkSigningException(
7354
+ "No signing key loader found for node " + id
7355
+ );
7456
7356
  }
7457
- ... on LightsparkNodeWithRemoteSigning {
7458
- __typename
7459
- lightspark_node_with_remote_signing_id: id
7460
- lightspark_node_with_remote_signing_created_at: created_at
7461
- lightspark_node_with_remote_signing_updated_at: updated_at
7462
- lightspark_node_with_remote_signing_alias: alias
7463
- lightspark_node_with_remote_signing_bitcoin_network: bitcoin_network
7464
- lightspark_node_with_remote_signing_color: color
7465
- lightspark_node_with_remote_signing_conductivity: conductivity
7466
- lightspark_node_with_remote_signing_display_name: display_name
7467
- lightspark_node_with_remote_signing_public_key: public_key
7468
- lightspark_node_with_remote_signing_owner: owner {
7469
- id
7470
- }
7471
- lightspark_node_with_remote_signing_status: status
7472
- lightspark_node_with_remote_signing_total_balance: total_balance {
7473
- __typename
7474
- currency_amount_original_value: original_value
7475
- currency_amount_original_unit: original_unit
7476
- currency_amount_preferred_currency_unit: preferred_currency_unit
7477
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7478
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7479
- }
7480
- lightspark_node_with_remote_signing_total_local_balance: total_local_balance {
7481
- __typename
7482
- currency_amount_original_value: original_value
7483
- currency_amount_original_unit: original_unit
7484
- currency_amount_preferred_currency_unit: preferred_currency_unit
7485
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7486
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7487
- }
7488
- lightspark_node_with_remote_signing_local_balance: local_balance {
7489
- __typename
7490
- currency_amount_original_value: original_value
7491
- currency_amount_original_unit: original_unit
7492
- currency_amount_preferred_currency_unit: preferred_currency_unit
7493
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7494
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7495
- }
7496
- lightspark_node_with_remote_signing_remote_balance: remote_balance {
7497
- __typename
7498
- currency_amount_original_value: original_value
7499
- currency_amount_original_unit: original_unit
7500
- currency_amount_preferred_currency_unit: preferred_currency_unit
7501
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7502
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7503
- }
7504
- lightspark_node_with_remote_signing_blockchain_balance: blockchain_balance {
7505
- __typename
7506
- blockchain_balance_total_balance: total_balance {
7507
- __typename
7508
- currency_amount_original_value: original_value
7509
- currency_amount_original_unit: original_unit
7510
- currency_amount_preferred_currency_unit: preferred_currency_unit
7511
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7512
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7513
- }
7514
- blockchain_balance_confirmed_balance: confirmed_balance {
7515
- __typename
7516
- currency_amount_original_value: original_value
7517
- currency_amount_original_unit: original_unit
7518
- currency_amount_preferred_currency_unit: preferred_currency_unit
7519
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7520
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7521
- }
7522
- blockchain_balance_unconfirmed_balance: unconfirmed_balance {
7523
- __typename
7524
- currency_amount_original_value: original_value
7525
- currency_amount_original_unit: original_unit
7526
- currency_amount_preferred_currency_unit: preferred_currency_unit
7527
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7528
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7529
- }
7530
- blockchain_balance_locked_balance: locked_balance {
7531
- __typename
7532
- currency_amount_original_value: original_value
7533
- currency_amount_original_unit: original_unit
7534
- currency_amount_preferred_currency_unit: preferred_currency_unit
7535
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7536
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7537
- }
7538
- blockchain_balance_required_reserve: required_reserve {
7539
- __typename
7540
- currency_amount_original_value: original_value
7541
- currency_amount_original_unit: original_unit
7542
- currency_amount_preferred_currency_unit: preferred_currency_unit
7543
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7544
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7545
- }
7546
- blockchain_balance_available_balance: available_balance {
7547
- __typename
7548
- currency_amount_original_value: original_value
7549
- currency_amount_original_unit: original_unit
7550
- currency_amount_preferred_currency_unit: preferred_currency_unit
7551
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7552
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7553
- }
7554
- }
7555
- lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
7357
+ const loaderResult = await loader.loadSigningKey();
7358
+ if (!loaderResult) {
7359
+ return;
7556
7360
  }
7557
- }`;
7558
- var LightsparkNode_default = LightsparkNode;
7361
+ const key = await this.nodeKeyCache.loadKey(
7362
+ id,
7363
+ { key: loaderResult.key },
7364
+ loaderResult.type
7365
+ );
7366
+ return key || void 0;
7367
+ }
7368
+ };
7559
7369
 
7560
- // src/objects/AccountToNodesConnection.ts
7561
- var AccountToNodesConnectionFromJson = (obj) => {
7370
+ // src/objects/Account.ts
7371
+ var import_auto_bind14 = __toESM(require("auto-bind"), 1);
7372
+
7373
+ // src/objects/AccountToApiTokensConnection.ts
7374
+ var AccountToApiTokensConnectionFromJson = (obj) => {
7562
7375
  return {
7563
- count: obj["account_to_nodes_connection_count"],
7564
- pageInfo: PageInfoFromJson(obj["account_to_nodes_connection_page_info"]),
7565
- entities: obj["account_to_nodes_connection_entities"].map(
7566
- (e) => LightsparkNodeFromJson(e)
7376
+ count: obj["account_to_api_tokens_connection_count"],
7377
+ pageInfo: PageInfoFromJson(
7378
+ obj["account_to_api_tokens_connection_page_info"]
7567
7379
  ),
7568
- typename: "AccountToNodesConnection"
7380
+ entities: obj["account_to_api_tokens_connection_entities"].map(
7381
+ (e) => ApiTokenFromJson(e)
7382
+ ),
7383
+ typename: "AccountToApiTokensConnection"
7569
7384
  };
7570
7385
  };
7571
7386
 
7572
- // src/objects/PaymentRequest.ts
7573
- var import_core8 = require("@lightsparkdev/core");
7574
- var PaymentRequestFromJson = (obj) => {
7575
- if (obj["__typename"] == "Invoice") {
7576
- return {
7577
- id: obj["invoice_id"],
7578
- createdAt: obj["invoice_created_at"],
7579
- updatedAt: obj["invoice_updated_at"],
7580
- data: InvoiceDataFromJson(obj["invoice_data"]),
7581
- status: PaymentRequestStatus_default[obj["invoice_status"]] ?? PaymentRequestStatus_default.FUTURE_VALUE,
7582
- typename: "Invoice",
7583
- amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
7584
- };
7387
+ // src/objects/AccountToChannelsConnection.ts
7388
+ var import_auto_bind11 = __toESM(require("auto-bind"), 1);
7389
+ var AccountToChannelsConnection = class {
7390
+ constructor(count, entities) {
7391
+ this.count = count;
7392
+ this.entities = entities;
7393
+ (0, import_auto_bind11.default)(this);
7585
7394
  }
7586
- throw new import_core8.LightsparkException(
7587
- "DeserializationError",
7588
- `Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`
7395
+ };
7396
+ var AccountToChannelsConnectionFromJson = (obj) => {
7397
+ return new AccountToChannelsConnection(
7398
+ obj["account_to_channels_connection_count"],
7399
+ obj["account_to_channels_connection_entities"].map(
7400
+ (e) => ChannelFromJson(e)
7401
+ )
7589
7402
  );
7590
7403
  };
7591
- var FRAGMENT23 = `
7592
- fragment PaymentRequestFragment on PaymentRequest {
7593
- __typename
7594
- ... on Invoice {
7595
- __typename
7596
- invoice_id: id
7597
- invoice_created_at: created_at
7598
- invoice_updated_at: updated_at
7599
- invoice_data: data {
7600
- __typename
7601
- invoice_data_encoded_payment_request: encoded_payment_request
7602
- invoice_data_bitcoin_network: bitcoin_network
7603
- invoice_data_payment_hash: payment_hash
7604
- invoice_data_amount: amount {
7404
+ var AccountToChannelsConnection_default = AccountToChannelsConnection;
7405
+
7406
+ // src/objects/LightsparkNode.ts
7407
+ var import_core8 = require("@lightsparkdev/core");
7408
+ var import_auto_bind12 = __toESM(require("auto-bind"), 1);
7409
+ var LightsparkNode = class {
7410
+ constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, ownerId, umaPrescreeningUtxos, typename, alias, color, conductivity, publicKey, status, totalBalance, totalLocalBalance, localBalance, remoteBalance, blockchainBalance) {
7411
+ this.id = id;
7412
+ this.createdAt = createdAt;
7413
+ this.updatedAt = updatedAt;
7414
+ this.bitcoinNetwork = bitcoinNetwork;
7415
+ this.displayName = displayName;
7416
+ this.ownerId = ownerId;
7417
+ this.umaPrescreeningUtxos = umaPrescreeningUtxos;
7418
+ this.typename = typename;
7419
+ this.alias = alias;
7420
+ this.color = color;
7421
+ this.conductivity = conductivity;
7422
+ this.publicKey = publicKey;
7423
+ this.status = status;
7424
+ this.totalBalance = totalBalance;
7425
+ this.totalLocalBalance = totalLocalBalance;
7426
+ this.localBalance = localBalance;
7427
+ this.remoteBalance = remoteBalance;
7428
+ this.blockchainBalance = blockchainBalance;
7429
+ (0, import_auto_bind12.default)(this);
7430
+ }
7431
+ async getAddresses(client, first = void 0, types = void 0) {
7432
+ return await client.executeRawQuery({
7433
+ queryPayload: `
7434
+ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
7435
+ entity(id: $entity_id) {
7436
+ ... on LightsparkNode {
7437
+ addresses(, first: $first, types: $types) {
7605
7438
  __typename
7606
- currency_amount_original_value: original_value
7607
- currency_amount_original_unit: original_unit
7608
- currency_amount_preferred_currency_unit: preferred_currency_unit
7609
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7610
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7439
+ node_to_addresses_connection_count: count
7440
+ node_to_addresses_connection_entities: entities {
7441
+ __typename
7442
+ node_address_address: address
7443
+ node_address_type: type
7444
+ }
7611
7445
  }
7612
- invoice_data_created_at: created_at
7613
- invoice_data_expires_at: expires_at
7614
- invoice_data_memo: memo
7615
- invoice_data_destination: destination {
7446
+ }
7447
+ }
7448
+ }
7449
+ `,
7450
+ variables: { entity_id: this.id, first, types },
7451
+ constructObject: (json) => {
7452
+ const connection = json["entity"]["addresses"];
7453
+ return NodeToAddressesConnectionFromJson(connection);
7454
+ }
7455
+ });
7456
+ }
7457
+ async getChannels(client, first = void 0, statuses = void 0, after = void 0) {
7458
+ return await client.executeRawQuery({
7459
+ queryPayload: `
7460
+ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!], $after: String) {
7461
+ entity(id: $entity_id) {
7462
+ ... on LightsparkNode {
7463
+ channels(, first: $first, statuses: $statuses, after: $after) {
7616
7464
  __typename
7617
- ... on GraphNode {
7618
- __typename
7619
- graph_node_id: id
7620
- graph_node_created_at: created_at
7621
- graph_node_updated_at: updated_at
7622
- graph_node_alias: alias
7623
- graph_node_bitcoin_network: bitcoin_network
7624
- graph_node_color: color
7625
- graph_node_conductivity: conductivity
7626
- graph_node_display_name: display_name
7627
- graph_node_public_key: public_key
7465
+ lightspark_node_to_channels_connection_count: count
7466
+ lightspark_node_to_channels_connection_page_info: page_info {
7467
+ __typename
7468
+ page_info_has_next_page: has_next_page
7469
+ page_info_has_previous_page: has_previous_page
7470
+ page_info_start_cursor: start_cursor
7471
+ page_info_end_cursor: end_cursor
7628
7472
  }
7629
- ... on LightsparkNodeWithOSK {
7473
+ lightspark_node_to_channels_connection_entities: entities {
7630
7474
  __typename
7631
- lightspark_node_with_o_s_k_id: id
7632
- lightspark_node_with_o_s_k_created_at: created_at
7633
- lightspark_node_with_o_s_k_updated_at: updated_at
7634
- lightspark_node_with_o_s_k_alias: alias
7635
- lightspark_node_with_o_s_k_bitcoin_network: bitcoin_network
7636
- lightspark_node_with_o_s_k_color: color
7637
- lightspark_node_with_o_s_k_conductivity: conductivity
7638
- lightspark_node_with_o_s_k_display_name: display_name
7639
- lightspark_node_with_o_s_k_public_key: public_key
7640
- lightspark_node_with_o_s_k_owner: owner {
7475
+ channel_id: id
7476
+ channel_created_at: created_at
7477
+ channel_updated_at: updated_at
7478
+ channel_funding_transaction: funding_transaction {
7641
7479
  id
7642
7480
  }
7643
- lightspark_node_with_o_s_k_status: status
7644
- lightspark_node_with_o_s_k_total_balance: total_balance {
7481
+ channel_capacity: capacity {
7645
7482
  __typename
7646
7483
  currency_amount_original_value: original_value
7647
7484
  currency_amount_original_unit: original_unit
@@ -7649,7 +7486,7 @@ fragment PaymentRequestFragment on PaymentRequest {
7649
7486
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7650
7487
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7651
7488
  }
7652
- lightspark_node_with_o_s_k_total_local_balance: total_local_balance {
7489
+ channel_local_balance: local_balance {
7653
7490
  __typename
7654
7491
  currency_amount_original_value: original_value
7655
7492
  currency_amount_original_unit: original_unit
@@ -7657,7 +7494,7 @@ fragment PaymentRequestFragment on PaymentRequest {
7657
7494
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7658
7495
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7659
7496
  }
7660
- lightspark_node_with_o_s_k_local_balance: local_balance {
7497
+ channel_local_unsettled_balance: local_unsettled_balance {
7661
7498
  __typename
7662
7499
  currency_amount_original_value: original_value
7663
7500
  currency_amount_original_unit: original_unit
@@ -7665,7 +7502,7 @@ fragment PaymentRequestFragment on PaymentRequest {
7665
7502
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7666
7503
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7667
7504
  }
7668
- lightspark_node_with_o_s_k_remote_balance: remote_balance {
7505
+ channel_remote_balance: remote_balance {
7669
7506
  __typename
7670
7507
  currency_amount_original_value: original_value
7671
7508
  currency_amount_original_unit: original_unit
@@ -7673,80 +7510,7 @@ fragment PaymentRequestFragment on PaymentRequest {
7673
7510
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7674
7511
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7675
7512
  }
7676
- lightspark_node_with_o_s_k_blockchain_balance: blockchain_balance {
7677
- __typename
7678
- blockchain_balance_total_balance: total_balance {
7679
- __typename
7680
- currency_amount_original_value: original_value
7681
- currency_amount_original_unit: original_unit
7682
- currency_amount_preferred_currency_unit: preferred_currency_unit
7683
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7684
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7685
- }
7686
- blockchain_balance_confirmed_balance: confirmed_balance {
7687
- __typename
7688
- currency_amount_original_value: original_value
7689
- currency_amount_original_unit: original_unit
7690
- currency_amount_preferred_currency_unit: preferred_currency_unit
7691
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7692
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7693
- }
7694
- blockchain_balance_unconfirmed_balance: unconfirmed_balance {
7695
- __typename
7696
- currency_amount_original_value: original_value
7697
- currency_amount_original_unit: original_unit
7698
- currency_amount_preferred_currency_unit: preferred_currency_unit
7699
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7700
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7701
- }
7702
- blockchain_balance_locked_balance: locked_balance {
7703
- __typename
7704
- currency_amount_original_value: original_value
7705
- currency_amount_original_unit: original_unit
7706
- currency_amount_preferred_currency_unit: preferred_currency_unit
7707
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7708
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7709
- }
7710
- blockchain_balance_required_reserve: required_reserve {
7711
- __typename
7712
- currency_amount_original_value: original_value
7713
- currency_amount_original_unit: original_unit
7714
- currency_amount_preferred_currency_unit: preferred_currency_unit
7715
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7716
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7717
- }
7718
- blockchain_balance_available_balance: available_balance {
7719
- __typename
7720
- currency_amount_original_value: original_value
7721
- currency_amount_original_unit: original_unit
7722
- currency_amount_preferred_currency_unit: preferred_currency_unit
7723
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7724
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7725
- }
7726
- }
7727
- lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
7728
- lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
7729
- __typename
7730
- secret_encrypted_value: encrypted_value
7731
- secret_cipher: cipher
7732
- }
7733
- }
7734
- ... on LightsparkNodeWithRemoteSigning {
7735
- __typename
7736
- lightspark_node_with_remote_signing_id: id
7737
- lightspark_node_with_remote_signing_created_at: created_at
7738
- lightspark_node_with_remote_signing_updated_at: updated_at
7739
- lightspark_node_with_remote_signing_alias: alias
7740
- lightspark_node_with_remote_signing_bitcoin_network: bitcoin_network
7741
- lightspark_node_with_remote_signing_color: color
7742
- lightspark_node_with_remote_signing_conductivity: conductivity
7743
- lightspark_node_with_remote_signing_display_name: display_name
7744
- lightspark_node_with_remote_signing_public_key: public_key
7745
- lightspark_node_with_remote_signing_owner: owner {
7746
- id
7747
- }
7748
- lightspark_node_with_remote_signing_status: status
7749
- lightspark_node_with_remote_signing_total_balance: total_balance {
7513
+ channel_remote_unsettled_balance: remote_unsettled_balance {
7750
7514
  __typename
7751
7515
  currency_amount_original_value: original_value
7752
7516
  currency_amount_original_unit: original_unit
@@ -7754,7 +7518,7 @@ fragment PaymentRequestFragment on PaymentRequest {
7754
7518
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7755
7519
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7756
7520
  }
7757
- lightspark_node_with_remote_signing_total_local_balance: total_local_balance {
7521
+ channel_unsettled_balance: unsettled_balance {
7758
7522
  __typename
7759
7523
  currency_amount_original_value: original_value
7760
7524
  currency_amount_original_unit: original_unit
@@ -7762,7 +7526,7 @@ fragment PaymentRequestFragment on PaymentRequest {
7762
7526
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7763
7527
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7764
7528
  }
7765
- lightspark_node_with_remote_signing_local_balance: local_balance {
7529
+ channel_total_balance: total_balance {
7766
7530
  __typename
7767
7531
  currency_amount_original_value: original_value
7768
7532
  currency_amount_original_unit: original_unit
@@ -7770,7 +7534,9 @@ fragment PaymentRequestFragment on PaymentRequest {
7770
7534
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7771
7535
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7772
7536
  }
7773
- lightspark_node_with_remote_signing_remote_balance: remote_balance {
7537
+ channel_status: status
7538
+ channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
7539
+ channel_commit_fee: commit_fee {
7774
7540
  __typename
7775
7541
  currency_amount_original_value: original_value
7776
7542
  currency_amount_original_unit: original_unit
@@ -7778,49 +7544,9 @@ fragment PaymentRequestFragment on PaymentRequest {
7778
7544
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7779
7545
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7780
7546
  }
7781
- lightspark_node_with_remote_signing_blockchain_balance: blockchain_balance {
7547
+ channel_fees: fees {
7782
7548
  __typename
7783
- blockchain_balance_total_balance: total_balance {
7784
- __typename
7785
- currency_amount_original_value: original_value
7786
- currency_amount_original_unit: original_unit
7787
- currency_amount_preferred_currency_unit: preferred_currency_unit
7788
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7789
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7790
- }
7791
- blockchain_balance_confirmed_balance: confirmed_balance {
7792
- __typename
7793
- currency_amount_original_value: original_value
7794
- currency_amount_original_unit: original_unit
7795
- currency_amount_preferred_currency_unit: preferred_currency_unit
7796
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7797
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7798
- }
7799
- blockchain_balance_unconfirmed_balance: unconfirmed_balance {
7800
- __typename
7801
- currency_amount_original_value: original_value
7802
- currency_amount_original_unit: original_unit
7803
- currency_amount_preferred_currency_unit: preferred_currency_unit
7804
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7805
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7806
- }
7807
- blockchain_balance_locked_balance: locked_balance {
7808
- __typename
7809
- currency_amount_original_value: original_value
7810
- currency_amount_original_unit: original_unit
7811
- currency_amount_preferred_currency_unit: preferred_currency_unit
7812
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7813
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7814
- }
7815
- blockchain_balance_required_reserve: required_reserve {
7816
- __typename
7817
- currency_amount_original_value: original_value
7818
- currency_amount_original_unit: original_unit
7819
- currency_amount_preferred_currency_unit: preferred_currency_unit
7820
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7821
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7822
- }
7823
- blockchain_balance_available_balance: available_balance {
7549
+ channel_fees_base_fee: base_fee {
7824
7550
  __typename
7825
7551
  currency_amount_original_value: original_value
7826
7552
  currency_amount_original_unit: original_unit
@@ -7828,13 +7554,167 @@ fragment PaymentRequestFragment on PaymentRequest {
7828
7554
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7829
7555
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7830
7556
  }
7557
+ channel_fees_fee_rate_per_mil: fee_rate_per_mil
7831
7558
  }
7832
- lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
7559
+ channel_remote_node: remote_node {
7560
+ id
7561
+ }
7562
+ channel_local_node: local_node {
7563
+ id
7564
+ }
7565
+ channel_short_channel_id: short_channel_id
7833
7566
  }
7834
7567
  }
7835
7568
  }
7836
- invoice_status: status
7837
- invoice_amount_paid: amount_paid {
7569
+ }
7570
+ }
7571
+ `,
7572
+ variables: {
7573
+ entity_id: this.id,
7574
+ first,
7575
+ statuses,
7576
+ after
7577
+ },
7578
+ constructObject: (json) => {
7579
+ const connection = json["entity"]["channels"];
7580
+ return LightsparkNodeToChannelsConnectionFromJson(connection);
7581
+ }
7582
+ });
7583
+ }
7584
+ static getLightsparkNodeQuery(id) {
7585
+ return {
7586
+ queryPayload: `
7587
+ query GetLightsparkNode($id: ID!) {
7588
+ entity(id: $id) {
7589
+ ... on LightsparkNode {
7590
+ ...LightsparkNodeFragment
7591
+ }
7592
+ }
7593
+ }
7594
+
7595
+ ${FRAGMENT23}
7596
+ `,
7597
+ variables: { id },
7598
+ constructObject: (data) => LightsparkNodeFromJson(data.entity)
7599
+ };
7600
+ }
7601
+ };
7602
+ var LightsparkNodeFromJson = (obj) => {
7603
+ if (obj["__typename"] == "LightsparkNodeWithOSK") {
7604
+ return new LightsparkNodeWithOSK_default(
7605
+ obj["lightspark_node_with_o_s_k_id"],
7606
+ obj["lightspark_node_with_o_s_k_created_at"],
7607
+ obj["lightspark_node_with_o_s_k_updated_at"],
7608
+ BitcoinNetwork_default[obj["lightspark_node_with_o_s_k_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
7609
+ obj["lightspark_node_with_o_s_k_display_name"],
7610
+ obj["lightspark_node_with_o_s_k_owner"].id,
7611
+ obj["lightspark_node_with_o_s_k_uma_prescreening_utxos"],
7612
+ "LightsparkNodeWithOSK",
7613
+ obj["lightspark_node_with_o_s_k_alias"],
7614
+ obj["lightspark_node_with_o_s_k_color"],
7615
+ obj["lightspark_node_with_o_s_k_conductivity"],
7616
+ obj["lightspark_node_with_o_s_k_public_key"],
7617
+ !!obj["lightspark_node_with_o_s_k_status"] ? LightsparkNodeStatus_default[obj["lightspark_node_with_o_s_k_status"]] ?? LightsparkNodeStatus_default.FUTURE_VALUE : null,
7618
+ !!obj["lightspark_node_with_o_s_k_total_balance"] ? CurrencyAmountFromJson(
7619
+ obj["lightspark_node_with_o_s_k_total_balance"]
7620
+ ) : void 0,
7621
+ !!obj["lightspark_node_with_o_s_k_total_local_balance"] ? CurrencyAmountFromJson(
7622
+ obj["lightspark_node_with_o_s_k_total_local_balance"]
7623
+ ) : void 0,
7624
+ !!obj["lightspark_node_with_o_s_k_local_balance"] ? CurrencyAmountFromJson(
7625
+ obj["lightspark_node_with_o_s_k_local_balance"]
7626
+ ) : void 0,
7627
+ !!obj["lightspark_node_with_o_s_k_remote_balance"] ? CurrencyAmountFromJson(
7628
+ obj["lightspark_node_with_o_s_k_remote_balance"]
7629
+ ) : void 0,
7630
+ !!obj["lightspark_node_with_o_s_k_blockchain_balance"] ? BlockchainBalanceFromJson(
7631
+ obj["lightspark_node_with_o_s_k_blockchain_balance"]
7632
+ ) : void 0,
7633
+ !!obj["lightspark_node_with_o_s_k_encrypted_signing_private_key"] ? SecretFromJson(
7634
+ obj["lightspark_node_with_o_s_k_encrypted_signing_private_key"]
7635
+ ) : void 0
7636
+ );
7637
+ }
7638
+ if (obj["__typename"] == "LightsparkNodeWithRemoteSigning") {
7639
+ return new LightsparkNodeWithRemoteSigning_default(
7640
+ obj["lightspark_node_with_remote_signing_id"],
7641
+ obj["lightspark_node_with_remote_signing_created_at"],
7642
+ obj["lightspark_node_with_remote_signing_updated_at"],
7643
+ BitcoinNetwork_default[obj["lightspark_node_with_remote_signing_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
7644
+ obj["lightspark_node_with_remote_signing_display_name"],
7645
+ obj["lightspark_node_with_remote_signing_owner"].id,
7646
+ obj["lightspark_node_with_remote_signing_uma_prescreening_utxos"],
7647
+ "LightsparkNodeWithRemoteSigning",
7648
+ obj["lightspark_node_with_remote_signing_alias"],
7649
+ obj["lightspark_node_with_remote_signing_color"],
7650
+ obj["lightspark_node_with_remote_signing_conductivity"],
7651
+ obj["lightspark_node_with_remote_signing_public_key"],
7652
+ !!obj["lightspark_node_with_remote_signing_status"] ? LightsparkNodeStatus_default[obj["lightspark_node_with_remote_signing_status"]] ?? LightsparkNodeStatus_default.FUTURE_VALUE : null,
7653
+ !!obj["lightspark_node_with_remote_signing_total_balance"] ? CurrencyAmountFromJson(
7654
+ obj["lightspark_node_with_remote_signing_total_balance"]
7655
+ ) : void 0,
7656
+ !!obj["lightspark_node_with_remote_signing_total_local_balance"] ? CurrencyAmountFromJson(
7657
+ obj["lightspark_node_with_remote_signing_total_local_balance"]
7658
+ ) : void 0,
7659
+ !!obj["lightspark_node_with_remote_signing_local_balance"] ? CurrencyAmountFromJson(
7660
+ obj["lightspark_node_with_remote_signing_local_balance"]
7661
+ ) : void 0,
7662
+ !!obj["lightspark_node_with_remote_signing_remote_balance"] ? CurrencyAmountFromJson(
7663
+ obj["lightspark_node_with_remote_signing_remote_balance"]
7664
+ ) : void 0,
7665
+ !!obj["lightspark_node_with_remote_signing_blockchain_balance"] ? BlockchainBalanceFromJson(
7666
+ obj["lightspark_node_with_remote_signing_blockchain_balance"]
7667
+ ) : void 0
7668
+ );
7669
+ }
7670
+ throw new import_core8.LightsparkException(
7671
+ "DeserializationError",
7672
+ `Couldn't find a concrete type for interface LightsparkNode corresponding to the typename=${obj["__typename"]}`
7673
+ );
7674
+ };
7675
+ var FRAGMENT23 = `
7676
+ fragment LightsparkNodeFragment on LightsparkNode {
7677
+ __typename
7678
+ ... on LightsparkNodeWithOSK {
7679
+ __typename
7680
+ lightspark_node_with_o_s_k_id: id
7681
+ lightspark_node_with_o_s_k_created_at: created_at
7682
+ lightspark_node_with_o_s_k_updated_at: updated_at
7683
+ lightspark_node_with_o_s_k_alias: alias
7684
+ lightspark_node_with_o_s_k_bitcoin_network: bitcoin_network
7685
+ lightspark_node_with_o_s_k_color: color
7686
+ lightspark_node_with_o_s_k_conductivity: conductivity
7687
+ lightspark_node_with_o_s_k_display_name: display_name
7688
+ lightspark_node_with_o_s_k_public_key: public_key
7689
+ lightspark_node_with_o_s_k_owner: owner {
7690
+ id
7691
+ }
7692
+ lightspark_node_with_o_s_k_status: status
7693
+ lightspark_node_with_o_s_k_total_balance: total_balance {
7694
+ __typename
7695
+ currency_amount_original_value: original_value
7696
+ currency_amount_original_unit: original_unit
7697
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7698
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7699
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7700
+ }
7701
+ lightspark_node_with_o_s_k_total_local_balance: total_local_balance {
7702
+ __typename
7703
+ currency_amount_original_value: original_value
7704
+ currency_amount_original_unit: original_unit
7705
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7706
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7707
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7708
+ }
7709
+ lightspark_node_with_o_s_k_local_balance: local_balance {
7710
+ __typename
7711
+ currency_amount_original_value: original_value
7712
+ currency_amount_original_unit: original_unit
7713
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7714
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7715
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7716
+ }
7717
+ lightspark_node_with_o_s_k_remote_balance: remote_balance {
7838
7718
  __typename
7839
7719
  currency_amount_original_value: original_value
7840
7720
  currency_amount_original_unit: original_unit
@@ -7842,23 +7722,176 @@ fragment PaymentRequestFragment on PaymentRequest {
7842
7722
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7843
7723
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7844
7724
  }
7725
+ lightspark_node_with_o_s_k_blockchain_balance: blockchain_balance {
7726
+ __typename
7727
+ blockchain_balance_total_balance: total_balance {
7728
+ __typename
7729
+ currency_amount_original_value: original_value
7730
+ currency_amount_original_unit: original_unit
7731
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7732
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7733
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7734
+ }
7735
+ blockchain_balance_confirmed_balance: confirmed_balance {
7736
+ __typename
7737
+ currency_amount_original_value: original_value
7738
+ currency_amount_original_unit: original_unit
7739
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7740
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7741
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7742
+ }
7743
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
7744
+ __typename
7745
+ currency_amount_original_value: original_value
7746
+ currency_amount_original_unit: original_unit
7747
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7748
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7749
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7750
+ }
7751
+ blockchain_balance_locked_balance: locked_balance {
7752
+ __typename
7753
+ currency_amount_original_value: original_value
7754
+ currency_amount_original_unit: original_unit
7755
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7756
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7757
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7758
+ }
7759
+ blockchain_balance_required_reserve: required_reserve {
7760
+ __typename
7761
+ currency_amount_original_value: original_value
7762
+ currency_amount_original_unit: original_unit
7763
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7764
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7765
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7766
+ }
7767
+ blockchain_balance_available_balance: available_balance {
7768
+ __typename
7769
+ currency_amount_original_value: original_value
7770
+ currency_amount_original_unit: original_unit
7771
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7772
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7773
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7774
+ }
7775
+ }
7776
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
7777
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
7778
+ __typename
7779
+ secret_encrypted_value: encrypted_value
7780
+ secret_cipher: cipher
7781
+ }
7845
7782
  }
7846
- }`;
7847
- var getPaymentRequestQuery = (id) => {
7848
- return {
7849
- queryPayload: `
7850
- query GetPaymentRequest($id: ID!) {
7851
- entity(id: $id) {
7852
- ... on PaymentRequest {
7853
- ...PaymentRequestFragment
7783
+ ... on LightsparkNodeWithRemoteSigning {
7784
+ __typename
7785
+ lightspark_node_with_remote_signing_id: id
7786
+ lightspark_node_with_remote_signing_created_at: created_at
7787
+ lightspark_node_with_remote_signing_updated_at: updated_at
7788
+ lightspark_node_with_remote_signing_alias: alias
7789
+ lightspark_node_with_remote_signing_bitcoin_network: bitcoin_network
7790
+ lightspark_node_with_remote_signing_color: color
7791
+ lightspark_node_with_remote_signing_conductivity: conductivity
7792
+ lightspark_node_with_remote_signing_display_name: display_name
7793
+ lightspark_node_with_remote_signing_public_key: public_key
7794
+ lightspark_node_with_remote_signing_owner: owner {
7795
+ id
7796
+ }
7797
+ lightspark_node_with_remote_signing_status: status
7798
+ lightspark_node_with_remote_signing_total_balance: total_balance {
7799
+ __typename
7800
+ currency_amount_original_value: original_value
7801
+ currency_amount_original_unit: original_unit
7802
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7803
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7804
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7805
+ }
7806
+ lightspark_node_with_remote_signing_total_local_balance: total_local_balance {
7807
+ __typename
7808
+ currency_amount_original_value: original_value
7809
+ currency_amount_original_unit: original_unit
7810
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7811
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7812
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7813
+ }
7814
+ lightspark_node_with_remote_signing_local_balance: local_balance {
7815
+ __typename
7816
+ currency_amount_original_value: original_value
7817
+ currency_amount_original_unit: original_unit
7818
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7819
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7820
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7821
+ }
7822
+ lightspark_node_with_remote_signing_remote_balance: remote_balance {
7823
+ __typename
7824
+ currency_amount_original_value: original_value
7825
+ currency_amount_original_unit: original_unit
7826
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7827
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7828
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7829
+ }
7830
+ lightspark_node_with_remote_signing_blockchain_balance: blockchain_balance {
7831
+ __typename
7832
+ blockchain_balance_total_balance: total_balance {
7833
+ __typename
7834
+ currency_amount_original_value: original_value
7835
+ currency_amount_original_unit: original_unit
7836
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7837
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7838
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7839
+ }
7840
+ blockchain_balance_confirmed_balance: confirmed_balance {
7841
+ __typename
7842
+ currency_amount_original_value: original_value
7843
+ currency_amount_original_unit: original_unit
7844
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7845
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7846
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7847
+ }
7848
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
7849
+ __typename
7850
+ currency_amount_original_value: original_value
7851
+ currency_amount_original_unit: original_unit
7852
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7853
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7854
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7855
+ }
7856
+ blockchain_balance_locked_balance: locked_balance {
7857
+ __typename
7858
+ currency_amount_original_value: original_value
7859
+ currency_amount_original_unit: original_unit
7860
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7861
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7862
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7863
+ }
7864
+ blockchain_balance_required_reserve: required_reserve {
7865
+ __typename
7866
+ currency_amount_original_value: original_value
7867
+ currency_amount_original_unit: original_unit
7868
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7869
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7870
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7871
+ }
7872
+ blockchain_balance_available_balance: available_balance {
7873
+ __typename
7874
+ currency_amount_original_value: original_value
7875
+ currency_amount_original_unit: original_unit
7876
+ currency_amount_preferred_currency_unit: preferred_currency_unit
7877
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
7878
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
7879
+ }
7854
7880
  }
7881
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
7855
7882
  }
7856
- }
7883
+ }`;
7884
+ var LightsparkNode_default = LightsparkNode;
7857
7885
 
7858
- ${FRAGMENT23}
7859
- `,
7860
- variables: { id },
7861
- constructObject: (data) => PaymentRequestFromJson(data.entity)
7886
+ // src/objects/AccountToNodesConnection.ts
7887
+ var AccountToNodesConnectionFromJson = (obj) => {
7888
+ return {
7889
+ count: obj["account_to_nodes_connection_count"],
7890
+ pageInfo: PageInfoFromJson(obj["account_to_nodes_connection_page_info"]),
7891
+ entities: obj["account_to_nodes_connection_entities"].map(
7892
+ (e) => LightsparkNodeFromJson(e)
7893
+ ),
7894
+ typename: "AccountToNodesConnection"
7862
7895
  };
7863
7896
  };
7864
7897
 
@@ -10562,6 +10595,29 @@ var LightsparkClient = class {
10562
10595
  (transaction) => TransactionFromJson(transaction)
10563
10596
  ) ?? [];
10564
10597
  }
10598
+ /**
10599
+ * Retrieves the most recent payment requests for a given node.
10600
+ *
10601
+ * @param nodeId The node ID for which to read transactions
10602
+ * @param numTransactions The maximum number of transactions to read. Defaults to 20.
10603
+ * @param bitcoinNetwork The bitcoin network on which to read transactions. Defaults to MAINNET.
10604
+ * @param afterDate Filters transactions to those after the given date. Defaults to undefined (no limit).
10605
+ * @returns An array of payment requests for the given node ID.
10606
+ */
10607
+ async getRecentPaymentRequests(nodeId, numTransactions = 20, bitcoinNetwork = BitcoinNetwork_default.MAINNET, afterDate = void 0) {
10608
+ const response = await this.requester.makeRawRequest(
10609
+ PaymentRequestsForNode,
10610
+ {
10611
+ nodeId,
10612
+ numTransactions,
10613
+ network: bitcoinNetwork,
10614
+ afterDate
10615
+ }
10616
+ );
10617
+ return response.current_account?.recent_payment_requests.entities.map(
10618
+ (paymentRequest) => PaymentRequestFromJson(paymentRequest)
10619
+ ) ?? [];
10620
+ }
10565
10621
  /**
10566
10622
  * Starts listening for new transactions or updates to existing transactions for a list of nodes.
10567
10623
  *