@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.
@@ -405,6 +405,7 @@ declare class LightsparkNode implements Node {
405
405
  readonly bitcoinNetwork: BitcoinNetwork;
406
406
  readonly displayName: string;
407
407
  readonly accountId: string;
408
+ readonly ownerId: string;
408
409
  readonly typename: string;
409
410
  readonly alias?: string | undefined;
410
411
  readonly color?: string | undefined;
@@ -418,7 +419,7 @@ declare class LightsparkNode implements Node {
418
419
  readonly purpose?: LightsparkNodePurpose | undefined;
419
420
  readonly remoteBalance?: CurrencyAmount | undefined;
420
421
  readonly status?: LightsparkNodeStatus | undefined;
421
- constructor(id: string, createdAt: string, updatedAt: string, bitcoinNetwork: BitcoinNetwork, displayName: string, accountId: string, typename: string, alias?: string | undefined, color?: string | undefined, conductivity?: number | undefined, publicKey?: string | undefined, blockchainBalance?: BlockchainBalance | undefined, encryptedSigningPrivateKey?: Secret | undefined, totalBalance?: CurrencyAmount | undefined, totalLocalBalance?: CurrencyAmount | undefined, localBalance?: CurrencyAmount | undefined, purpose?: LightsparkNodePurpose | undefined, remoteBalance?: CurrencyAmount | undefined, status?: LightsparkNodeStatus | undefined);
422
+ constructor(id: string, createdAt: string, updatedAt: string, bitcoinNetwork: BitcoinNetwork, displayName: string, accountId: string, ownerId: string, typename: string, alias?: string | undefined, color?: string | undefined, conductivity?: number | undefined, publicKey?: string | undefined, blockchainBalance?: BlockchainBalance | undefined, encryptedSigningPrivateKey?: Secret | undefined, totalBalance?: CurrencyAmount | undefined, totalLocalBalance?: CurrencyAmount | undefined, localBalance?: CurrencyAmount | undefined, purpose?: LightsparkNodePurpose | undefined, remoteBalance?: CurrencyAmount | undefined, status?: LightsparkNodeStatus | undefined);
422
423
  getAddresses(client: LightsparkClient, first?: number | undefined, types?: NodeAddressType[] | undefined): Promise<NodeToAddressesConnection>;
423
424
  getChannels(client: LightsparkClient, first?: number | undefined, statuses?: ChannelStatus[] | undefined): Promise<LightsparkNodeToChannelsConnection>;
424
425
  static getLightsparkNodeQuery(id: string): Query<LightsparkNode>;
@@ -585,18 +586,60 @@ type Balances = {
585
586
  availableToWithdrawBalance: CurrencyAmount;
586
587
  };
587
588
 
588
- declare class Wallet implements Entity {
589
+ type LightsparkNodeOwner = Entity & {
590
+ /**
591
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
592
+ * string.
593
+ **/
594
+ id: string;
595
+ /** The date and time when the entity was first created. **/
596
+ createdAt: string;
597
+ /** The date and time when the entity was last updated. **/
598
+ updatedAt: string;
599
+ /** The typename of the object **/
600
+ typename: string;
601
+ };
602
+ declare const getLightsparkNodeOwnerQuery: (id: string) => Query<LightsparkNodeOwner>;
603
+
604
+ declare enum WalletStatus {
605
+ /**
606
+ * This is an enum value that represents values that could be added in the future.
607
+ * Clients should support unknown values as more of them could be added without notice.
608
+ */
609
+ FUTURE_VALUE = "FUTURE_VALUE",
610
+ /** The wallet has not been set up yet and is ready to be deployed. This is the default status after the first login. **/
611
+ NOT_SETUP = "NOT_SETUP",
612
+ /** The wallet is currently being deployed in the Lightspark infrastructure. **/
613
+ DEPLOYING = "DEPLOYING",
614
+ /** The wallet has been deployed in the Lightspark infrastructure and is ready to be initialized. **/
615
+ DEPLOYED = "DEPLOYED",
616
+ /** The wallet is currently being initialized. **/
617
+ INITIALIZING = "INITIALIZING",
618
+ /** The wallet is available and ready to be used. **/
619
+ READY = "READY",
620
+ /** The wallet is temporarily available, due to a transient issue or a scheduled maintenance. **/
621
+ UNAVAILABLE = "UNAVAILABLE",
622
+ /** The wallet had an unrecoverable failure. This status is not expected to happend and will be investigated by the Lightspark team. **/
623
+ FAILED = "FAILED",
624
+ /** The wallet is being terminated. **/
625
+ TERMINATING = "TERMINATING",
626
+ /** The wallet has been terminated and is not available in the Lightspark infrastructure anymore. It is not connected to the Lightning network and its funds can only be accessed using the Funds Recovery flow. **/
627
+ TERMINATED = "TERMINATED"
628
+ }
629
+
630
+ declare class Wallet implements LightsparkNodeOwner {
589
631
  readonly id: string;
590
632
  readonly createdAt: string;
591
633
  readonly updatedAt: string;
592
634
  readonly thirdPartyIdentifier: string;
635
+ readonly status: WalletStatus;
593
636
  readonly typename: string;
594
637
  readonly lastLoginAt?: string | undefined;
595
638
  readonly balances?: Balances | undefined;
596
- constructor(id: string, createdAt: string, updatedAt: string, thirdPartyIdentifier: string, typename: string, lastLoginAt?: string | undefined, balances?: Balances | undefined);
639
+ constructor(id: string, createdAt: string, updatedAt: string, thirdPartyIdentifier: string, status: WalletStatus, typename: string, lastLoginAt?: string | undefined, balances?: Balances | undefined);
597
640
  getTotalAmountReceived(client: LightsparkClient, createdAfterDate?: string | undefined, createdBeforeDate?: string | undefined): Promise<CurrencyAmount>;
598
641
  getTotalAmountSent(client: LightsparkClient, createdAfterDate?: string | undefined, createdBeforeDate?: string | undefined): Promise<CurrencyAmount>;
599
- static getWalletQuery(): Query<Wallet>;
642
+ static getWalletQuery(id: string): Query<Wallet>;
600
643
  }
601
644
 
602
645
  type AccountToWalletsConnection = {
@@ -644,7 +687,7 @@ type TransactionFailures = {
644
687
  routingTransactionFailures?: RoutingTransactionFailureReason[];
645
688
  };
646
689
 
647
- declare class Account implements Entity {
690
+ declare class Account implements LightsparkNodeOwner {
648
691
  readonly id: string;
649
692
  readonly createdAt: string;
650
693
  readonly updatedAt: string;
@@ -704,6 +747,28 @@ type InvoiceData = PaymentRequestData & {
704
747
  memo?: string;
705
748
  };
706
749
 
750
+ /** This object represents a BOLT #11 invoice (https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) initiated by a Lightspark Node. **/
751
+ type Invoice = PaymentRequest & Entity & {
752
+ /**
753
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
754
+ * string.
755
+ **/
756
+ id: string;
757
+ /** The date and time when the entity was first created. **/
758
+ createdAt: string;
759
+ /** The date and time when the entity was last updated. **/
760
+ updatedAt: string;
761
+ /** The details of the invoice. **/
762
+ data: InvoiceData;
763
+ /** The status of the payment request. **/
764
+ status: PaymentRequestStatus;
765
+ /** The typename of the object **/
766
+ typename: string;
767
+ /** The total amount that has been paid to this invoice. **/
768
+ amountPaid?: CurrencyAmount;
769
+ };
770
+ declare const getInvoiceQuery: (id: string) => Query<Invoice>;
771
+
707
772
  declare enum InvoiceType {
708
773
  /**
709
774
  * This is an enum value that represents values that could be added in the future.
@@ -1227,6 +1292,21 @@ declare class LightsparkClient {
1227
1292
  * @returns An encoded payment request for the invoice, or undefined if the invoice could not be created.
1228
1293
  */
1229
1294
  createInvoice(nodeId: string, amountMsats: number, memo: string, type?: InvoiceType | undefined): Promise<string | undefined>;
1295
+ /**
1296
+ * Generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment
1297
+ * from another Lightning Node. This should only be used for generating invoices for LNURLs,
1298
+ * with [createInvoice] preferred in the general case.
1299
+ *
1300
+ * Test mode note: You can simulate a payment of this invoice in test move using [createTestModePayment].
1301
+ *
1302
+ * @param nodeId The node ID for which to create an invoice.
1303
+ * @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
1304
+ * @param metadata The LNURL metadata payload field in the initial payreq response. This wil be hashed and present in the
1305
+ * h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice. See
1306
+ * [this spec](https://github.com/lnurl/luds/blob/luds/06.md#pay-to-static-qrnfclink) for details.
1307
+ * @returns An Invoice object representing the generated invoice.
1308
+ */
1309
+ createLnurlInvoice(nodeId: string, amountMsats: number, metadata: string): Promise<Invoice | undefined>;
1230
1310
  /**
1231
1311
  * Decodes an encoded lightning invoice string.
1232
1312
  *
@@ -1404,6 +1484,18 @@ type CreateInvoiceOutput = {
1404
1484
  invoiceId: string;
1405
1485
  };
1406
1486
 
1487
+ type CreateLnurlInvoiceInput = {
1488
+ /** The node from which to create the invoice. **/
1489
+ nodeId: string;
1490
+ /** The amount for which the invoice should be created, in millisatoshis. **/
1491
+ amountMsats: number;
1492
+ /**
1493
+ * The SHA256 hash of the LNURL metadata payload. This will be present in the h-tag (SHA256 purpose of
1494
+ * payment) of the resulting Bolt 11 invoice.
1495
+ **/
1496
+ metadataHash: string;
1497
+ };
1498
+
1407
1499
  type CreateNodeWalletAddressInput = {
1408
1500
  nodeId: string;
1409
1501
  };
@@ -1586,28 +1678,6 @@ declare class IncomingPayment implements LightningTransaction {
1586
1678
  static getIncomingPaymentQuery(id: string): Query<IncomingPayment>;
1587
1679
  }
1588
1680
 
1589
- /** This object represents a BOLT #11 invoice (https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) initiated by a Lightspark Node. **/
1590
- type Invoice = PaymentRequest & Entity & {
1591
- /**
1592
- * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
1593
- * string.
1594
- **/
1595
- id: string;
1596
- /** The date and time when the entity was first created. **/
1597
- createdAt: string;
1598
- /** The date and time when the entity was last updated. **/
1599
- updatedAt: string;
1600
- /** The details of the invoice. **/
1601
- data: InvoiceData;
1602
- /** The status of the payment request. **/
1603
- status: PaymentRequestStatus;
1604
- /** The typename of the object **/
1605
- typename: string;
1606
- /** The total amount that has been paid to this invoice. **/
1607
- amountPaid?: CurrencyAmount;
1608
- };
1609
- declare const getInvoiceQuery: (id: string) => Query<Invoice>;
1610
-
1611
1681
  type LightningFeeEstimateForInvoiceInput = {
1612
1682
  /** The node from where you want to send the payment. **/
1613
1683
  nodeId: string;
@@ -1789,4 +1859,4 @@ type Withdrawal = OnChainTransaction & Transaction & Entity & {
1789
1859
  };
1790
1860
  declare const getWithdrawalQuery: (id: string) => Query<Withdrawal>;
1791
1861
 
1792
- export { InvoiceData as $, Account as A, Balances as B, Channel as C, CreateTestModePaymentoutput as D, CurrencyAmount as E, CurrencyUnit as F, DeleteApiTokenInput as G, DeleteApiTokenOutput as H, Deposit as I, getDepositQuery as J, Entity as K, LightsparkClient as L, FeeEstimate as M, FundNodeInput as N, FundNodeOutput as O, GraphNode as P, Hop as Q, getHopQuery as R, HtlcAttemptFailureCode as S, IncomingPayment as T, IncomingPaymentAttempt as U, getIncomingPaymentAttemptQuery as V, WebhookEventType as W, IncomingPaymentAttemptStatus as X, IncomingPaymentToAttemptsConnection as Y, Invoice as Z, getInvoiceQuery as _, AccountToApiTokensConnection as a, InvoiceType as a0, LightningFeeEstimateForInvoiceInput as a1, LightningFeeEstimateForNodeInput as a2, LightningFeeEstimateOutput as a3, LightningTransaction as a4, getLightningTransactionQuery as a5, LightsparkNode as a6, LightsparkNodePurpose as a7, LightsparkNodeStatus as a8, LightsparkNodeToChannelsConnection as a9, Secret as aA, SendPaymentInput as aB, SendPaymentOutput as aC, SingleNodeDashboard as aD, Transaction as aE, getTransactionQuery as aF, TransactionFailures as aG, TransactionStatus as aH, TransactionType as aI, TransactionUpdate as aJ, Wallet as aK, Withdrawal as aL, getWithdrawalQuery as aM, WithdrawalMode as aN, WithdrawalRequest as aO, WithdrawalRequestStatus as aP, WithdrawalRequestToChannelClosingTransactionsConnection as aQ, WithdrawalRequestToChannelOpeningTransactionsConnection as aR, Node as aa, NodeAddress as ab, NodeAddressType as ac, NodeToAddressesConnection as ad, OnChainTransaction as ae, getOnChainTransactionQuery as af, OutgoingPayment as ag, OutgoingPaymentAttempt as ah, OutgoingPaymentAttemptStatus as ai, OutgoingPaymentAttemptToHopsConnection as aj, OutgoingPaymentToAttemptsConnection as ak, PageInfo as al, PayInvoiceInput as am, PayInvoiceOutput as an, PaymentFailureReason as ao, PaymentRequest as ap, getPaymentRequestQuery as aq, PaymentRequestData as ar, PaymentRequestStatus as as, Permission as at, RequestWithdrawalInput as au, RequestWithdrawalOutput as av, RichText as aw, RoutingTransaction as ax, getRoutingTransactionQuery as ay, RoutingTransactionFailureReason as az, AccountToChannelsConnection as b, AccountToNodesConnection as c, AccountToPaymentRequestsConnection as d, AccountToTransactionsConnection as e, AccountToWalletsConnection as f, ApiToken as g, getApiTokenQuery as h, BitcoinNetwork as i, BlockchainBalance as j, ChannelClosingTransaction as k, getChannelClosingTransactionQuery as l, ChannelFees as m, ChannelOpeningTransaction as n, getChannelOpeningTransactionQuery as o, ChannelStatus as p, ChannelToTransactionsConnection as q, CreateApiTokenInput as r, CreateApiTokenOutput as s, CreateInvoiceInput as t, CreateInvoiceOutput as u, CreateNodeWalletAddressInput as v, CreateNodeWalletAddressOutput as w, CreateTestModeInvoiceInput as x, CreateTestModeInvoiceOutput as y, CreateTestModePaymentInput as z };
1862
+ export { getInvoiceQuery as $, Account as A, Balances as B, Channel as C, CreateTestModePaymentInput as D, CreateTestModePaymentoutput as E, CurrencyAmount as F, CurrencyUnit as G, DeleteApiTokenInput as H, DeleteApiTokenOutput as I, Deposit as J, getDepositQuery as K, LightsparkClient as L, Entity as M, FeeEstimate as N, FundNodeInput as O, FundNodeOutput as P, GraphNode as Q, Hop as R, getHopQuery as S, HtlcAttemptFailureCode as T, IncomingPayment as U, IncomingPaymentAttempt as V, WebhookEventType as W, getIncomingPaymentAttemptQuery as X, IncomingPaymentAttemptStatus as Y, IncomingPaymentToAttemptsConnection as Z, Invoice as _, AccountToApiTokensConnection as a, InvoiceData as a0, InvoiceType as a1, LightningFeeEstimateForInvoiceInput as a2, LightningFeeEstimateForNodeInput as a3, LightningFeeEstimateOutput as a4, LightningTransaction as a5, getLightningTransactionQuery as a6, LightsparkNode as a7, LightsparkNodeOwner as a8, getLightsparkNodeOwnerQuery as a9, RoutingTransaction as aA, getRoutingTransactionQuery as aB, RoutingTransactionFailureReason as aC, Secret as aD, SendPaymentInput as aE, SendPaymentOutput as aF, SingleNodeDashboard as aG, Transaction as aH, getTransactionQuery as aI, TransactionFailures as aJ, TransactionStatus as aK, TransactionType as aL, TransactionUpdate as aM, Wallet as aN, WalletStatus as aO, Withdrawal as aP, getWithdrawalQuery as aQ, WithdrawalMode as aR, WithdrawalRequest as aS, WithdrawalRequestStatus as aT, WithdrawalRequestToChannelClosingTransactionsConnection as aU, WithdrawalRequestToChannelOpeningTransactionsConnection as aV, LightsparkNodePurpose as aa, LightsparkNodeStatus as ab, LightsparkNodeToChannelsConnection as ac, Node as ad, NodeAddress as ae, NodeAddressType as af, NodeToAddressesConnection as ag, OnChainTransaction as ah, getOnChainTransactionQuery as ai, OutgoingPayment as aj, OutgoingPaymentAttempt as ak, OutgoingPaymentAttemptStatus as al, OutgoingPaymentAttemptToHopsConnection as am, OutgoingPaymentToAttemptsConnection as an, PageInfo as ao, PayInvoiceInput as ap, PayInvoiceOutput as aq, PaymentFailureReason as ar, PaymentRequest as as, getPaymentRequestQuery as at, PaymentRequestData as au, PaymentRequestStatus as av, Permission as aw, RequestWithdrawalInput as ax, RequestWithdrawalOutput as ay, RichText as az, AccountToChannelsConnection as b, AccountToNodesConnection as c, AccountToPaymentRequestsConnection as d, AccountToTransactionsConnection as e, AccountToWalletsConnection as f, ApiToken as g, getApiTokenQuery as h, BitcoinNetwork as i, BlockchainBalance as j, ChannelClosingTransaction as k, getChannelClosingTransactionQuery as l, ChannelFees as m, ChannelOpeningTransaction as n, getChannelOpeningTransactionQuery as o, ChannelStatus as p, ChannelToTransactionsConnection as q, CreateApiTokenInput as r, CreateApiTokenOutput as s, CreateInvoiceInput as t, CreateInvoiceOutput as u, CreateLnurlInvoiceInput as v, CreateNodeWalletAddressInput as w, CreateNodeWalletAddressOutput as x, CreateTestModeInvoiceInput as y, CreateTestModeInvoiceOutput as z };