@lightsparkdev/lightspark-sdk 1.9.13 → 1.9.15

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,23 @@
1
1
  # @lightsparkdev/lightspark-sdk
2
2
 
3
+ ## 1.9.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 9a7776b: Adding ability to fail HTLCs and add an idempotency key to requestWithdrawal
8
+ - Updated dependencies [9a7776b]
9
+ - @lightsparkdev/core@1.4.8
10
+ - @lightsparkdev/crypto-wasm@0.1.22
11
+
12
+ ## 1.9.14
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [8e4690a]
17
+ - Updated dependencies [8e4690a]
18
+ - @lightsparkdev/core@1.4.7
19
+ - @lightsparkdev/crypto-wasm@0.1.21
20
+
3
21
  ## 1.9.13
4
22
 
5
23
  ### Patch Changes
@@ -9232,6 +9232,20 @@ ${FRAGMENT26}
9232
9232
  };
9233
9233
  };
9234
9234
 
9235
+ // src/objects/FailHtlcsOutput.ts
9236
+ var FailHtlcsOutputFromJson = (obj) => {
9237
+ return {
9238
+ invoiceId: obj["fail_htlcs_output_invoice"].id
9239
+ };
9240
+ };
9241
+ var FRAGMENT27 = `
9242
+ fragment FailHtlcsOutputFragment on FailHtlcsOutput {
9243
+ __typename
9244
+ fail_htlcs_output_invoice: invoice {
9245
+ id
9246
+ }
9247
+ }`;
9248
+
9235
9249
  // src/objects/FeeEstimate.ts
9236
9250
  var FeeEstimateFromJson = (obj) => {
9237
9251
  return {
@@ -9239,7 +9253,7 @@ var FeeEstimateFromJson = (obj) => {
9239
9253
  feeMin: CurrencyAmountFromJson(obj["fee_estimate_fee_min"])
9240
9254
  };
9241
9255
  };
9242
- var FRAGMENT27 = `
9256
+ var FRAGMENT28 = `
9243
9257
  fragment FeeEstimateFragment on FeeEstimate {
9244
9258
  __typename
9245
9259
  fee_estimate_fee_fast: fee_fast {
@@ -9298,7 +9312,7 @@ var InvoiceFromJson = (obj) => {
9298
9312
  isLnurl: obj["invoice_is_lnurl"]
9299
9313
  };
9300
9314
  };
9301
- var FRAGMENT28 = `
9315
+ var FRAGMENT29 = `
9302
9316
  fragment InvoiceFragment on Invoice {
9303
9317
  __typename
9304
9318
  invoice_id: id
@@ -9618,7 +9632,7 @@ query GetInvoice($id: ID!) {
9618
9632
  }
9619
9633
  }
9620
9634
 
9621
- ${FRAGMENT28}
9635
+ ${FRAGMENT29}
9622
9636
  `,
9623
9637
  variables: { id },
9624
9638
  constructObject: (data) => isObject25(data) && "entity" in data && isObject25(data.entity) ? InvoiceFromJson(data.entity) : null
@@ -9626,7 +9640,7 @@ ${FRAGMENT28}
9626
9640
  };
9627
9641
 
9628
9642
  // src/objects/LightningFeeEstimateOutput.ts
9629
- var FRAGMENT29 = `
9643
+ var FRAGMENT30 = `
9630
9644
  fragment LightningFeeEstimateOutputFragment on LightningFeeEstimateOutput {
9631
9645
  __typename
9632
9646
  lightning_fee_estimate_output_fee_estimate: fee_estimate {
@@ -9710,7 +9724,7 @@ var LightningTransactionFromJson = (obj) => {
9710
9724
  `Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
9711
9725
  );
9712
9726
  };
