@lightsparkdev/lightspark-sdk 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @lightsparkdev/lightspark-sdk
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7d81e43: Add createLnurlInvoice function with examples. Allows creating LNURL-pay invoices.
8
+
9
+ ### Patch Changes
10
+
11
+ - 7d81e43: Turn prettier organize imports plugin back on except for site
12
+ - 7d81e43: Rerun the SDK generator to pick up several changes
13
+ - Updated dependencies [7d81e43]
14
+ - @lightsparkdev/core@0.3.3
15
+
3
16
  ## 0.3.4
4
17
 
5
18
  ### Patch Changes
@@ -519,13 +519,14 @@ var SecretFromJson = (obj) => {
519
519
 
520
520
  // src/objects/LightsparkNode.ts
521
521
  var LightsparkNode = class {
522
- constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, accountId, typename, alias, color, conductivity, publicKey, blockchainBalance, encryptedSigningPrivateKey, totalBalance, totalLocalBalance, localBalance, purpose, remoteBalance, status) {
522
+ constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, accountId, ownerId, typename, alias, color, conductivity, publicKey, blockchainBalance, encryptedSigningPrivateKey, totalBalance, totalLocalBalance, localBalance, purpose, remoteBalance, status) {
523
523
  this.id = id;
524
524
  this.createdAt = createdAt;
525
525
  this.updatedAt = updatedAt;
526
526
  this.bitcoinNetwork = bitcoinNetwork;
527
527
  this.displayName = displayName;
528
528
  this.accountId = accountId;
529
+ this.ownerId = ownerId;
529
530
  this.typename = typename;
530
531
  this.alias = alias;
531
532
  this.color = color;
@@ -715,6 +716,7 @@ var LightsparkNodeFromJson = (obj) => {
715
716
  BitcoinNetwork_default[obj["lightspark_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
716
717
  obj["lightspark_node_display_name"],
717
718
  obj["lightspark_node_account"].id,
719
+ obj["lightspark_node_owner"].id,
718
720
  "LightsparkNode",
719
721
  obj["lightspark_node_alias"],
720
722
  obj["lightspark_node_color"],
@@ -745,6 +747,9 @@ fragment LightsparkNodeFragment on LightsparkNode {
745
747
  lightspark_node_account: account {
746
748
  id
747
749
  }
750
+ lightspark_node_owner: owner {
751
+ id
752
+ }
748
753
  lightspark_node_blockchain_balance: blockchain_balance {
749
754
  __typename
750
755
  blockchain_balance_total_balance: total_balance {
@@ -1028,6 +1033,7 @@ var NodeFromJson = (obj) => {
1028
1033
  BitcoinNetwork_default[obj["lightspark_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
1029
1034
  obj["lightspark_node_display_name"],
1030
1035
  obj["lightspark_node_account"].id,
1036
+ obj["lightspark_node_owner"].id,
1031
1037
  "LightsparkNode",
1032
1038
  obj["lightspark_node_alias"],
1033
1039
  obj["lightspark_node_color"],
@@ -1077,6 +1083,9 @@ fragment NodeFragment on Node {
1077
1083
  lightspark_node_account: account {
1078
1084
  id
1079
1085
  }
1086
+ lightspark_node_owner: owner {
1087
+ id
1088
+ }
1080
1089
  lightspark_node_blockchain_balance: blockchain_balance {
1081
1090
  __typename
1082
1091
  blockchain_balance_total_balance: total_balance {
@@ -1230,6 +1239,9 @@ fragment InvoiceDataFragment on InvoiceData {
1230
1239
  lightspark_node_account: account {
1231
1240
  id
1232
1241
  }
1242
+ lightspark_node_owner: owner {
1243
+ id
1244
+ }
1233
1245
  lightspark_node_blockchain_balance: blockchain_balance {
1234
1246
  __typename
1235
1247
  blockchain_balance_total_balance: total_balance {
@@ -1403,6 +1415,9 @@ fragment PaymentRequestFragment on PaymentRequest {
1403
1415
  lightspark_node_account: account {
1404
1416
  id
1405
1417
  }
1418
+ lightspark_node_owner: owner {
1419
+ id
1420
+ }
1406
1421
  lightspark_node_blockchain_balance: blockchain_balance {
1407
1422
  __typename
1408
1423
  blockchain_balance_total_balance: total_balance {
@@ -2236,6 +2251,9 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
2236
2251
  lightspark_node_account: account {
2237
2252
  id
2238
2253
  }
2254
+ lightspark_node_owner: owner {
2255
+ id
2256
+ }
2239
2257
  lightspark_node_blockchain_balance: blockchain_balance {
2240
2258
  __typename
2241
2259
  blockchain_balance_total_balance: total_balance {
@@ -2680,6 +2698,9 @@ fragment TransactionFragment on Transaction {
2680
2698
  lightspark_node_account: account {
2681
2699
  id
2682
2700
  }
2701
+ lightspark_node_owner: owner {
2702
+ id
2703
+ }
2683
2704
  lightspark_node_blockchain_balance: blockchain_balance {
2684
2705
  __typename
2685
2706
  blockchain_balance_total_balance: total_balance {
@@ -2905,13 +2926,30 @@ var BalancesFromJson = (obj) => {
2905
2926
  };
2906
2927
  };
2907
2928
 
2929
+ // src/objects/WalletStatus.ts
2930
+ var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
2931
+ WalletStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
2932
+ WalletStatus2["NOT_SETUP"] = "NOT_SETUP";
2933
+ WalletStatus2["DEPLOYING"] = "DEPLOYING";
2934
+ WalletStatus2["DEPLOYED"] = "DEPLOYED";
2935
+ WalletStatus2["INITIALIZING"] = "INITIALIZING";
2936
+ WalletStatus2["READY"] = "READY";
2937
+ WalletStatus2["UNAVAILABLE"] = "UNAVAILABLE";
2938
+ WalletStatus2["FAILED"] = "FAILED";
2939
+ WalletStatus2["TERMINATING"] = "TERMINATING";
2940
+ WalletStatus2["TERMINATED"] = "TERMINATED";
2941
+ return WalletStatus2;
2942
+ })(WalletStatus || {});
2943
+ var WalletStatus_default = WalletStatus;
2944
+
2908
2945
  // src/objects/Wallet.ts
2909
2946
  var Wallet = class {
2910
- constructor(id, createdAt, updatedAt, thirdPartyIdentifier, typename, lastLoginAt, balances) {
2947
+ constructor(id, createdAt, updatedAt, thirdPartyIdentifier, status, typename, lastLoginAt, balances) {
2911
2948
  this.id = id;
2912
2949
  this.createdAt = createdAt;
2913
2950
  this.updatedAt = updatedAt;
2914
2951
  this.thirdPartyIdentifier = thirdPartyIdentifier;
2952
+ this.status = status;
2915
2953
  this.typename = typename;
2916
2954
  this.lastLoginAt = lastLoginAt;
2917
2955
  this.balances = balances;
@@ -2973,11 +3011,11 @@ query FetchWalletTotalAmountSent($created_after_date: DateTime, $created_before_
2973
3011
  }
2974
3012
  });
2975
3013
  }
2976
- static getWalletQuery() {
3014
+ static getWalletQuery(id) {
2977
3015
  return {
2978
3016
  queryPayload: `
2979
- query GetWallet {
2980
- current_wallet {
3017
+ query GetWallet($id: ID!) {
3018
+ entity(id: $id) {
2981
3019
  ... on Wallet {
2982
3020
  ...WalletFragment
2983
3021
  }
@@ -2986,8 +3024,8 @@ query GetWallet {
2986
3024
 
2987
3025
  ${FRAGMENT15}
2988
3026
  `,
2989
- variables: {},
2990
- constructObject: (data) => WalletFromJson(data.current_wallet)
3027
+ variables: { id },
3028
+ constructObject: (data) => WalletFromJson(data.entity)
2991
3029
  };
2992
3030
  }
2993
3031
  };
@@ -2997,6 +3035,7 @@ var WalletFromJson = (obj) => {
2997
3035
  obj["wallet_created_at"],
2998
3036
  obj["wallet_updated_at"],
2999
3037
  obj["wallet_third_party_identifier"],
3038
+ WalletStatus_default[obj["wallet_status"]] ?? WalletStatus_default.FUTURE_VALUE,
3000
3039
  "Wallet",
3001
3040
  obj["wallet_last_login_at"],
3002
3041
  !!obj["wallet_balances"] ? BalancesFromJson(obj["wallet_balances"]) : void 0
@@ -3037,6 +3076,7 @@ fragment WalletFragment on Wallet {
3037
3076
  }
3038
3077
  }
3039
3078
  wallet_third_party_identifier: third_party_identifier
3079
+ wallet_status: status
3040
3080
  }`;
3041
3081
  var Wallet_default = Wallet;
3042
3082
 
@@ -3240,6 +3280,9 @@ query FetchAccountToNodesConnection($first: Int, $bitcoin_networks: [BitcoinNetw
3240
3280
  lightspark_node_account: account {
3241
3281
  id
3242
3282
  }
3283
+ lightspark_node_owner: owner {
3284
+ id
3285
+ }
3243
3286
  lightspark_node_blockchain_balance: blockchain_balance {
3244
3287
  __typename
3245
3288
  blockchain_balance_total_balance: total_balance {
@@ -3749,6 +3792,9 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
3749
3792
  lightspark_node_account: account {
3750
3793
  id
3751
3794
  }
3795
+ lightspark_node_owner: owner {
3796
+ id
3797
+ }
3752
3798
  lightspark_node_blockchain_balance: blockchain_balance {
3753
3799
  __typename
3754
3800
  blockchain_balance_total_balance: total_balance {
@@ -4007,6 +4053,9 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
4007
4053
  lightspark_node_account: account {
4008
4054
  id
4009
4055
  }
4056
+ lightspark_node_owner: owner {
4057
+ id
4058
+ }
4010
4059
  lightspark_node_blockchain_balance: blockchain_balance {
4011
4060
  __typename
4012
4061
  blockchain_balance_total_balance: total_balance {
@@ -4187,6 +4236,7 @@ query FetchAccountToWalletsConnection($first: Int) {
4187
4236
  }
4188
4237
  }
4189
4238
  wallet_third_party_identifier: third_party_identifier
4239
+ wallet_status: status
4190
4240
  }
4191
4241
  }
4192
4242
  }
@@ -4546,6 +4596,9 @@ fragment InvoiceFragment on Invoice {
4546
4596
  lightspark_node_account: account {
4547
4597
  id
4548
4598
  }
4599
+ lightspark_node_owner: owner {
4600
+ id
4601
+ }
4549
4602
  lightspark_node_blockchain_balance: blockchain_balance {
4550
4603
  __typename
4551
4604
  blockchain_balance_total_balance: total_balance {
@@ -4846,6 +4899,9 @@ fragment LightningTransactionFragment on LightningTransaction {
4846
4899
  lightspark_node_account: account {
4847
4900
  id
4848
4901
  }
4902
+ lightspark_node_owner: owner {
4903
+ id
4904
+ }
4849
4905
  lightspark_node_blockchain_balance: blockchain_balance {
4850
4906
  __typename
4851
4907
  blockchain_balance_total_balance: total_balance {
@@ -5001,8 +5057,102 @@ ${FRAGMENT23}
5001
5057
  };
5002
5058
  };
5003
5059
 
5004
- // src/objects/OnChainTransaction.ts
5060
+ // src/objects/LightsparkNodeOwner.ts
5005
5061
  import { LightsparkException as LightsparkException6 } from "@lightsparkdev/core";
5062
+ var LightsparkNodeOwnerFromJson = (obj) => {
5063
+ if (obj["__typename"] == "Account") {
5064
+ return new Account_default(
5065
+ obj["account_id"],
5066
+ obj["account_created_at"],
5067
+ obj["account_updated_at"],
5068
+ "Account",
5069
+ obj["account_name"]
5070
+ );
5071
+ }
5072
+ if (obj["__typename"] == "Wallet") {
5073
+ return new Wallet_default(
5074
+ obj["wallet_id"],
5075
+ obj["wallet_created_at"],
5076
+ obj["wallet_updated_at"],
5077
+ obj["wallet_third_party_identifier"],
5078
+ WalletStatus_default[obj["wallet_status"]] ?? WalletStatus_default.FUTURE_VALUE,
5079
+ "Wallet",
5080
+ obj["wallet_last_login_at"],
5081
+ !!obj["wallet_balances"] ? BalancesFromJson(obj["wallet_balances"]) : void 0
5082
+ );
5083
+ }
5084
+ throw new LightsparkException6(
5085
+ "DeserializationError",
5086
+ `Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
5087
+ );
5088
+ };
5089
+ var FRAGMENT24 = `
5090
+ fragment LightsparkNodeOwnerFragment on LightsparkNodeOwner {
5091
+ __typename
5092
+ ... on Account {
5093
+ __typename
5094
+ account_id: id
5095
+ account_created_at: created_at
5096
+ account_updated_at: updated_at
5097
+ account_name: name
5098
+ }
5099
+ ... on Wallet {
5100
+ __typename
5101
+ wallet_id: id
5102
+ wallet_created_at: created_at
5103
+ wallet_updated_at: updated_at
5104
+ wallet_last_login_at: last_login_at
5105
+ wallet_balances: balances {
5106
+ __typename
5107
+ balances_owned_balance: owned_balance {
5108
+ __typename
5109
+ currency_amount_original_value: original_value
5110
+ currency_amount_original_unit: original_unit
5111
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5112
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5113
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5114
+ }
5115
+ balances_available_to_send_balance: available_to_send_balance {
5116
+ __typename
5117
+ currency_amount_original_value: original_value
5118
+ currency_amount_original_unit: original_unit
5119
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5120
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5121
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5122
+ }
5123
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
5124
+ __typename
5125
+ currency_amount_original_value: original_value
5126
+ currency_amount_original_unit: original_unit
5127
+ currency_amount_preferred_currency_unit: preferred_currency_unit
5128
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
5129
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
5130
+ }
5131
+ }
5132
+ wallet_third_party_identifier: third_party_identifier
5133
+ wallet_status: status
5134
+ }
5135
+ }`;
5136
+ var getLightsparkNodeOwnerQuery = (id) => {
5137
+ return {
5138
+ queryPayload: `
5139
+ query GetLightsparkNodeOwner($id: ID!) {
5140
+ entity(id: $id) {
5141
+ ... on LightsparkNodeOwner {
5142
+ ...LightsparkNodeOwnerFragment
5143
+ }
5144
+ }
5145
+ }
5146
+
5147
+ ${FRAGMENT24}
5148
+ `,
5149
+ variables: { id },
5150
+ constructObject: (data) => LightsparkNodeOwnerFromJson(data.entity)
5151
+ };
5152
+ };
5153
+
5154
+ // src/objects/OnChainTransaction.ts
5155
+ import { LightsparkException as LightsparkException7 } from "@lightsparkdev/core";
5006
5156
  var OnChainTransactionFromJson = (obj) => {
5007
5157
  if (obj["__typename"] == "ChannelClosingTransaction") {
5008
5158
  return {
@@ -5076,12 +5226,12 @@ var OnChainTransactionFromJson = (obj) => {
5076
5226
  numConfirmations: obj["withdrawal_num_confirmations"]
5077
5227
  };
5078
5228
  }
5079
- throw new LightsparkException6(
5229
+ throw new LightsparkException7(
5080
5230
  "DeserializationError",
5081
5231
  `Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
5082
5232
  );
5083
5233
  };
5084
- var FRAGMENT24 = `
5234
+ var FRAGMENT25 = `
5085
5235
  fragment OnChainTransactionFragment on OnChainTransaction {
5086
5236
  __typename
5087
5237
  ... on ChannelClosingTransaction {
@@ -5224,7 +5374,7 @@ query GetOnChainTransaction($id: ID!) {
5224
5374
  }
5225
5375
  }
5226
5376
 
5227
- ${FRAGMENT24}
5377
+ ${FRAGMENT25}
5228
5378
  `,
5229
5379
  variables: { id },
5230
5380
  constructObject: (data) => OnChainTransactionFromJson(data.entity)
@@ -5258,7 +5408,7 @@ var RoutingTransactionFromJson = (obj) => {
5258
5408
  failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
5259
5409
  };
5260
5410
  };
5261
- var FRAGMENT25 = `
5411
+ var FRAGMENT26 = `
5262
5412
  fragment RoutingTransactionFragment on RoutingTransaction {
5263
5413
  __typename
5264
5414
  routing_transaction_id: id
@@ -5306,7 +5456,7 @@ query GetRoutingTransaction($id: ID!) {
5306
5456
  }
5307
5457
  }
5308
5458
 
5309
- ${FRAGMENT25}
5459
+ ${FRAGMENT26}
5310
5460
  `,
5311
5461
  variables: { id },
5312
5462
  constructObject: (data) => RoutingTransactionFromJson(data.entity)
@@ -5343,7 +5493,7 @@ var TransactionUpdateFromJson = (obj) => {
5343
5493
  transactionHash: obj["transaction_hash"]
5344
5494
  };
5345
5495
  };
5346
- var FRAGMENT26 = `
5496
+ var FRAGMENT27 = `
5347
5497
  fragment TransactionUpdateFragment on Transaction {
5348
5498
  __typename
5349
5499
  id
@@ -5395,7 +5545,7 @@ var WithdrawalFromJson = (obj) => {
5395
5545
  numConfirmations: obj["withdrawal_num_confirmations"]
5396
5546
  };
5397
5547
  };
5398
- var FRAGMENT27 = `
5548
+ var FRAGMENT28 = `
5399
5549
  fragment WithdrawalFragment on Withdrawal {
5400
5550
  __typename
5401
5551
  withdrawal_id: id
@@ -5439,7 +5589,7 @@ query GetWithdrawal($id: ID!) {
5439
5589
  }
5440
5590
  }
5441
5591
 
5442
- ${FRAGMENT27}
5592
+ ${FRAGMENT28}
5443
5593
  `,
5444
5594
  variables: { id },
5445
5595
  constructObject: (data) => WithdrawalFromJson(data.entity)
@@ -5632,7 +5782,7 @@ query GetWithdrawalRequest($id: ID!) {
5632
5782
  }
5633
5783
  }
5634
5784
 
5635
- ${FRAGMENT28}
5785
+ ${FRAGMENT29}
5636
5786
  `,
5637
5787
  variables: { id },
5638
5788
  constructObject: (data) => WithdrawalRequestFromJson(data.entity)
@@ -5654,7 +5804,7 @@ var WithdrawalRequestFromJson = (obj) => {
5654
5804
  obj["withdrawal_request_withdrawal"]?.id ?? void 0
5655
5805
  );
5656
5806
  };
5657
- var FRAGMENT28 = `
5807
+ var FRAGMENT29 = `
5658
5808
  fragment WithdrawalRequestFragment on WithdrawalRequest {
5659
5809
  __typename
5660
5810
  withdrawal_request_id: id
@@ -5696,11 +5846,6 @@ export {
5696
5846
  ApiTokenFromJson,
5697
5847
  FRAGMENT as FRAGMENT3,
5698
5848
  getApiTokenQuery,
5699
- HtlcAttemptFailureCode_default,
5700
- OutgoingPaymentAttemptStatus_default,
5701
- getHopQuery,
5702
- OutgoingPaymentAttempt_default,
5703
- PaymentFailureReason_default,
5704
5849
  BitcoinNetwork_default,
5705
5850
  NodeAddressType_default,
5706
5851
  GraphNode_default,
@@ -5710,38 +5855,47 @@ export {
5710
5855
  Channel_default,
5711
5856
  LightsparkNode_default,
5712
5857
  Node_default,
5858
+ InvoiceDataFromJson,
5859
+ FRAGMENT7 as FRAGMENT4,
5860
+ PaymentRequestStatus_default,
5861
+ InvoiceFromJson,
5862
+ FRAGMENT21 as FRAGMENT5,
5863
+ getInvoiceQuery,
5864
+ HtlcAttemptFailureCode_default,
5865
+ OutgoingPaymentAttemptStatus_default,
5866
+ getHopQuery,
5867
+ OutgoingPaymentAttempt_default,
5868
+ PaymentFailureReason_default,
5713
5869
  TransactionStatus_default,
5714
5870
  OutgoingPaymentFromJson,
5715
- FRAGMENT13 as FRAGMENT4,
5871
+ FRAGMENT13 as FRAGMENT6,
5716
5872
  OutgoingPayment_default,
5717
- InvoiceDataFromJson,
5718
- FRAGMENT7 as FRAGMENT5,
5719
- FRAGMENT22 as FRAGMENT6,
5873
+ FRAGMENT22 as FRAGMENT7,
5720
5874
  WithdrawalMode_default,
5721
5875
  WithdrawalRequestStatus_default,
5722
5876
  getChannelClosingTransactionQuery,
5723
5877
  getChannelOpeningTransactionQuery,
5724
5878
  WithdrawalRequestFromJson,
5725
- FRAGMENT28 as FRAGMENT7,
5879
+ FRAGMENT29 as FRAGMENT8,
5726
5880
  WithdrawalRequest_default,
5727
5881
  IncomingPaymentAttemptStatus_default,
5728
5882
  getIncomingPaymentAttemptQuery,
5729
5883
  IncomingPayment_default,
5730
5884
  RoutingTransactionFailureReason_default,
5731
5885
  TransactionFromJson,
5732
- FRAGMENT14 as FRAGMENT8,
5886
+ FRAGMENT14 as FRAGMENT9,
5733
5887
  getTransactionQuery,
5734
5888
  TransactionUpdateFromJson,
5735
- FRAGMENT26 as FRAGMENT9,
5889
+ FRAGMENT27 as FRAGMENT10,
5736
5890
  AccountToChannelsConnection_default,
5737
- PaymentRequestStatus_default,
5738
5891
  getPaymentRequestQuery,
5892
+ WalletStatus_default,
5739
5893
  Wallet_default,
5740
5894
  Account_default,
5741
5895
  InvoiceType_default,
5742
5896
  getDepositQuery,
5743
- getInvoiceQuery,
5744
5897
  getLightningTransactionQuery,
5898
+ getLightsparkNodeOwnerQuery,
5745
5899
  getOnChainTransactionQuery,
5746
5900
  getRoutingTransactionQuery,
5747
5901
  TransactionType_default,