@lightsparkdev/lightspark-sdk 1.6.0 → 1.7.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/dist/index.js CHANGED
@@ -53,6 +53,7 @@ import {
53
53
  Permission_default,
54
54
  RegionCode_default,
55
55
  RemoteSigningSubEventType_default,
56
+ RequestInitiator_default,
56
57
  RiskRating_default,
57
58
  RoutingTransactionFailureReason_default,
58
59
  SignablePayloadStatus_default,
@@ -92,7 +93,7 @@ import {
92
93
  getTransactionQuery,
93
94
  getUmaInvitationQuery,
94
95
  getWithdrawalQuery
95
- } from "./chunk-UHTZSOPX.js";
96
+ } from "./chunk-DSWMAFFH.js";
96
97
  import {
97
98
  BitcoinNetwork_default
98
99
  } from "./chunk-K6SAUSAX.js";
@@ -141,6 +142,7 @@ import {
141
142
  Requester,
142
143
  SigningKeyType as SigningKeyType2,
143
144
  StubAuthProvider,
145
+ bytesToHex,
144
146
  createSha256Hash,
145
147
  pollUntil
146
148
  } from "@lightsparkdev/core";
@@ -148,7 +150,7 @@ import {
148
150
  // package.json
149
151
  var package_default = {
150
152
  name: "@lightsparkdev/lightspark-sdk",
151
- version: "1.6.0",
153
+ version: "1.7.0",
152
154
  description: "Lightspark JS SDK",
153
155
  author: "Lightspark Inc.",
154
156
  keywords: [
@@ -679,12 +681,14 @@ mutation CreateUmaInvoice(
679
681
  $amount_msats: Long!
680
682
  $metadata_hash: String!
681
683
  $expiry_secs: Int = null
684
+ $receiver_hash: String = null
682
685
  ) {
683
686
  create_uma_invoice(input: {
684
687
  node_id: $node_id
685
688
  amount_msats: $amount_msats
686
689
  metadata_hash: $metadata_hash
687
690
  expiry_secs: $expiry_secs
691
+ receiver_hash: $receiver_hash
688
692
  }) {
689
693
  invoice {
690
694
  ...InvoiceFragment
@@ -932,6 +936,7 @@ var PayUmaInvoice = `
932
936
  $timeout_secs: Int!
933
937
  $maximum_fees_msats: Long!
934
938
  $amount_msats: Long
939
+ $sender_hash: String = null
935
940
  ) {
936
941
  pay_uma_invoice(
937
942
  input: {
@@ -940,6 +945,7 @@ var PayUmaInvoice = `
940
945
  timeout_secs: $timeout_secs
941
946
  maximum_fees_msats: $maximum_fees_msats
942
947
  amount_msats: $amount_msats
948
+ sender_hash: $sender_hash
943
949
  }
944
950
  ) {
945
951
  payment {
@@ -1632,16 +1638,35 @@ var LightsparkClient = class {
1632
1638
  * h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice. See
1633
1639
  * [this spec](https://github.com/lnurl/luds/blob/luds/06.md#pay-to-static-qrnfclink) for details.
1634
1640
  * @param expirySecs The number of seconds until the invoice expires. Defaults to 3600 (1 hour).
1641
+ * @param signingPrivateKey The receiver's signing private key. Used to hash the receiver identifier.
1642
+ * @param receiverIdentifier Optional identifier of the receiver. If provided, this will be hashed using a
1643
+ * monthly-rotated seed and used for anonymized analysis.
1635
1644
  * @returns An Invoice object representing the generated invoice.
1636
1645
  */
1637
- async createUmaInvoice(nodeId, amountMsats, metadata, expirySecs = void 0) {
1646
+ async createUmaInvoice(nodeId, amountMsats, metadata, expirySecs = void 0, signingPrivateKey = void 0, receiverIdentifier = void 0) {
1638
1647
  const metadataHash = await createSha256Hash(metadata, true);
1648
+ let receiverHash = void 0;
1649
+ if (receiverIdentifier !== void 0) {
1650
+ if (signingPrivateKey == void 0) {
1651
+ throw new LightsparkException(
1652
+ "CreateUmaInvoiceError",
1653
+ "Receiver identifier provided without signing private key"
1654
+ );
1655
+ }
1656
+ receiverHash = await this.hashUmaIdentifier(
1657
+ receiverIdentifier,
1658
+ signingPrivateKey
1659
+ );
1660
+ }
1639
1661
  const variables = {
1640
1662
  node_id: nodeId,
1641
1663
  amount_msats: amountMsats,
1642
1664
  metadata_hash: metadataHash,
1643
1665
  expiry_secs: expirySecs !== void 0 ? expirySecs : 3600
1644
1666
  };
1667
+ if (receiverHash !== void 0) {
1668
+ variables.receiver_hash = receiverHash;
1669
+ }
1645
1670
  const response = await this.requester.makeRawRequest(
1646
1671
  CreateUmaInvoice,
1647
1672
  variables
@@ -1847,12 +1872,28 @@ var LightsparkClient = class {
1847
1872
  * @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
1848
1873
  * invoice. NOTE: This parameter can only be passed for a zero-amount
1849
1874
  * invoice. Otherwise, the call will fail.
1875
+ * @param signingPrivateKey The sender's signing private key. Used to hash the sender identifier.
1876
+ * @param senderIdentifier Optional identifier of the sender. If provided, this will be hashed using a
1877
+ * monthly-rotated seed and used for anonymized analysis.
1850
1878
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
1851
1879
  */
1852
- async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
1880
+ async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0, signingPrivateKey = void 0, senderIdentifier = void 0) {
1853
1881
  if (!this.nodeKeyCache.hasKey(payerNodeId)) {
1854
1882
  throw new LightsparkSigningException3("Paying node is not unlocked");
1855
1883
  }
1884
+ let senderHash = void 0;
1885
+ if (senderIdentifier !== void 0) {
1886
+ if (signingPrivateKey == void 0) {
1887
+ throw new LightsparkException(
1888
+ "PayUmaInvoiceError",
1889
+ "Sender identifier provided without signing private key"
1890
+ );
1891
+ }
1892
+ senderHash = await this.hashUmaIdentifier(
1893
+ senderIdentifier,
1894
+ signingPrivateKey
1895
+ );
1896
+ }
1856
1897
  const variables = {
1857
1898
  node_id: payerNodeId,
1858
1899
  encoded_invoice: encodedInvoice,
@@ -1862,6 +1903,9 @@ var LightsparkClient = class {
1862
1903
  if (amountMsats !== void 0) {
1863
1904
  variables.amount_msats = amountMsats;
1864
1905
  }
1906
+ if (senderHash !== void 0) {
1907
+ variables.sender_hash = senderHash;
1908
+ }
1865
1909
  const response = await this.requester.makeRawRequest(
1866
1910
  PayUmaInvoice,
1867
1911
  variables,
@@ -2351,6 +2395,14 @@ var LightsparkClient = class {
2351
2395
  }
2352
2396
  return await createSha256Hash(e164PhoneNumber, true);
2353
2397
  }
2398
+ async hashUmaIdentifier(identifier, signingPrivateKey) {
2399
+ const now = this.getUtcDateTime();
2400
+ const input = identifier + `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` + bytesToHex(signingPrivateKey);
2401
+ return await createSha256Hash(input, true);
2402
+ }
2403
+ getUtcDateTime() {
2404
+ return /* @__PURE__ */ new Date();
2405
+ }
2354
2406
  /**
2355
2407
  * Executes a raw `Query` against the Lightspark API.
2356
2408
  *
@@ -2460,6 +2512,7 @@ export {
2460
2512
  RegionCode_default as RegionCode,
2461
2513
  RemoteSigningSubEventType_default as RemoteSigningSubEventType,
2462
2514
  RemoteSigningWebhookHandler,
2515
+ RequestInitiator_default as RequestInitiator,
2463
2516
  RiskRating_default as RiskRating,
2464
2517
  RoutingTransactionFailureReason_default as RoutingTransactionFailureReason,
2465
2518
  SignablePayloadStatus_default as SignablePayloadStatus,
@@ -48,6 +48,7 @@ __export(objects_exports, {
48
48
  Permission: () => Permission_default,
49
49
  RegionCode: () => RegionCode_default,
50
50
  RemoteSigningSubEventType: () => RemoteSigningSubEventType_default,
51
+ RequestInitiator: () => RequestInitiator_default,
51
52
  RiskRating: () => RiskRating_default,
52
53
  RoutingTransactionFailureReason: () => RoutingTransactionFailureReason_default,
53
54
  SignablePayloadStatus: () => SignablePayloadStatus_default,
@@ -4815,6 +4816,15 @@ var WalletToTransactionsConnectionFromJson = (obj) => {
4815
4816
  };
4816
4817
  };
4817
4818
 
4819
+ // src/objects/RequestInitiator.ts
4820
+ var RequestInitiator = /* @__PURE__ */ ((RequestInitiator2) => {
4821
+ RequestInitiator2["FUTURE_VALUE"] = "FUTURE_VALUE";
4822
+ RequestInitiator2["CUSTOMER"] = "CUSTOMER";
4823
+ RequestInitiator2["LIGHTSPARK"] = "LIGHTSPARK";
4824
+ return RequestInitiator2;
4825
+ })(RequestInitiator || {});
4826
+ var RequestInitiator_default = RequestInitiator;
4827
+
4818
4828
  // src/objects/WithdrawalMode.ts
4819
4829
  var WithdrawalMode = /* @__PURE__ */ ((WithdrawalMode2) => {
4820
4830
  WithdrawalMode2["FUTURE_VALUE"] = "FUTURE_VALUE";
@@ -5083,7 +5093,7 @@ var WithdrawalRequestToWithdrawalsConnectionFromJson = (obj) => {
5083
5093
 
5084
5094
  // src/objects/WithdrawalRequest.ts
5085
5095
  var WithdrawalRequest = class {
5086
- constructor(id, createdAt, updatedAt, requestedAmount, amount, bitcoinAddress, withdrawalMode, status, typename, estimatedAmount, amountWithdrawn, totalFees, completedAt, withdrawalId, idempotencyKey) {
5096
+ constructor(id, createdAt, updatedAt, requestedAmount, amount, bitcoinAddress, withdrawalMode, status, initiator, typename, estimatedAmount, amountWithdrawn, totalFees, completedAt, withdrawalId, idempotencyKey) {
5087
5097
  this.id = id;
5088
5098
  this.createdAt = createdAt;
5089
5099
  this.updatedAt = updatedAt;
@@ -5092,6 +5102,7 @@ var WithdrawalRequest = class {
5092
5102
  this.bitcoinAddress = bitcoinAddress;
5093
5103
  this.withdrawalMode = withdrawalMode;
5094
5104
  this.status = status;
5105
+ this.initiator = initiator;
5095
5106
  this.typename = typename;
5096
5107
  this.estimatedAmount = estimatedAmount;
5097
5108
  this.amountWithdrawn = amountWithdrawn;
@@ -5313,7 +5324,8 @@ ${FRAGMENT18}
5313
5324
  withdrawal_request_status: this.status,
5314
5325
  withdrawal_request_completed_at: this.completedAt,
5315
5326
  withdrawal_request_withdrawal: { id: this.withdrawalId },
5316
- withdrawal_request_idempotency_key: this.idempotencyKey
5327
+ withdrawal_request_idempotency_key: this.idempotencyKey,
5328
+ withdrawal_request_initiator: this.initiator
5317
5329
  };
5318
5330
  }
5319
5331
  };
@@ -5327,6 +5339,7 @@ var WithdrawalRequestFromJson = (obj) => {
5327
5339
  obj["withdrawal_request_bitcoin_address"],
5328
5340
  WithdrawalMode_default[obj["withdrawal_request_withdrawal_mode"]] ?? WithdrawalMode_default.FUTURE_VALUE,
5329
5341
  WithdrawalRequestStatus_default[obj["withdrawal_request_status"]] ?? WithdrawalRequestStatus_default.FUTURE_VALUE,
5342
+ RequestInitiator_default[obj["withdrawal_request_initiator"]] ?? RequestInitiator_default.FUTURE_VALUE,
5330
5343
  "WithdrawalRequest",
5331
5344
  !!obj["withdrawal_request_estimated_amount"] ? CurrencyAmountFromJson(obj["withdrawal_request_estimated_amount"]) : void 0,
5332
5345
  !!obj["withdrawal_request_amount_withdrawn"] ? CurrencyAmountFromJson(obj["withdrawal_request_amount_withdrawn"]) : void 0,
@@ -5390,6 +5403,7 @@ fragment WithdrawalRequestFragment on WithdrawalRequest {
5390
5403
  id
5391
5404
  }
5392
5405
  withdrawal_request_idempotency_key: idempotency_key
5406
+ withdrawal_request_initiator: initiator
5393
5407
  }`;
5394
5408
  var WithdrawalRequest_default = WithdrawalRequest;
5395
5409
 
@@ -6448,6 +6462,7 @@ query FetchWalletToWithdrawalRequestsConnection($entity_id: ID!, $first: Int, $a
6448
6462
  id
6449
6463
  }
6450
6464
  withdrawal_request_idempotency_key: idempotency_key
6465
+ withdrawal_request_initiator: initiator
6451
6466
  }
6452
6467
  }
6453
6468
  }
@@ -8265,6 +8280,7 @@ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $b
8265
8280
  id
8266
8281
  }
8267
8282
  withdrawal_request_idempotency_key: idempotency_key
8283
+ withdrawal_request_initiator: initiator
8268
8284
  }
8269
8285
  }
8270
8286
  }
@@ -10410,6 +10426,7 @@ var WebhookEventType_default = WebhookEventType;
10410
10426
  Permission,
10411
10427
  RegionCode,
10412
10428
  RemoteSigningSubEventType,
10429
+ RequestInitiator,
10413
10430
  RiskRating,
10414
10431
  RoutingTransactionFailureReason,
10415
10432
  SignablePayloadStatus,
@@ -1,4 +1,4 @@
1
- export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as AccountToWithdrawalRequestsConnection, h as ApiToken, j as AuditLogActor, B as Balances, l as BlockchainBalance, C as CancelInvoiceInput, m as CancelInvoiceOutput, n as Channel, o as ChannelClosingTransaction, q as ChannelFees, r as ChannelOpeningTransaction, t as ChannelSnapshot, v as ChannelStatus, w as ChannelToTransactionsConnection, x as ClaimUmaInvitationInput, y as ClaimUmaInvitationOutput, z as ClaimUmaInvitationWithIncentivesInput, D as ClaimUmaInvitationWithIncentivesOutput, E as ComplianceProvider, F as Connection, G as CreateApiTokenInput, H as CreateApiTokenOutput, I as CreateInvitationWithIncentivesInput, J as CreateInvitationWithIncentivesOutput, K as CreateInvoiceInput, M as CreateInvoiceOutput, N as CreateLnurlInvoiceInput, O as CreateNodeWalletAddressInput, P as CreateNodeWalletAddressOutput, Q as CreateTestModeInvoiceInput, R as CreateTestModeInvoiceOutput, S as CreateTestModePaymentInput, T as CreateTestModePaymentoutput, U as CreateUmaInvitationInput, V as CreateUmaInvitationOutput, X as CreateUmaInvoiceInput, Y as CurrencyAmount, Z as CurrencyUnit, _ as DailyLiquidityForecast, $ as DeclineToSignMessagesInput, a0 as DeclineToSignMessagesOutput, a1 as DeleteApiTokenInput, a2 as DeleteApiTokenOutput, a3 as Deposit, a5 as Entity, a6 as FailHtlcsInput, a7 as FailHtlcsOutput, a8 as FeeEstimate, a9 as FundNodeInput, aa as FundNodeOutput, ab as GraphNode, ac as Hop, ae as HtlcAttemptFailureCode, af as IdAndSignature, ag as IncentivesIneligibilityReason, ah as IncentivesStatus, ai as IncomingPayment, aj as IncomingPaymentAttempt, al as IncomingPaymentAttemptStatus, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestWithdrawalInput, bn as RequestWithdrawalOutput, bo as RichText, bp as RiskRating, bq as RoutingTransaction, bs as RoutingTransactionFailureReason, bt as ScreenNodeInput, bu as ScreenNodeOutput, bv as Secret, bw as SendPaymentInput, bx as SendPaymentOutput, by as SetInvoicePaymentHashInput, bz as SetInvoicePaymentHashOutput, bA as SignInvoiceInput, bB as SignInvoiceOutput, bC as SignMessagesInput, bD as SignMessagesOutput, bE as Signable, bG as SignablePayload, bI as SignablePayloadStatus, bJ as SingleNodeDashboard, bK as Transaction, bM as TransactionFailures, bN as TransactionStatus, bO as TransactionType, bP as TransactionUpdate, bQ as UmaInvitation, bS as UpdateChannelPerCommitmentPointInput, bT as UpdateChannelPerCommitmentPointOutput, bU as UpdateNodeSharedSecretInput, bV as UpdateNodeSharedSecretOutput, bW as Wallet, bX as WalletStatus, bY as WalletToPaymentRequestsConnection, bZ as WalletToTransactionsConnection, b_ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, b$ as Withdrawal, c1 as WithdrawalFeeEstimateInput, c2 as WithdrawalFeeEstimateOutput, c3 as WithdrawalMode, c4 as WithdrawalRequest, c5 as WithdrawalRequestStatus, c6 as WithdrawalRequestToChannelClosingTransactionsConnection, c7 as WithdrawalRequestToChannelOpeningTransactionsConnection, c8 as WithdrawalRequestToWithdrawalsConnection, i as getApiTokenQuery, k as getAuditLogActorQuery, p as getChannelClosingTransactionQuery, s as getChannelOpeningTransactionQuery, u as getChannelSnapshotQuery, a4 as getDepositQuery, ad as getHopQuery, ak as getIncomingPaymentAttemptQuery, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, br as getRoutingTransactionQuery, bH as getSignablePayloadQuery, bF as getSignableQuery, bL as getTransactionQuery, bR as getUmaInvitationQuery, c0 as getWithdrawalQuery } from '../index-145ff316.js';
1
+ export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as AccountToWithdrawalRequestsConnection, h as ApiToken, j as AuditLogActor, B as Balances, l as BlockchainBalance, C as CancelInvoiceInput, m as CancelInvoiceOutput, n as Channel, o as ChannelClosingTransaction, q as ChannelFees, r as ChannelOpeningTransaction, t as ChannelSnapshot, v as ChannelStatus, w as ChannelToTransactionsConnection, x as ClaimUmaInvitationInput, y as ClaimUmaInvitationOutput, z as ClaimUmaInvitationWithIncentivesInput, D as ClaimUmaInvitationWithIncentivesOutput, E as ComplianceProvider, F as Connection, G as CreateApiTokenInput, H as CreateApiTokenOutput, I as CreateInvitationWithIncentivesInput, J as CreateInvitationWithIncentivesOutput, K as CreateInvoiceInput, M as CreateInvoiceOutput, N as CreateLnurlInvoiceInput, O as CreateNodeWalletAddressInput, P as CreateNodeWalletAddressOutput, Q as CreateTestModeInvoiceInput, R as CreateTestModeInvoiceOutput, S as CreateTestModePaymentInput, T as CreateTestModePaymentoutput, U as CreateUmaInvitationInput, V as CreateUmaInvitationOutput, X as CreateUmaInvoiceInput, Y as CurrencyAmount, Z as CurrencyUnit, _ as DailyLiquidityForecast, $ as DeclineToSignMessagesInput, a0 as DeclineToSignMessagesOutput, a1 as DeleteApiTokenInput, a2 as DeleteApiTokenOutput, a3 as Deposit, a5 as Entity, a6 as FailHtlcsInput, a7 as FailHtlcsOutput, a8 as FeeEstimate, a9 as FundNodeInput, aa as FundNodeOutput, ab as GraphNode, ac as Hop, ae as HtlcAttemptFailureCode, af as IdAndSignature, ag as IncentivesIneligibilityReason, ah as IncentivesStatus, ai as IncomingPayment, aj as IncomingPaymentAttempt, al as IncomingPaymentAttemptStatus, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 as WithdrawalRequestToWithdrawalsConnection, i as getApiTokenQuery, k as getAuditLogActorQuery, p as getChannelClosingTransactionQuery, s as getChannelOpeningTransactionQuery, u as getChannelSnapshotQuery, a4 as getDepositQuery, ad as getHopQuery, ak as getIncomingPaymentAttemptQuery, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from '../index-2f0cac65.js';
2
2
  export { B as BitcoinNetwork } from '../BitcoinNetwork-4f6ea015.js';
3
3
  import '@lightsparkdev/core';
4
4
  import 'zen-observable';
@@ -1,4 +1,4 @@
1
- export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as AccountToWithdrawalRequestsConnection, h as ApiToken, j as AuditLogActor, B as Balances, l as BlockchainBalance, C as CancelInvoiceInput, m as CancelInvoiceOutput, n as Channel, o as ChannelClosingTransaction, q as ChannelFees, r as ChannelOpeningTransaction, t as ChannelSnapshot, v as ChannelStatus, w as ChannelToTransactionsConnection, x as ClaimUmaInvitationInput, y as ClaimUmaInvitationOutput, z as ClaimUmaInvitationWithIncentivesInput, D as ClaimUmaInvitationWithIncentivesOutput, E as ComplianceProvider, F as Connection, G as CreateApiTokenInput, H as CreateApiTokenOutput, I as CreateInvitationWithIncentivesInput, J as CreateInvitationWithIncentivesOutput, K as CreateInvoiceInput, M as CreateInvoiceOutput, N as CreateLnurlInvoiceInput, O as CreateNodeWalletAddressInput, P as CreateNodeWalletAddressOutput, Q as CreateTestModeInvoiceInput, R as CreateTestModeInvoiceOutput, S as CreateTestModePaymentInput, T as CreateTestModePaymentoutput, U as CreateUmaInvitationInput, V as CreateUmaInvitationOutput, X as CreateUmaInvoiceInput, Y as CurrencyAmount, Z as CurrencyUnit, _ as DailyLiquidityForecast, $ as DeclineToSignMessagesInput, a0 as DeclineToSignMessagesOutput, a1 as DeleteApiTokenInput, a2 as DeleteApiTokenOutput, a3 as Deposit, a5 as Entity, a6 as FailHtlcsInput, a7 as FailHtlcsOutput, a8 as FeeEstimate, a9 as FundNodeInput, aa as FundNodeOutput, ab as GraphNode, ac as Hop, ae as HtlcAttemptFailureCode, af as IdAndSignature, ag as IncentivesIneligibilityReason, ah as IncentivesStatus, ai as IncomingPayment, aj as IncomingPaymentAttempt, al as IncomingPaymentAttemptStatus, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestWithdrawalInput, bn as RequestWithdrawalOutput, bo as RichText, bp as RiskRating, bq as RoutingTransaction, bs as RoutingTransactionFailureReason, bt as ScreenNodeInput, bu as ScreenNodeOutput, bv as Secret, bw as SendPaymentInput, bx as SendPaymentOutput, by as SetInvoicePaymentHashInput, bz as SetInvoicePaymentHashOutput, bA as SignInvoiceInput, bB as SignInvoiceOutput, bC as SignMessagesInput, bD as SignMessagesOutput, bE as Signable, bG as SignablePayload, bI as SignablePayloadStatus, bJ as SingleNodeDashboard, bK as Transaction, bM as TransactionFailures, bN as TransactionStatus, bO as TransactionType, bP as TransactionUpdate, bQ as UmaInvitation, bS as UpdateChannelPerCommitmentPointInput, bT as UpdateChannelPerCommitmentPointOutput, bU as UpdateNodeSharedSecretInput, bV as UpdateNodeSharedSecretOutput, bW as Wallet, bX as WalletStatus, bY as WalletToPaymentRequestsConnection, bZ as WalletToTransactionsConnection, b_ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, b$ as Withdrawal, c1 as WithdrawalFeeEstimateInput, c2 as WithdrawalFeeEstimateOutput, c3 as WithdrawalMode, c4 as WithdrawalRequest, c5 as WithdrawalRequestStatus, c6 as WithdrawalRequestToChannelClosingTransactionsConnection, c7 as WithdrawalRequestToChannelOpeningTransactionsConnection, c8 as WithdrawalRequestToWithdrawalsConnection, i as getApiTokenQuery, k as getAuditLogActorQuery, p as getChannelClosingTransactionQuery, s as getChannelOpeningTransactionQuery, u as getChannelSnapshotQuery, a4 as getDepositQuery, ad as getHopQuery, ak as getIncomingPaymentAttemptQuery, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, br as getRoutingTransactionQuery, bH as getSignablePayloadQuery, bF as getSignableQuery, bL as getTransactionQuery, bR as getUmaInvitationQuery, c0 as getWithdrawalQuery } from '../index-145ff316.js';
1
+ export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as AccountToWithdrawalRequestsConnection, h as ApiToken, j as AuditLogActor, B as Balances, l as BlockchainBalance, C as CancelInvoiceInput, m as CancelInvoiceOutput, n as Channel, o as ChannelClosingTransaction, q as ChannelFees, r as ChannelOpeningTransaction, t as ChannelSnapshot, v as ChannelStatus, w as ChannelToTransactionsConnection, x as ClaimUmaInvitationInput, y as ClaimUmaInvitationOutput, z as ClaimUmaInvitationWithIncentivesInput, D as ClaimUmaInvitationWithIncentivesOutput, E as ComplianceProvider, F as Connection, G as CreateApiTokenInput, H as CreateApiTokenOutput, I as CreateInvitationWithIncentivesInput, J as CreateInvitationWithIncentivesOutput, K as CreateInvoiceInput, M as CreateInvoiceOutput, N as CreateLnurlInvoiceInput, O as CreateNodeWalletAddressInput, P as CreateNodeWalletAddressOutput, Q as CreateTestModeInvoiceInput, R as CreateTestModeInvoiceOutput, S as CreateTestModePaymentInput, T as CreateTestModePaymentoutput, U as CreateUmaInvitationInput, V as CreateUmaInvitationOutput, X as CreateUmaInvoiceInput, Y as CurrencyAmount, Z as CurrencyUnit, _ as DailyLiquidityForecast, $ as DeclineToSignMessagesInput, a0 as DeclineToSignMessagesOutput, a1 as DeleteApiTokenInput, a2 as DeleteApiTokenOutput, a3 as Deposit, a5 as Entity, a6 as FailHtlcsInput, a7 as FailHtlcsOutput, a8 as FeeEstimate, a9 as FundNodeInput, aa as FundNodeOutput, ab as GraphNode, ac as Hop, ae as HtlcAttemptFailureCode, af as IdAndSignature, ag as IncentivesIneligibilityReason, ah as IncentivesStatus, ai as IncomingPayment, aj as IncomingPaymentAttempt, al as IncomingPaymentAttemptStatus, am as IncomingPaymentToAttemptsConnection, an as IncomingPaymentsForInvoiceQueryInput, ao as IncomingPaymentsForInvoiceQueryOutput, ap as Invoice, ar as InvoiceData, as as InvoiceForPaymentHashInput, at as InvoiceForPaymentHashOutput, au as InvoiceType, av as LightningFeeEstimateForInvoiceInput, aw as LightningFeeEstimateForNodeInput, ax as LightningFeeEstimateOutput, ay as LightningPaymentDirection, az as LightningTransaction, aB as LightsparkNode, aD as LightsparkNodeOwner, aF as LightsparkNodeStatus, aG as LightsparkNodeToChannelsConnection, aH as LightsparkNodeToDailyLiquidityForecastsConnection, aI as LightsparkNodeWithOSK, aJ as LightsparkNodeWithRemoteSigning, aK as MultiSigAddressValidationParameters, aL as Node, aN as NodeAddress, aO as NodeAddressType, aP as NodeToAddressesConnection, aQ as OnChainFeeTarget, aR as OnChainTransaction, aT as OutgoingPayment, aU as OutgoingPaymentAttempt, aV as OutgoingPaymentAttemptStatus, aW as OutgoingPaymentAttemptToHopsConnection, aX as OutgoingPaymentForIdempotencyKeyInput, aY as OutgoingPaymentForIdempotencyKeyOutput, aZ as OutgoingPaymentToAttemptsConnection, a_ as OutgoingPaymentsForInvoiceQueryInput, a$ as OutgoingPaymentsForInvoiceQueryOutput, b0 as OutgoingPaymentsForPaymentHashQueryInput, b1 as OutgoingPaymentsForPaymentHashQueryOutput, b2 as PageInfo, b3 as PayInvoiceInput, b4 as PayInvoiceOutput, b5 as PayUmaInvoiceInput, b6 as PaymentDirection, b7 as PaymentFailureReason, b8 as PaymentRequest, ba as PaymentRequestData, bb as PaymentRequestStatus, bc as Permission, bd as PostTransactionData, be as RegionCode, bf as RegisterPaymentInput, bg as RegisterPaymentOutput, bh as ReleaseChannelPerCommitmentSecretInput, bi as ReleaseChannelPerCommitmentSecretOutput, bj as ReleasePaymentPreimageInput, bk as ReleasePaymentPreimageOutput, bl as RemoteSigningSubEventType, bm as RequestInitiator, bn as RequestWithdrawalInput, bo as RequestWithdrawalOutput, bp as RichText, bq as RiskRating, br as RoutingTransaction, bt as RoutingTransactionFailureReason, bu as ScreenNodeInput, bv as ScreenNodeOutput, bw as Secret, bx as SendPaymentInput, by as SendPaymentOutput, bz as SetInvoicePaymentHashInput, bA as SetInvoicePaymentHashOutput, bB as SignInvoiceInput, bC as SignInvoiceOutput, bD as SignMessagesInput, bE as SignMessagesOutput, bF as Signable, bH as SignablePayload, bJ as SignablePayloadStatus, bK as SingleNodeDashboard, bL as Transaction, bN as TransactionFailures, bO as TransactionStatus, bP as TransactionType, bQ as TransactionUpdate, bR as UmaInvitation, bT as UpdateChannelPerCommitmentPointInput, bU as UpdateChannelPerCommitmentPointOutput, bV as UpdateNodeSharedSecretInput, bW as UpdateNodeSharedSecretOutput, bX as Wallet, bY as WalletStatus, bZ as WalletToPaymentRequestsConnection, b_ as WalletToTransactionsConnection, b$ as WalletToWithdrawalRequestsConnection, W as WebhookEventType, c0 as Withdrawal, c2 as WithdrawalFeeEstimateInput, c3 as WithdrawalFeeEstimateOutput, c4 as WithdrawalMode, c5 as WithdrawalRequest, c6 as WithdrawalRequestStatus, c7 as WithdrawalRequestToChannelClosingTransactionsConnection, c8 as WithdrawalRequestToChannelOpeningTransactionsConnection, c9 as WithdrawalRequestToWithdrawalsConnection, i as getApiTokenQuery, k as getAuditLogActorQuery, p as getChannelClosingTransactionQuery, s as getChannelOpeningTransactionQuery, u as getChannelSnapshotQuery, a4 as getDepositQuery, ad as getHopQuery, ak as getIncomingPaymentAttemptQuery, aq as getInvoiceQuery, aA as getLightningTransactionQuery, aE as getLightsparkNodeOwnerQuery, aC as getLightsparkNodeQuery, aM as getNodeQuery, aS as getOnChainTransactionQuery, b9 as getPaymentRequestQuery, bs as getRoutingTransactionQuery, bI as getSignablePayloadQuery, bG as getSignableQuery, bM as getTransactionQuery, bS as getUmaInvitationQuery, c1 as getWithdrawalQuery } from '../index-2f0cac65.js';
2
2
  export { B as BitcoinNetwork } from '../BitcoinNetwork-4f6ea015.js';
3
3
  import '@lightsparkdev/core';
4
4
  import 'zen-observable';
@@ -26,6 +26,7 @@ import {
26
26
  Permission_default,
27
27
  RegionCode_default,
28
28
  RemoteSigningSubEventType_default,
29
+ RequestInitiator_default,
29
30
  RiskRating_default,
30
31
  RoutingTransactionFailureReason_default,
31
32
  SignablePayloadStatus_default,
@@ -58,7 +59,7 @@ import {
58
59
  getTransactionQuery,
59
60
  getUmaInvitationQuery,
60
61
  getWithdrawalQuery
61
- } from "../chunk-UHTZSOPX.js";
62
+ } from "../chunk-DSWMAFFH.js";
62
63
  import {
63
64
  BitcoinNetwork_default
64
65
  } from "../chunk-K6SAUSAX.js";
@@ -92,6 +93,7 @@ export {
92
93
  Permission_default as Permission,
93
94
  RegionCode_default as RegionCode,
94
95
  RemoteSigningSubEventType_default as RemoteSigningSubEventType,
96
+ RequestInitiator_default as RequestInitiator,
95
97
  RiskRating_default as RiskRating,
96
98
  RoutingTransactionFailureReason_default as RoutingTransactionFailureReason,
97
99
  SignablePayloadStatus_default as SignablePayloadStatus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsparkdev/lightspark-sdk",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Lightspark JS SDK",
5
5
  "author": "Lightspark Inc.",
6
6
  "keywords": [
package/src/client.ts CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  Requester,
21
21
  SigningKeyType,
22
22
  StubAuthProvider,
23
+ bytesToHex,
23
24
  createSha256Hash,
24
25
  pollUntil,
25
26
  } from "@lightsparkdev/core";
@@ -588,6 +589,9 @@ class LightsparkClient {
588
589
  * h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice. See
589
590
  * [this spec](https://github.com/lnurl/luds/blob/luds/06.md#pay-to-static-qrnfclink) for details.
590
591
  * @param expirySecs The number of seconds until the invoice expires. Defaults to 3600 (1 hour).
592
+ * @param signingPrivateKey The receiver's signing private key. Used to hash the receiver identifier.
593
+ * @param receiverIdentifier Optional identifier of the receiver. If provided, this will be hashed using a
594
+ * monthly-rotated seed and used for anonymized analysis.
591
595
  * @returns An Invoice object representing the generated invoice.
592
596
  */
593
597
  public async createUmaInvoice(
@@ -595,14 +599,33 @@ class LightsparkClient {
595
599
  amountMsats: number,
596
600
  metadata: string,
597
601
  expirySecs: number | undefined = undefined,
602
+ signingPrivateKey: Uint8Array | undefined = undefined,
603
+ receiverIdentifier: string | undefined = undefined,
598
604
  ): Promise<Invoice | undefined> {
599
605
  const metadataHash = await createSha256Hash(metadata, true);
600
- const variables = {
606
+ let receiverHash: string | undefined = undefined;
607
+ if (receiverIdentifier !== undefined) {
608
+ if (signingPrivateKey == undefined) {
609
+ throw new LightsparkException(
610
+ "CreateUmaInvoiceError",
611
+ "Receiver identifier provided without signing private key",
612
+ );
613
+ }
614
+ receiverHash = await this.hashUmaIdentifier(
615
+ receiverIdentifier,
616
+ signingPrivateKey,
617
+ );
618
+ }
619
+
620
+ const variables: Record<string, string | number> = {
601
621
  node_id: nodeId,
602
622
  amount_msats: amountMsats,
603
623
  metadata_hash: metadataHash,
604
624
  expiry_secs: expirySecs !== undefined ? expirySecs : 3600,
605
625
  };
626
+ if (receiverHash !== undefined) {
627
+ variables.receiver_hash = receiverHash;
628
+ }
606
629
  const response = await this.requester.makeRawRequest(
607
630
  CreateUmaInvoice,
608
631
  variables,
@@ -851,6 +874,9 @@ class LightsparkClient {
851
874
  * @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
852
875
  * invoice. NOTE: This parameter can only be passed for a zero-amount
853
876
  * invoice. Otherwise, the call will fail.
877
+ * @param signingPrivateKey The sender's signing private key. Used to hash the sender identifier.
878
+ * @param senderIdentifier Optional identifier of the sender. If provided, this will be hashed using a
879
+ * monthly-rotated seed and used for anonymized analysis.
854
880
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
855
881
  */
856
882
  public async payUmaInvoice(
@@ -859,10 +885,27 @@ class LightsparkClient {
859
885
  maximumFeesMsats: number,
860
886
  timeoutSecs: number = 60,
861
887
  amountMsats: number | undefined = undefined,
888
+ signingPrivateKey: Uint8Array | undefined = undefined,
889
+ senderIdentifier: string | undefined = undefined,
862
890
  ): Promise<OutgoingPayment | undefined> {
863
891
  if (!this.nodeKeyCache.hasKey(payerNodeId)) {
864
892
  throw new LightsparkSigningException("Paying node is not unlocked");
865
893
  }
894
+
895
+ let senderHash: string | undefined = undefined;
896
+ if (senderIdentifier !== undefined) {
897
+ if (signingPrivateKey == undefined) {
898
+ throw new LightsparkException(
899
+ "PayUmaInvoiceError",
900
+ "Sender identifier provided without signing private key",
901
+ );
902
+ }
903
+ senderHash = await this.hashUmaIdentifier(
904
+ senderIdentifier,
905
+ signingPrivateKey,
906
+ );
907
+ }
908
+
866
909
  const variables: Record<string, string | number> = {
867
910
  node_id: payerNodeId,
868
911
  encoded_invoice: encodedInvoice,
@@ -872,6 +915,9 @@ class LightsparkClient {
872
915
  if (amountMsats !== undefined) {
873
916
  variables.amount_msats = amountMsats;
874
917
  }
918
+ if (senderHash !== undefined) {
919
+ variables.sender_hash = senderHash;
920
+ }
875
921
  const response = await this.requester.makeRawRequest(
876
922
  PayUmaInvoice,
877
923
  variables,
@@ -1496,6 +1542,22 @@ class LightsparkClient {
1496
1542
  return await createSha256Hash(e164PhoneNumber, true);
1497
1543
  }
1498
1544
 
1545
+ public async hashUmaIdentifier(
1546
+ identifier: string,
1547
+ signingPrivateKey: Uint8Array,
1548
+ ): Promise<string> {
1549
+ const now = this.getUtcDateTime();
1550
+ const input =
1551
+ identifier +
1552
+ `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` +
1553
+ bytesToHex(signingPrivateKey);
1554
+ return await createSha256Hash(input, true);
1555
+ }
1556
+
1557
+ getUtcDateTime(): Date {
1558
+ return new Date();
1559
+ }
1560
+
1499
1561
  /**
1500
1562
  * Executes a raw `Query` against the Lightspark API.
1501
1563
  *
@@ -7,12 +7,14 @@ mutation CreateUmaInvoice(
7
7
  $amount_msats: Long!
8
8
  $metadata_hash: String!
9
9
  $expiry_secs: Int = null
10
+ $receiver_hash: String = null
10
11
  ) {
11
12
  create_uma_invoice(input: {
12
13
  node_id: $node_id
13
14
  amount_msats: $amount_msats
14
15
  metadata_hash: $metadata_hash
15
16
  expiry_secs: $expiry_secs
17
+ receiver_hash: $receiver_hash
16
18
  }) {
17
19
  invoice {
18
20
  ...InvoiceFragment
@@ -9,6 +9,7 @@ export const PayUmaInvoice = `
9
9
  $timeout_secs: Int!
10
10
  $maximum_fees_msats: Long!
11
11
  $amount_msats: Long
12
+ $sender_hash: String = null
12
13
  ) {
13
14
  pay_uma_invoice(
14
15
  input: {
@@ -17,6 +18,7 @@ export const PayUmaInvoice = `
17
18
  timeout_secs: $timeout_secs
18
19
  maximum_fees_msats: $maximum_fees_msats
19
20
  amount_msats: $amount_msats
21
+ sender_hash: $sender_hash
20
22
  }
21
23
  ) {
22
24
  payment {
@@ -1777,6 +1777,7 @@ query FetchAccountToWithdrawalRequestsConnection($first: Int, $after: String, $b
1777
1777
  id
1778
1778
  }
1779
1779
  withdrawal_request_idempotency_key: idempotency_key
1780
+ withdrawal_request_initiator: initiator
1780
1781
  }
1781
1782
  }
1782
1783
  }
@@ -15,6 +15,10 @@ interface CreateLnurlInvoiceInput {
15
15
 
16
16
  /** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
17
17
  expirySecs?: number | undefined;
18
+
19
+ /** An optional, monthly-rotated, unique hashed identifier corresponding to the receiver of the
20
+ * payment. **/
21
+ receiverHash?: string | undefined;
18
22
  }
19
23
 
20
24
  export const CreateLnurlInvoiceInputFromJson = (
@@ -25,6 +29,7 @@ export const CreateLnurlInvoiceInputFromJson = (
25
29
  amountMsats: obj["create_lnurl_invoice_input_amount_msats"],
26
30
  metadataHash: obj["create_lnurl_invoice_input_metadata_hash"],
27
31
  expirySecs: obj["create_lnurl_invoice_input_expiry_secs"],
32
+ receiverHash: obj["create_lnurl_invoice_input_receiver_hash"],
28
33
  } as CreateLnurlInvoiceInput;
29
34
  };
30
35
  export const CreateLnurlInvoiceInputToJson = (
@@ -35,6 +40,7 @@ export const CreateLnurlInvoiceInputToJson = (
35
40
  create_lnurl_invoice_input_amount_msats: obj.amountMsats,
36
41
  create_lnurl_invoice_input_metadata_hash: obj.metadataHash,
37
42
  create_lnurl_invoice_input_expiry_secs: obj.expirySecs,
43
+ create_lnurl_invoice_input_receiver_hash: obj.receiverHash,
38
44
  };
39
45
  };
40
46
 
@@ -8,6 +8,8 @@ interface CreateUmaInvoiceInput {
8
8
  metadataHash: string;
9
9
 
10
10
  expirySecs?: number | undefined;
11
+
12
+ receiverHash?: string | undefined;
11
13
  }
12
14
 
13
15
  export const CreateUmaInvoiceInputFromJson = (
@@ -18,6 +20,7 @@ export const CreateUmaInvoiceInputFromJson = (
18
20
  amountMsats: obj["create_uma_invoice_input_amount_msats"],
19
21
  metadataHash: obj["create_uma_invoice_input_metadata_hash"],
20
22
  expirySecs: obj["create_uma_invoice_input_expiry_secs"],
23
+ receiverHash: obj["create_uma_invoice_input_receiver_hash"],
21
24
  } as CreateUmaInvoiceInput;
22
25
  };
23
26
  export const CreateUmaInvoiceInputToJson = (
@@ -28,6 +31,7 @@ export const CreateUmaInvoiceInputToJson = (
28
31
  create_uma_invoice_input_amount_msats: obj.amountMsats,
29
32
  create_uma_invoice_input_metadata_hash: obj.metadataHash,
30
33
  create_uma_invoice_input_expiry_secs: obj.expirySecs,
34
+ create_uma_invoice_input_receiver_hash: obj.receiverHash,
31
35
  };
32
36
  };
33
37
 
@@ -18,7 +18,7 @@ export enum CurrencyUnit {
18
18
  */
19
19
  SATOSHI = "SATOSHI",
20
20
  /**
21
- * 0.001 Satoshi, or 10e-11 Bitcoin. We recommend using the Satoshi unit instead when possible. *
21
+ * 0.001 Satoshi, or 10e-11 Bitcoin. We recommend using the Satoshi unit instead when possible.
22
22
  */
23
23
  MILLISATOSHI = "MILLISATOSHI",
24
24
  /** United States Dollar. **/
@@ -1515,6 +1515,7 @@ fragment EntityFragment on Entity {
1515
1515
  id
1516
1516
  }
1517
1517
  withdrawal_request_idempotency_key: idempotency_key
1518
+ withdrawal_request_initiator: initiator
1518
1519
  }
1519
1520
  }`;
1520
1521
 
@@ -12,6 +12,12 @@ interface PayUmaInvoiceInput {
12
12
  amountMsats?: number | undefined;
13
13
 
14
14
  idempotencyKey?: string | undefined;
15
+
16
+ /**
17
+ * An optional, monthly-rotated, unique hashed identifier corresponding to the sender of the
18
+ * payment. *
19
+ */
20
+ senderHash?: string | undefined;
15
21
  }
16
22
 
17
23
  export const PayUmaInvoiceInputFromJson = (obj: any): PayUmaInvoiceInput => {
@@ -22,6 +28,7 @@ export const PayUmaInvoiceInputFromJson = (obj: any): PayUmaInvoiceInput => {
22
28
  maximumFeesMsats: obj["pay_uma_invoice_input_maximum_fees_msats"],
23
29
  amountMsats: obj["pay_uma_invoice_input_amount_msats"],
24
30
  idempotencyKey: obj["pay_uma_invoice_input_idempotency_key"],
31
+ senderHash: obj["pay_uma_invoice_input_sender_hash"],
25
32
  } as PayUmaInvoiceInput;
26
33
  };
27
34
  export const PayUmaInvoiceInputToJson = (obj: PayUmaInvoiceInput): any => {
@@ -32,6 +39,7 @@ export const PayUmaInvoiceInputToJson = (obj: PayUmaInvoiceInput): any => {
32
39
  pay_uma_invoice_input_maximum_fees_msats: obj.maximumFeesMsats,
33
40
  pay_uma_invoice_input_amount_msats: obj.amountMsats,
34
41
  pay_uma_invoice_input_idempotency_key: obj.idempotencyKey,
42
+ pay_uma_invoice_input_sender_hash: obj.senderHash,
35
43
  };
36
44
  };
37
45
 
@@ -0,0 +1,15 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export enum RequestInitiator {
4
+ /**
5
+ * This is an enum value that represents values that could be added in the future.
6
+ * Clients should support unknown values as more of them could be added without notice.
7
+ */
8
+ FUTURE_VALUE = "FUTURE_VALUE",
9
+
10
+ CUSTOMER = "CUSTOMER",
11
+
12
+ LIGHTSPARK = "LIGHTSPARK",
13
+ }
14
+
15
+ export default RequestInitiator;
@@ -17,7 +17,7 @@ export enum TransactionStatus {
17
17
  /** Transaction has been initiated and is currently in-flight. **/
18
18
  PENDING = "PENDING",
19
19
  /**
20
- * For transaction type PAYMENT_REQUEST only. No payments have been made to a payment request. *
20
+ * For transaction type PAYMENT_REQUEST only. No payments have been made to a payment request.
21
21
  */
22
22
  NOT_STARTED = "NOT_STARTED",
23
23
  /** For transaction type PAYMENT_REQUEST only. A payment request has expired. **/
@@ -1109,6 +1109,7 @@ query FetchWalletToWithdrawalRequestsConnection($entity_id: ID!, $first: Int, $a
1109
1109
  id
1110
1110
  }
1111
1111
  withdrawal_request_idempotency_key: idempotency_key
1112
+ withdrawal_request_initiator: initiator
1112
1113
  }
1113
1114
  }
1114
1115
  }
@@ -33,8 +33,8 @@ export enum WalletStatus {
33
33
  TERMINATING = "TERMINATING",
34
34
  /**
35
35
  * The wallet has been terminated and is not available in the Lightspark infrastructure anymore.
36
- * It is not connected to the Lightning network and its funds can only be accessed using the
37
- * Funds Recovery flow. *
36
+ * It is not connected to the Lightning network and its funds can only be accessed using the Funds
37
+ * Recovery flow. *
38
38
  */
39
39
  TERMINATED = "TERMINATED",
40
40
  }