9713
- var FRAGMENT30 = `
9727
+ var FRAGMENT31 = `
9714
9728
  fragment LightningTransactionFragment on LightningTransaction {
9715
9729
  __typename
9716
9730
  ... on IncomingPayment {
@@ -10144,7 +10158,7 @@ query GetLightningTransaction($id: ID!) {
10144
10158
  }
10145
10159
  }
10146
10160
 
10147
- ${FRAGMENT30}
10161
+ ${FRAGMENT31}
10148
10162
  `,
10149
10163
  variables: { id },
10150
10164
  constructObject: (data) => isObject26(data) && "entity" in data && isObject26(data.entity) ? LightningTransactionFromJson(data.entity) : null
@@ -10181,7 +10195,7 @@ var LightsparkNodeOwnerFromJson = (obj) => {
10181
10195
  `Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
10182
10196
  );
10183
10197
  };
10184
- var FRAGMENT31 = `
10198
+ var FRAGMENT32 = `
10185
10199
  fragment LightsparkNodeOwnerFragment on LightsparkNodeOwner {
10186
10200
  __typename
10187
10201
  ... on Account {
@@ -10242,7 +10256,7 @@ query GetLightsparkNodeOwner($id: ID!) {
10242
10256
  }
10243
10257
  }
10244
10258
 
10245
- ${FRAGMENT31}
10259
+ ${FRAGMENT32}
10246
10260
  `,
10247
10261
  variables: { id },
10248
10262
  constructObject: (data) => isObject27(data) && "entity" in data && isObject27(data.entity) ? LightsparkNodeOwnerFromJson(data.entity) : null
@@ -10263,7 +10277,7 @@ var OfferFromJson = (obj) => {
10263
10277
  description: obj["offer_description"]
10264
10278
  };
10265
10279
  };
10266
- var FRAGMENT32 = `
10280
+ var FRAGMENT33 = `
10267
10281
  fragment OfferFragment on Offer {
10268
10282
  __typename
10269
10283
  offer_id: id
@@ -10294,7 +10308,7 @@ query GetOffer($id: ID!) {
10294
10308
  }
10295
10309
  }
10296
10310
 
10297
- ${FRAGMENT32}
10311
+ ${FRAGMENT33}
10298
10312
  `,
10299
10313
  variables: { id },
10300
10314
  constructObject: (data) => isObject28(data) && "entity" in data && isObject28(data.entity) ? OfferFromJson(data.entity) : null
@@ -10317,7 +10331,7 @@ var OfferDataFromJson = (obj) => {
10317
10331
  expiresAt: obj["offer_data_expires_at"]
10318
10332
  };
10319
10333
  };
10320
- var FRAGMENT33 = `
10334
+ var FRAGMENT34 = `
10321
10335
  fragment OfferDataFragment on OfferData {
10322
10336
  __typename
10323
10337
  offer_data_id: id
@@ -10346,7 +10360,7 @@ query GetOfferData($id: ID!) {
10346
10360
  }
10347
10361
  }
10348
10362
 
10349
- ${FRAGMENT33}
10363
+ ${FRAGMENT34}
10350
10364
  `,
10351
10365
  variables: { id },
10352
10366
  constructObject: (data) => isObject29(data) && "entity" in data && isObject29(data.entity) ? OfferDataFromJson(data.entity) : null
@@ -10444,7 +10458,7 @@ var OnChainTransactionFromJson = (obj) => {
10444
10458
  `Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
10445
10459
  );
10446
10460
  };
10447
- var FRAGMENT34 = `
10461
+ var FRAGMENT35 = `
10448
10462
  fragment OnChainTransactionFragment on OnChainTransaction {
10449
10463
  __typename
10450
10464
  ... on ChannelClosingTransaction {
@@ -10587,7 +10601,7 @@ query GetOnChainTransaction($id: ID!) {
10587
10601
  }
10588
10602
  }
10589
10603
 
10590
- ${FRAGMENT34}
10604
+ ${FRAGMENT35}
10591
10605
  `,
10592
10606
  variables: { id },
10593
10607
  constructObject: (data) => isObject30(data) && "entity" in data && isObject30(data.entity) ? OnChainTransactionFromJson(data.entity) : null
@@ -10648,7 +10662,7 @@ var RoutingTransactionFromJson = (obj) => {
10648
10662
  failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
10649
10663
  };
10650
10664
  };
10651
- var FRAGMENT35 = `
10665
+ var FRAGMENT36 = `
10652
10666
  fragment RoutingTransactionFragment on RoutingTransaction {
10653
10667
  __typename
10654
10668
  routing_transaction_id: id
@@ -10696,7 +10710,7 @@ query GetRoutingTransaction($id: ID!) {
10696
10710
  }
10697
10711
  }
10698
10712
 
10699
- ${FRAGMENT35}
10713
+ ${FRAGMENT36}
10700
10714
  `,
10701
10715
  variables: { id },
10702
10716
  constructObject: (data) => isObject31(data) && "entity" in data && isObject31(data.entity) ? RoutingTransactionFromJson(data.entity) : null
@@ -10713,7 +10727,7 @@ var SignableFromJson = (obj) => {
10713
10727
  typename: "Signable"
10714
10728
  };
10715
10729
  };
10716
- var FRAGMENT36 = `
10730
+ var FRAGMENT37 = `
10717
10731
  fragment SignableFragment on Signable {
10718
10732
  __typename
10719
10733
  signable_id: id
@@ -10731,7 +10745,7 @@ query GetSignable($id: ID!) {
10731
10745
  }
10732
10746
  }
10733
10747
 
10734
- ${FRAGMENT36}
10748
+ ${FRAGMENT37}
10735
10749
  `,
10736
10750
  variables: { id },
10737
10751
  constructObject: (data) => isObject32(data) && "entity" in data && isObject32(data.entity) ? SignableFromJson(data.entity) : null
@@ -10768,7 +10782,7 @@ var TransactionUpdateFromJson = (obj) => {
10768
10782
  transactionHash: obj["transaction_hash"]
10769
10783
  };
10770
10784
  };
10771
- var FRAGMENT37 = `
10785
+ var FRAGMENT38 = `
10772
10786
  fragment TransactionUpdateFragment on Transaction {
10773
10787
  __typename
10774
10788
  id
@@ -10801,7 +10815,7 @@ var UmaCurrencyFromJson = (obj) => {
10801
10815
  typename: "UmaCurrency"
10802
10816
  };
10803
10817
  };
10804
- var FRAGMENT38 = `
10818
+ var FRAGMENT39 = `
10805
10819
  fragment UmaCurrencyFragment on UmaCurrency {
10806
10820
  __typename
10807
10821
  uma_currency_id: id
@@ -10823,7 +10837,7 @@ query GetUmaCurrency($id: ID!) {
10823
10837
  }
10824
10838
  }
10825
10839
 
10826
- ${FRAGMENT38}
10840
+ ${FRAGMENT39}
10827
10841
  `,
10828
10842
  variables: { id },
10829
10843
  constructObject: (data) => isObject33(data) && "entity" in data && isObject33(data.entity) ? UmaCurrencyFromJson(data.entity) : null
@@ -10872,7 +10886,7 @@ var UmaInvitationFromJson = (obj) => {
10872
10886
  expiresAt: obj["uma_invitation_expires_at"]
10873
10887
  };
10874
10888
  };
10875
- var FRAGMENT39 = `
10889
+ var FRAGMENT40 = `
10876
10890
  fragment UmaInvitationFragment on UmaInvitation {
10877
10891
  __typename
10878
10892
  uma_invitation_id: id
@@ -10907,7 +10921,7 @@ query GetUmaInvitation($id: ID!) {
10907
10921
  }
10908
10922
  }
10909
10923
 
10910
- ${FRAGMENT39}
10924
+ ${FRAGMENT40}
10911
10925
  `,
10912
10926
  variables: { id },
10913
10927
  constructObject: (data) => isObject34(data) && "entity" in data && isObject34(data.entity) ? UmaInvitationFromJson(data.entity) : null
@@ -10945,7 +10959,7 @@ var WithdrawalFeeEstimateOutputFromJson = (obj) => {
10945
10959
  )
10946
10960
  };
10947
10961
  };
10948
- var FRAGMENT40 = `
10962
+ var FRAGMENT41 = `
10949
10963
  fragment WithdrawalFeeEstimateOutputFragment on WithdrawalFeeEstimateOutput {
10950
10964
  __typename
10951
10965
  withdrawal_fee_estimate_output_fee_estimate: fee_estimate {
@@ -10964,7 +10978,7 @@ export {
10964
10978
  CurrencyAmountFromJson,
10965
10979
  FRAGMENT2 as FRAGMENT,
10966
10980
  FeeEstimateFromJson,
10967
- FRAGMENT27 as FRAGMENT2,
10981
+ FRAGMENT28 as FRAGMENT2,
10968
10982
  NodeAddressType_default,
10969
10983
  GraphNode_default,
10970
10984
  LightsparkNodeStatus_default,
@@ -10978,14 +10992,14 @@ export {
10978
10992
  FRAGMENT9 as FRAGMENT3,
10979
10993
  PaymentRequestStatus_default,
10980
10994
  InvoiceFromJson,
10981
- FRAGMENT28 as FRAGMENT4,
10995
+ FRAGMENT29 as FRAGMENT4,
10982
10996
  getInvoiceQuery,
10983
10997
  IncentivesIneligibilityReason_default,
10984
10998
  IncentivesStatus_default,
10985
10999
  getUmaCurrencyQuery,
10986
11000
  UmaInvitationStatus_default,
10987
11001
  UmaInvitationFromJson,
10988
- FRAGMENT39 as FRAGMENT5,
11002
+ FRAGMENT40 as FRAGMENT5,
10989
11003
  getUmaInvitationQuery,
10990
11004
  Permission_default,
10991
11005
  ApiTokenFromJson,
@@ -10997,17 +11011,19 @@ export {
10997
11011
  IncomingPaymentFromJson,
10998
11012
  FRAGMENT12 as FRAGMENT7,
10999
11013
  IncomingPayment_default,
11000
- FRAGMENT29 as FRAGMENT8,
11014
+ FailHtlcsOutputFromJson,
11015
+ FRAGMENT27 as FRAGMENT8,
11016
+ FRAGMENT30 as FRAGMENT9,
11001
11017
  HtlcAttemptFailureCode_default,
11002
11018
  OutgoingPaymentAttemptStatus_default,
11003
11019
  getHopQuery,
11004
11020
  OutgoingPaymentAttempt_default,
11005
11021
  PaymentFailureReason_default,
11006
11022
  OutgoingPaymentFromJson,
11007
- FRAGMENT15 as FRAGMENT9,
11023
+ FRAGMENT15 as FRAGMENT10,
11008
11024
  OutgoingPayment_default,
11009
11025
  PaymentRequestFromJson,
11010
- FRAGMENT10,
11026
+ FRAGMENT10 as FRAGMENT11,
11011
11027
  getPaymentRequestQuery,
11012
11028
  RequestInitiator_default,
11013
11029
  WithdrawalMode_default,
@@ -11016,16 +11032,16 @@ export {
11016
11032
  getChannelOpeningTransactionQuery,
11017
11033
  getWithdrawalQuery,
11018
11034
  WithdrawalRequestFromJson,
11019
- FRAGMENT20 as FRAGMENT11,
11035
+ FRAGMENT20 as FRAGMENT12,
11020
11036
  WithdrawalRequest_default,
11021
11037
  RoutingTransactionFailureReason_default,
11022
11038
  TransactionFromJson,
11023
- FRAGMENT16 as FRAGMENT12,
11039
+ FRAGMENT16 as FRAGMENT13,
11024
11040
  getTransactionQuery,
11025
11041
  TransactionUpdateFromJson,
11026
- FRAGMENT37 as FRAGMENT13,
11042
+ FRAGMENT38 as FRAGMENT14,
11027
11043
  WithdrawalFeeEstimateOutputFromJson,
11028
- FRAGMENT40 as FRAGMENT14,
11044
+ FRAGMENT41 as FRAGMENT15,
11029
11045
  getLightsparkNodeQuery,
11030
11046
  WalletStatus_default,
11031
11047
  Wallet_default,
@@ -1618,6 +1618,10 @@ interface CreateApiTokenOutput {
1618
1618
  clientSecret: string;
1619
1619
  }
1620
1620
 
1621
+ interface FailHtlcsOutput {
1622
+ invoiceId: string;
1623
+ }
1624
+
1621
1625
  /**
1622
1626
  * This object represents the estimated L1 transaction fees for the Bitcoin network. Fee estimates
1623
1627
  * are separated by potential confirmation speeds for settlement. *
@@ -3202,9 +3206,11 @@ declare class LightsparkClient {
3202
3206
  * to create an [AMP invoice](https://docs.lightning.engineering/lightning-network-tools/lnd/amp), which can be
3203
3207
  * paid multiple times.
3204
3208
  * @param expirySecs The number of seconds until the invoice expires. Defaults to 86400 (1 day).
3209
+ * @param paymentHash An optional payment hash to use for the invoice.
3210
+ * @param preimageNonce An optional 32 byte nonce used to generate the payment hash.
3205
3211
  * @returns An Invoice object, or undefined if the invoice could not be created.
3206
3212
  */
3207
- createInvoiceWithDetails(nodeId: string, amountMsats: number, memo: string, type?: InvoiceType | undefined, expirySecs?: number | undefined): Promise<Invoice | undefined>;
3213
+ createInvoiceWithDetails(nodeId: string, amountMsats: number, memo: string, type?: InvoiceType | undefined, expirySecs?: number | undefined, paymentHash?: string | undefined, preimageNonce?: string | undefined): Promise<Invoice | undefined>;
3208
3214
  /**
3209
3215
  * Creates an offer for the given node.
3210
3216
  *
@@ -3259,6 +3265,14 @@ declare class LightsparkClient {
3259
3265
  * @returns The cancelled invoice, or undefined if the invoice could not be cancelled.
3260
3266
  */
3261
3267
  cancelInvoice(invoiceId: string): Promise<Invoice | undefined>;
3268
+ /**
3269
+ * Fails all pending HTLCs (Hash Time Locked Contracts) for a given invoice.
3270
+ *
3271
+ * @param invoiceId The ID of the invoice for which to fail HTLCs.
3272
+ * @param cancelInvoice Whether to also cancel the invoice after failing the HTLCs.
3273
+ * @returns The output containing the invoice ID, or undefined if the operation failed.
3274
+ */
3275
+ failHtlcs(invoiceId: string, cancelInvoice: boolean): Promise<FailHtlcsOutput | undefined>;
3262
3276
  /**
3263
3277
  * Decodes an encoded lightning invoice string.
3264
3278
  *
@@ -3419,7 +3433,7 @@ declare class LightsparkClient {
3419
3433
  * @param bitcoinAddress The Bitcoin address to withdraw funds to.
3420
3434
  * @param mode The mode to use for the withdrawal. See `WithdrawalMode` for more information.
3421
3435
  */
3422
- requestWithdrawal(nodeId: string, amountSats: number, bitcoinAddress: string, mode: WithdrawalMode): Promise<WithdrawalRequest>;
3436
+ requestWithdrawal(nodeId: string, amountSats: number, bitcoinAddress: string, mode: WithdrawalMode, idempotencyKey?: string | undefined): Promise<WithdrawalRequest>;
3423
3437
  /**
3424
3438
  * Adds funds to a Lightspark node on the REGTEST network.
3425
3439
  * If the amount is not specified, 10,000,000 SATOSHI will be added.
@@ -4053,10 +4067,6 @@ interface FailHtlcsInput {
4053
4067
  cancelInvoice: boolean;
4054
4068
  }
4055
4069
 
4056
- interface FailHtlcsOutput {
4057
- invoiceId: string;
4058
- }
4059
-
4060
4070
  interface FundNodeInput {
4061
4071
  nodeId: string;
4062
4072
  amountSats?: number | undefined;
@@ -1618,6 +1618,10 @@ interface CreateApiTokenOutput {
1618
1618
  clientSecret: string;
1619
1619
  }
1620
1620
 
1621
+ interface FailHtlcsOutput {
1622
+ invoiceId: string;
1623
+ }
1624
+
1621
1625
  /**
1622
1626
  * This object represents the estimated L1 transaction fees for the Bitcoin network. Fee estimates
1623
1627
  * are separated by potential confirmation speeds for settlement. *
@@ -3202,9 +3206,11 @@ declare class LightsparkClient {
3202
3206
  * to create an [AMP invoice](https://docs.lightning.engineering/lightning-network-tools/lnd/amp), which can be
3203
3207
  * paid multiple times.
3204
3208
  * @param expirySecs The number of seconds until the invoice expires. Defaults to 86400 (1 day).
3209
+ * @param paymentHash An optional payment hash to use for the invoice.
3210
+ * @param preimageNonce An optional 32 byte nonce used to generate the payment hash.
3205
3211
  * @returns An Invoice object, or undefined if the invoice could not be created.
3206
3212
  */
3207
- createInvoiceWithDetails(nodeId: string, amountMsats: number, memo: string, type?: InvoiceType | undefined, expirySecs?: number | undefined): Promise<Invoice | undefined>;
3213
+ createInvoiceWithDetails(nodeId: string, amountMsats: number, memo: string, type?: InvoiceType | undefined, expirySecs?: number | undefined, paymentHash?: string | undefined, preimageNonce?: string | undefined): Promise<Invoice | undefined>;
3208
3214
  /**
3209
3215
  * Creates an offer for the given node.
3210
3216
  *
@@ -3259,6 +3265,14 @@ declare class LightsparkClient {
3259
3265
  * @returns The cancelled invoice, or undefined if the invoice could not be cancelled.
3260
3266
  */
3261
3267
  cancelInvoice(invoiceId: string): Promise<Invoice | undefined>;
3268
+ /**
3269
+ * Fails all pending HTLCs (Hash Time Locked Contracts) for a given invoice.
3270
+ *
3271
+ * @param invoiceId The ID of the invoice for which to fail HTLCs.
3272
+ * @param cancelInvoice Whether to also cancel the invoice after failing the HTLCs.
3273
+ * @returns The output containing the invoice ID, or undefined if the operation failed.
3274
+ */
3275
+ failHtlcs(invoiceId: string, cancelInvoice: boolean): Promise<FailHtlcsOutput | undefined>;
3262
3276
  /**
3263
3277
  * Decodes an encoded lightning invoice string.
3264
3278
  *
@@ -3419,7 +3433,7 @@ declare class LightsparkClient {
3419
3433
  * @param bitcoinAddress The Bitcoin address to withdraw funds to.
3420
3434
  * @param mode The mode to use for the withdrawal. See `WithdrawalMode` for more information.
3421
3435
  */
3422
- requestWithdrawal(nodeId: string, amountSats: number, bitcoinAddress: string, mode: WithdrawalMode): Promise<WithdrawalRequest>;
3436
+ requestWithdrawal(nodeId: string, amountSats: number, bitcoinAddress: string, mode: WithdrawalMode, idempotencyKey?: string | undefined): Promise<WithdrawalRequest>;
3423
3437
  /**
3424
3438
  * Adds funds to a Lightspark node on the REGTEST network.
3425
3439
  * If the amount is not specified, 10,000,000 SATOSHI will be added.
@@ -4053,10 +4067,6 @@ interface FailHtlcsInput {
4053
4067
  cancelInvoice: boolean;
4054
4068
  }
4055
4069
 
4056
- interface FailHtlcsOutput {
4057
- invoiceId: string;
4058
- }
4059
-
4060
4070
  interface FundNodeInput {
4061
4071
  nodeId: string;
4062
4072
  amountSats?: number | undefined;