@lightsparkdev/lightspark-sdk 1.2.2 → 1.3.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 +21 -0
- package/dist/{BitcoinNetwork-a816c0be.d.ts → BitcoinNetwork-972b1d01.d.ts} +4 -1
- package/dist/{chunk-GLL4KTUT.js → chunk-Y55D3PD4.js} +11 -11
- package/dist/env.d.cts +1 -1
- package/dist/env.d.ts +1 -1
- package/dist/{index-eb604025.d.ts → index-a5028d74.d.ts} +866 -451
- package/dist/index.cjs +622 -557
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +363 -298
- package/dist/objects/index.d.cts +2 -2
- package/dist/objects/index.d.ts +2 -2
- package/dist/objects/index.js +1 -1
- package/package.json +4 -4
- package/src/NodeKeyLoaderCache.ts +4 -3
- package/src/SigningKeyLoader.ts +12 -7
- package/src/client.ts +117 -65
- package/src/env.ts +3 -1
- package/src/graphql/CancelInvoice.ts +17 -0
- package/src/objects/Account.ts +7 -3
- package/src/objects/AccountToApiTokensConnection.ts +3 -2
- package/src/objects/AccountToChannelsConnection.ts +3 -2
- package/src/objects/AccountToNodesConnection.ts +3 -2
- package/src/objects/AccountToPaymentRequestsConnection.ts +3 -2
- package/src/objects/AccountToTransactionsConnection.ts +7 -6
- package/src/objects/AccountToWalletsConnection.ts +3 -2
- package/src/objects/ApiToken.ts +10 -5
- package/src/objects/Balances.ts +20 -12
- package/src/objects/BitcoinNetwork.ts +4 -1
- package/src/objects/CancelInvoiceInput.ts +18 -0
- package/src/objects/CancelInvoiceOutput.ts +26 -0
- package/src/objects/Channel.ts +26 -12
- package/src/objects/ChannelClosingTransaction.ts +7 -3
- package/src/objects/ChannelOpeningTransaction.ts +7 -3
- package/src/objects/ChannelStatus.ts +24 -5
- package/src/objects/ChannelToTransactionsConnection.ts +9 -8
- package/src/objects/Connection.ts +3 -2
- package/src/objects/CreateApiTokenOutput.ts +3 -3
- package/src/objects/CreateLnurlInvoiceInput.ts +3 -2
- package/src/objects/CreateTestModePaymentInput.ts +2 -2
- package/src/objects/CreateTestModePaymentoutput.ts +5 -1
- package/src/objects/CurrencyAmount.ts +2 -2
- package/src/objects/CurrencyUnit.ts +29 -6
- package/src/objects/Deposit.ts +8 -3
- package/src/objects/Entity.ts +8 -3
- package/src/objects/FeeEstimate.ts +5 -1
- package/src/objects/GraphNode.ts +20 -11
- package/src/objects/Hop.ts +8 -3
- package/src/objects/HtlcAttemptFailureCode.ts +4 -1
- package/src/objects/IncentivesIneligibilityReason.ts +16 -4
- package/src/objects/IncentivesStatus.ts +9 -2
- package/src/objects/IncomingPayment.ts +9 -5
- package/src/objects/IncomingPaymentAttempt.ts +7 -3
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -2
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/InvoiceData.ts +7 -3
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
- package/src/objects/LightningTransaction.ts +7 -3
- package/src/objects/LightsparkNode.ts +21 -12
- package/src/objects/LightsparkNodeOwner.ts +2 -2
- package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -2
- package/src/objects/LightsparkNodeWithOSK.ts +20 -12
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +16 -11
- package/src/objects/Node.ts +19 -11
- package/src/objects/NodeAddressType.ts +4 -1
- package/src/objects/NodeToAddressesConnection.ts +7 -3
- package/src/objects/OnChainTransaction.ts +8 -3
- package/src/objects/OutgoingPayment.ts +8 -3
- package/src/objects/OutgoingPaymentAttempt.ts +16 -9
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +7 -3
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -2
- package/src/objects/PageInfo.ts +5 -1
- package/src/objects/PayInvoiceInput.ts +4 -1
- package/src/objects/PaymentFailureReason.ts +4 -1
- package/src/objects/PaymentRequest.ts +7 -3
- package/src/objects/PaymentRequestData.ts +5 -1
- package/src/objects/PaymentRequestStatus.ts +4 -1
- package/src/objects/Permission.ts +4 -1
- package/src/objects/RegisterPaymentInput.ts +8 -7
- package/src/objects/RequestWithdrawalInput.ts +2 -2
- package/src/objects/RiskRating.ts +5 -1
- package/src/objects/RoutingTransaction.ts +11 -5
- package/src/objects/RoutingTransactionFailureReason.ts +4 -1
- package/src/objects/ScreenNodeInput.ts +3 -2
- package/src/objects/SendPaymentInput.ts +4 -1
- package/src/objects/SetInvoicePaymentHashInput.ts +3 -2
- package/src/objects/Signable.ts +2 -2
- package/src/objects/SignablePayload.ts +6 -3
- package/src/objects/Transaction.ts +8 -3
- package/src/objects/TransactionStatus.ts +8 -2
- package/src/objects/TransactionType.ts +16 -4
- package/src/objects/TransactionUpdate.ts +6 -3
- package/src/objects/UmaInvitation.ts +2 -2
- package/src/objects/Wallet.ts +12 -4
- package/src/objects/WalletStatus.ts +18 -4
- package/src/objects/WalletToPaymentRequestsConnection.ts +3 -2
- package/src/objects/WalletToTransactionsConnection.ts +3 -2
- package/src/objects/WebhookEventType.ts +4 -1
- package/src/objects/Withdrawal.ts +7 -3
- package/src/objects/WithdrawalRequest.ts +10 -5
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +3 -2
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +3 -2
- package/src/objects/index.ts +8 -6
- package/src/tests/integration/general-regtest.test.ts +15 -1
|
@@ -28,12 +28,17 @@ import { RichTextFromJson, RichTextToJson } from "./RichText.js";
|
|
|
28
28
|
import type Transaction from "./Transaction.js";
|
|
29
29
|
import TransactionStatus from "./TransactionStatus.js";
|
|
30
30
|
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* This object represents a Lightning Network payment sent from a Lightspark Node.
|
|
33
|
+
* You can retrieve this object to receive payment related information about any payment sent from
|
|
34
|
+
* your Lightspark Node on the Lightning Network.
|
|
35
|
+
* *
|
|
36
|
+
*/
|
|
32
37
|
class OutgoingPayment implements LightningTransaction, Transaction, Entity {
|
|
33
38
|
constructor(
|
|
34
39
|
/**
|
|
35
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
36
|
-
* string.
|
|
40
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
41
|
+
* Should be treated as an opaque string.
|
|
37
42
|
**/
|
|
38
43
|
public readonly id: string,
|
|
39
44
|
/** The date and time when this transaction was initiated. **/
|
|
@@ -19,12 +19,18 @@ import OutgoingPaymentAttemptStatus from "./OutgoingPaymentAttemptStatus.js";
|
|
|
19
19
|
import type OutgoingPaymentAttemptToHopsConnection from "./OutgoingPaymentAttemptToHopsConnection.js";
|
|
20
20
|
import { OutgoingPaymentAttemptToHopsConnectionFromJson } from "./OutgoingPaymentAttemptToHopsConnection.js";
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* This object represents an attempted Lightning Network payment sent from a Lightspark Node.
|
|
24
|
+
* You can retrieve this object to receive payment related information about any payment attempt
|
|
25
|
+
* sent from your Lightspark Node on the Lightning Network,
|
|
26
|
+
* including any potential reasons the payment may have failed.
|
|
27
|
+
* *
|
|
28
|
+
*/
|
|
23
29
|
class OutgoingPaymentAttempt implements Entity {
|
|
24
30
|
constructor(
|
|
25
31
|
/**
|
|
26
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
27
|
-
* string.
|
|
32
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
33
|
+
* Should be treated as an opaque string.
|
|
28
34
|
**/
|
|
29
35
|
public readonly id: string,
|
|
30
36
|
/** The date and time when the entity was first created. **/
|
|
@@ -49,15 +55,16 @@ class OutgoingPaymentAttempt implements Entity {
|
|
|
49
55
|
/** The time the outgoing payment attempt failed or succeeded. **/
|
|
50
56
|
public readonly resolvedAt?: string | undefined,
|
|
51
57
|
/**
|
|
52
|
-
* The total amount of funds required to complete a payment over this route.
|
|
53
|
-
* cumulative fees for each hop. As a result,
|
|
54
|
-
*
|
|
55
|
-
* an insufficient amount.
|
|
58
|
+
* The total amount of funds required to complete a payment over this route.
|
|
59
|
+
* This value includes the cumulative fees for each hop. As a result,
|
|
60
|
+
* the attempt extended to the first-hop in the route will need to have at least this much
|
|
61
|
+
* value, otherwise the route will fail at an intermediate node due to an insufficient amount.
|
|
56
62
|
**/
|
|
57
63
|
public readonly amount?: CurrencyAmount | undefined,
|
|
58
64
|
/**
|
|
59
|
-
* The sum of the fees paid at each hop within the route of this attempt.
|
|
60
|
-
* payment, this value will be zero as we don't need to pay a fee to
|
|
65
|
+
* The sum of the fees paid at each hop within the route of this attempt.
|
|
66
|
+
* In the case of a one-hop payment, this value will be zero as we don't need to pay a fee to
|
|
67
|
+
* ourselves.
|
|
61
68
|
**/
|
|
62
69
|
public readonly fees?: CurrencyAmount | undefined,
|
|
63
70
|
/** The channel snapshot at the time the outgoing payment attempt was made. **/
|
|
@@ -5,11 +5,15 @@ import { HopFromJson, HopToJson } from "./Hop.js";
|
|
|
5
5
|
import type PageInfo from "./PageInfo.js";
|
|
6
6
|
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The connection from an outgoing payment attempt to the list of sequential hops that define the
|
|
10
|
+
* path from sender node to recipient node. *
|
|
11
|
+
*/
|
|
9
12
|
interface OutgoingPaymentAttemptToHopsConnection {
|
|
10
13
|
/**
|
|
11
|
-
* The total count of objects in this connection, using the current filters.
|
|
12
|
-
* number of objects returned in the current page (in the `entities`
|
|
14
|
+
* The total count of objects in this connection, using the current filters.
|
|
15
|
+
* It is different from the number of objects returned in the current page (in the `entities`
|
|
16
|
+
* field).
|
|
13
17
|
**/
|
|
14
18
|
count: number;
|
|
15
19
|
|
|
@@ -8,8 +8,9 @@ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
|
8
8
|
/** The connection from outgoing payment to all attempts. **/
|
|
9
9
|
interface OutgoingPaymentToAttemptsConnection {
|
|
10
10
|
/**
|
|
11
|
-
* The total count of objects in this connection, using the current filters.
|
|
12
|
-
* number of objects returned in the current page (in the `entities`
|
|
11
|
+
* The total count of objects in this connection, using the current filters.
|
|
12
|
+
* It is different from the number of objects returned in the current page (in the `entities`
|
|
13
|
+
* field).
|
|
13
14
|
**/
|
|
14
15
|
count: number;
|
|
15
16
|
|
package/src/objects/PageInfo.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an object representing information about a page returned by the Lightspark API.
|
|
5
|
+
* For more information, please see the “Pagination” section of our API docs for more information
|
|
6
|
+
* about its usage. *
|
|
7
|
+
*/
|
|
4
8
|
interface PageInfo {
|
|
5
9
|
hasNextPage?: boolean | undefined;
|
|
6
10
|
|
|
@@ -10,7 +10,10 @@ interface PayInvoiceInput {
|
|
|
10
10
|
/** The timeout in seconds that we will try to make the payment. **/
|
|
11
11
|
timeoutSecs: number;
|
|
12
12
|
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The maximum amount of fees that you want to pay for this payment to be sent, expressed in
|
|
15
|
+
* msats. *
|
|
16
|
+
*/
|
|
14
17
|
maximumFeesMsats: number;
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential reasons why an OutgoingPayment sent from a Lightspark Node may
|
|
5
|
+
* have failed. *
|
|
6
|
+
*/
|
|
4
7
|
export enum PaymentFailureReason {
|
|
5
8
|
/**
|
|
6
9
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -10,11 +10,15 @@ import { InvoiceDataFromJson, InvoiceDataToJson } from "./InvoiceData.js";
|
|
|
10
10
|
import type PaymentRequestData from "./PaymentRequestData.js";
|
|
11
11
|
import PaymentRequestStatus from "./PaymentRequestStatus.js";
|
|
12
12
|
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* This object contains information related to a payment request generated or received by a
|
|
15
|
+
* LightsparkNode. You can retrieve this object to receive payment information about a specific
|
|
16
|
+
* invoice. *
|
|
17
|
+
*/
|
|
14
18
|
interface PaymentRequest {
|
|
15
19
|
/**
|
|
16
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
17
|
-
* string.
|
|
20
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
21
|
+
* Should be treated as an opaque string.
|
|
18
22
|
**/
|
|
19
23
|
id: string;
|
|
20
24
|
|
|
@@ -9,7 +9,11 @@ import {
|
|
|
9
9
|
import type InvoiceData from "./InvoiceData.js";
|
|
10
10
|
import { NodeFromJson, NodeToJson } from "./Node.js";
|
|
11
11
|
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* This object is an interface of a payment request on the Lightning Network (i.e., a Lightning
|
|
14
|
+
* Invoice). It contains data related to parsing the payment details of a Lightning Invoice.
|
|
15
|
+
* *
|
|
16
|
+
*/
|
|
13
17
|
interface PaymentRequestData {
|
|
14
18
|
encodedPaymentRequest: string;
|
|
15
19
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential states that a payment request on the Lightning Network can
|
|
5
|
+
* take. *
|
|
6
|
+
*/
|
|
4
7
|
export enum PaymentRequestStatus {
|
|
5
8
|
/**
|
|
6
9
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential permissions that a Lightspark user can have in regards to
|
|
5
|
+
* account management. *
|
|
6
|
+
*/
|
|
4
7
|
export enum Permission {
|
|
5
8
|
/**
|
|
6
9
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -5,21 +5,22 @@ import PaymentDirection from "./PaymentDirection.js";
|
|
|
5
5
|
|
|
6
6
|
interface RegisterPaymentInput {
|
|
7
7
|
/**
|
|
8
|
-
* The compliance provider that is going to screen the node.
|
|
9
|
-
* provider and store the API key on the Lightspark
|
|
8
|
+
* The compliance provider that is going to screen the node.
|
|
9
|
+
* You need to be a customer of the selected provider and store the API key on the Lightspark
|
|
10
|
+
* account setting page.
|
|
10
11
|
**/
|
|
11
12
|
provider: ComplianceProvider;
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* The Lightspark ID of the lightning payment you want to register.
|
|
15
|
-
* OutgoingPayment or an IncomingPayment.
|
|
15
|
+
* The Lightspark ID of the lightning payment you want to register.
|
|
16
|
+
* It can be the id of either an OutgoingPayment or an IncomingPayment.
|
|
16
17
|
**/
|
|
17
18
|
paymentId: string;
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
|
-
* The public key of the counterparty lightning node,
|
|
21
|
-
*
|
|
22
|
-
* register an incoming payment.
|
|
21
|
+
* The public key of the counterparty lightning node,
|
|
22
|
+
* which would be the public key of the recipient node if it is to register an outgoing
|
|
23
|
+
* payment, or the public key of the sender node if it is to register an incoming payment.
|
|
23
24
|
**/
|
|
24
25
|
nodePubkey: string;
|
|
25
26
|
|
|
@@ -10,8 +10,8 @@ interface RequestWithdrawalInput {
|
|
|
10
10
|
bitcoinAddress: string;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* The amount you want to withdraw from this node in Satoshis.
|
|
14
|
-
* all funds from this node.
|
|
13
|
+
* The amount you want to withdraw from this node in Satoshis.
|
|
14
|
+
* Use the special value -1 to withdrawal all funds from this node.
|
|
15
15
|
**/
|
|
16
16
|
amountSats: number;
|
|
17
17
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential risk ratings related to a transaction made over the Lightning
|
|
5
|
+
* Network. These risk ratings are returned from the CryptoSanctionScreeningProvider.
|
|
6
|
+
* *
|
|
7
|
+
*/
|
|
4
8
|
export enum RiskRating {
|
|
5
9
|
/**
|
|
6
10
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -11,11 +11,16 @@ import { RichTextFromJson, RichTextToJson } from "./RichText.js";
|
|
|
11
11
|
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
12
12
|
import TransactionStatus from "./TransactionStatus.js";
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* This object represents a transaction that was forwarded through a Lightspark node on the
|
|
16
|
+
* Lightning Network, i.e., a routed transaction.
|
|
17
|
+
* You can retrieve this object to receive information about any transaction routed through your
|
|
18
|
+
* Lightspark Node. *
|
|
19
|
+
*/
|
|
15
20
|
interface RoutingTransaction {
|
|
16
21
|
/**
|
|
17
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
18
|
-
* string.
|
|
22
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
23
|
+
* Should be treated as an opaque string.
|
|
19
24
|
**/
|
|
20
25
|
id: string;
|
|
21
26
|
|
|
@@ -47,8 +52,9 @@ interface RoutingTransaction {
|
|
|
47
52
|
outgoingChannelId?: string | undefined;
|
|
48
53
|
|
|
49
54
|
/**
|
|
50
|
-
* The fees collected by the node when routing this transaction.
|
|
51
|
-
* the incoming amount to determine how much fees were
|
|
55
|
+
* The fees collected by the node when routing this transaction.
|
|
56
|
+
* We subtract the outgoing amount to the incoming amount to determine how much fees were
|
|
57
|
+
* collected.
|
|
52
58
|
**/
|
|
53
59
|
fees?: CurrencyAmount | undefined;
|
|
54
60
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential reasons that an attempted routed transaction through a
|
|
5
|
+
* Lightspark node may have failed. *
|
|
6
|
+
*/
|
|
4
7
|
export enum RoutingTransactionFailureReason {
|
|
5
8
|
/**
|
|
6
9
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -4,8 +4,9 @@ import ComplianceProvider from "./ComplianceProvider.js";
|
|
|
4
4
|
|
|
5
5
|
interface ScreenNodeInput {
|
|
6
6
|
/**
|
|
7
|
-
* The compliance provider that is going to screen the node.
|
|
8
|
-
* provider and store the API key on the Lightspark
|
|
7
|
+
* The compliance provider that is going to screen the node.
|
|
8
|
+
* You need to be a customer of the selected provider and store the API key on the Lightspark
|
|
9
|
+
* account setting page.
|
|
9
10
|
**/
|
|
10
11
|
provider: ComplianceProvider;
|
|
11
12
|
|
|
@@ -13,7 +13,10 @@ interface SendPaymentInput {
|
|
|
13
13
|
/** The amount you will send to the destination node, expressed in msats. **/
|
|
14
14
|
amountMsats: number;
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The maximum amount of fees that you want to pay for this payment to be sent, expressed in
|
|
18
|
+
* msats. *
|
|
19
|
+
*/
|
|
17
20
|
maximumFeesMsats: number;
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -8,8 +8,9 @@ interface SetInvoicePaymentHashInput {
|
|
|
8
8
|
paymentHash: string;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The 32-byte nonce used to generate the invoice preimage if applicable.
|
|
12
|
-
* RELEASE_PAYMENT_PREIMAGE webhook to help recover the raw
|
|
11
|
+
* The 32-byte nonce used to generate the invoice preimage if applicable.
|
|
12
|
+
* It will later be included in RELEASE_PAYMENT_PREIMAGE webhook to help recover the raw
|
|
13
|
+
* preimage.
|
|
13
14
|
**/
|
|
14
15
|
preimageNonce?: string | undefined;
|
|
15
16
|
}
|
package/src/objects/Signable.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { type Query } from "@lightsparkdev/core";
|
|
|
4
4
|
|
|
5
5
|
interface Signable {
|
|
6
6
|
/**
|
|
7
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
8
|
-
* string.
|
|
7
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
8
|
+
* Should be treated as an opaque string.
|
|
9
9
|
**/
|
|
10
10
|
id: string;
|
|
11
11
|
|
|
@@ -5,8 +5,8 @@ import SignablePayloadStatus from "./SignablePayloadStatus.js";
|
|
|
5
5
|
|
|
6
6
|
interface SignablePayload {
|
|
7
7
|
/**
|
|
8
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
9
|
-
* string.
|
|
8
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
9
|
+
* Should be treated as an opaque string.
|
|
10
10
|
**/
|
|
11
11
|
id: string;
|
|
12
12
|
|
|
@@ -19,7 +19,10 @@ interface SignablePayload {
|
|
|
19
19
|
/** The payload that needs to be signed. **/
|
|
20
20
|
payload: string;
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The consistent method for generating the same set of accounts and wallets for a given
|
|
24
|
+
* private key *
|
|
25
|
+
*/
|
|
23
26
|
derivationPath: string;
|
|
24
27
|
|
|
25
28
|
/** The status of the payload. **/
|
|
@@ -26,11 +26,16 @@ import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.j
|
|
|
26
26
|
import TransactionStatus from "./TransactionStatus.js";
|
|
27
27
|
import type Withdrawal from "./Withdrawal.js";
|
|
28
28
|
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* This object represents a payment transaction. The transaction can occur either on a Bitcoin
|
|
31
|
+
* Network, or over the Lightning Network. You can retrieve this object to receive specific
|
|
32
|
+
* information about a particular transaction tied to your Lightspark Node.
|
|
33
|
+
* *
|
|
34
|
+
*/
|
|
30
35
|
interface Transaction {
|
|
31
36
|
/**
|
|
32
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
33
|
-
* string.
|
|
37
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
38
|
+
* Should be treated as an opaque string.
|
|
34
39
|
**/
|
|
35
40
|
id: string;
|
|
36
41
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential statuses a transaction associated with your Lightspark Node can
|
|
5
|
+
* take. *
|
|
6
|
+
*/
|
|
4
7
|
export enum TransactionStatus {
|
|
5
8
|
/**
|
|
6
9
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -13,7 +16,10 @@ export enum TransactionStatus {
|
|
|
13
16
|
FAILED = "FAILED",
|
|
14
17
|
/** Transaction has been initiated and is currently in-flight. **/
|
|
15
18
|
PENDING = "PENDING",
|
|
16
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* For transaction type PAYMENT_REQUEST only. No payments have been made to a payment request.
|
|
21
|
+
* *
|
|
22
|
+
*/
|
|
17
23
|
NOT_STARTED = "NOT_STARTED",
|
|
18
24
|
/** For transaction type PAYMENT_REQUEST only. A payment request has expired. **/
|
|
19
25
|
EXPIRED = "EXPIRED",
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential types of transactions that can be associated with your
|
|
5
|
+
* Lightspark Node. *
|
|
6
|
+
*/
|
|
4
7
|
export enum TransactionType {
|
|
5
8
|
/**
|
|
6
9
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -13,13 +16,22 @@ export enum TransactionType {
|
|
|
13
16
|
INCOMING_PAYMENT = "INCOMING_PAYMENT",
|
|
14
17
|
/** Transactions that forwarded payments through Lightspark nodes on Lightning Network. **/
|
|
15
18
|
ROUTED = "ROUTED",
|
|
16
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Transactions on the Bitcoin blockchain to withdraw funds from a Lightspark node to a Bitcoin
|
|
21
|
+
* wallet. *
|
|
22
|
+
*/
|
|
17
23
|
L1_WITHDRAW = "L1_WITHDRAW",
|
|
18
24
|
/** Transactions on Bitcoin blockchain to fund a Lightspark node's wallet. **/
|
|
19
25
|
L1_DEPOSIT = "L1_DEPOSIT",
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Transactions on Bitcoin blockchain to open a channel on Lightning Network funded by the local
|
|
28
|
+
* Lightspark node. *
|
|
29
|
+
*/
|
|
21
30
|
CHANNEL_OPEN = "CHANNEL_OPEN",
|
|
22
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Transactions on Bitcoin blockchain to close a channel on Lightning Network where the balances
|
|
33
|
+
* are allocated back to local and remote nodes. *
|
|
34
|
+
*/
|
|
23
35
|
CHANNEL_CLOSE = "CHANNEL_CLOSE",
|
|
24
36
|
/** Transactions initiated from a Lightspark node on Lightning Network. **/
|
|
25
37
|
PAYMENT = "PAYMENT",
|
|
@@ -6,8 +6,8 @@ import TransactionStatus from "./TransactionStatus.js";
|
|
|
6
6
|
|
|
7
7
|
type TransactionUpdate = {
|
|
8
8
|
/**
|
|
9
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
10
|
-
* string.
|
|
9
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
10
|
+
* Should be treated as an opaque string.
|
|
11
11
|
**/
|
|
12
12
|
id: string;
|
|
13
13
|
|
|
@@ -29,7 +29,10 @@ type TransactionUpdate = {
|
|
|
29
29
|
/** The date and time when this transaction was completed or failed. **/
|
|
30
30
|
resolvedAt?: string;
|
|
31
31
|
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* The hash of this transaction, so it can be uniquely identified on the
|
|
34
|
+
* Lightning Network. *
|
|
35
|
+
*/
|
|
33
36
|
transactionHash?: string;
|
|
34
37
|
};
|
|
35
38
|
|
|
@@ -7,8 +7,8 @@ import IncentivesStatus from "./IncentivesStatus.js";
|
|
|
7
7
|
/** This is an object representing an UMA.ME invitation. **/
|
|
8
8
|
interface UmaInvitation {
|
|
9
9
|
/**
|
|
10
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
11
|
-
* string.
|
|
10
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
11
|
+
* Should be treated as an opaque string.
|
|
12
12
|
**/
|
|
13
13
|
id: string;
|
|
14
14
|
|
package/src/objects/Wallet.ts
CHANGED
|
@@ -17,19 +17,27 @@ import { WalletToPaymentRequestsConnectionFromJson } from "./WalletToPaymentRequ
|
|
|
17
17
|
import type WalletToTransactionsConnection from "./WalletToTransactionsConnection.js";
|
|
18
18
|
import { WalletToTransactionsConnectionFromJson } from "./WalletToTransactionsConnection.js";
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* This object represents a Lightspark Wallet, tied to your Lightspark account.
|
|
22
|
+
* Wallets can be used to send or receive funds over the Lightning Network.
|
|
23
|
+
* You can retrieve this object to receive information about a specific wallet tied to your
|
|
24
|
+
* Lightspark account. *
|
|
25
|
+
*/
|
|
21
26
|
class Wallet implements LightsparkNodeOwner, Entity {
|
|
22
27
|
constructor(
|
|
23
28
|
/**
|
|
24
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
25
|
-
* string.
|
|
29
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
30
|
+
* Should be treated as an opaque string.
|
|
26
31
|
**/
|
|
27
32
|
public readonly id: string,
|
|
28
33
|
/** The date and time when the entity was first created. **/
|
|
29
34
|
public readonly createdAt: string,
|
|
30
35
|
/** The date and time when the entity was last updated. **/
|
|
31
36
|
public readonly updatedAt: string,
|
|
32
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The unique identifier of this wallet, as provided by the Lightspark Customer during login.
|
|
39
|
+
* *
|
|
40
|
+
*/
|
|
33
41
|
public readonly thirdPartyIdentifier: string,
|
|
34
42
|
/** The status of this wallet. **/
|
|
35
43
|
public readonly status: WalletStatus,
|
|
@@ -7,11 +7,18 @@ export enum WalletStatus {
|
|
|
7
7
|
* Clients should support unknown values as more of them could be added without notice.
|
|
8
8
|
*/
|
|
9
9
|
FUTURE_VALUE = "FUTURE_VALUE",
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The wallet has not been set up yet and is ready to be deployed.
|
|
12
|
+
* This is the default status after the first login.
|
|
13
|
+
* *
|
|
14
|
+
*/
|
|
11
15
|
NOT_SETUP = "NOT_SETUP",
|
|
12
16
|
/** The wallet is currently being deployed in the Lightspark infrastructure. **/
|
|
13
17
|
DEPLOYING = "DEPLOYING",
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The wallet has been deployed in the Lightspark infrastructure and is ready to be initialized.
|
|
20
|
+
* *
|
|
21
|
+
*/
|
|
15
22
|
DEPLOYED = "DEPLOYED",
|
|
16
23
|
/** The wallet is currently being initialized. **/
|
|
17
24
|
INITIALIZING = "INITIALIZING",
|
|
@@ -19,11 +26,18 @@ export enum WalletStatus {
|
|
|
19
26
|
READY = "READY",
|
|
20
27
|
/** The wallet is temporarily available, due to a transient issue or a scheduled maintenance. **/
|
|
21
28
|
UNAVAILABLE = "UNAVAILABLE",
|
|
22
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* The wallet had an unrecoverable failure. This status is not expected to happend and will be
|
|
31
|
+
* investigated by the Lightspark team. *
|
|
32
|
+
*/
|
|
23
33
|
FAILED = "FAILED",
|
|
24
34
|
/** The wallet is being terminated. **/
|
|
25
35
|
TERMINATING = "TERMINATING",
|
|
26
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The wallet has been terminated and is not available in the Lightspark infrastructure anymore.
|
|
38
|
+
* It is not connected to the Lightning network and its funds can only be accessed using the Funds
|
|
39
|
+
* Recovery flow. *
|
|
40
|
+
*/
|
|
27
41
|
TERMINATED = "TERMINATED",
|
|
28
42
|
}
|
|
29
43
|
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
|
|
11
11
|
interface WalletToPaymentRequestsConnection {
|
|
12
12
|
/**
|
|
13
|
-
* The total count of objects in this connection, using the current filters.
|
|
14
|
-
* number of objects returned in the current page (in the `entities`
|
|
13
|
+
* The total count of objects in this connection, using the current filters.
|
|
14
|
+
* It is different from the number of objects returned in the current page (in the `entities`
|
|
15
|
+
* field).
|
|
15
16
|
**/
|
|
16
17
|
count: number;
|
|
17
18
|
|
|
@@ -7,8 +7,9 @@ import { TransactionFromJson, TransactionToJson } from "./Transaction.js";
|
|
|
7
7
|
|
|
8
8
|
interface WalletToTransactionsConnection {
|
|
9
9
|
/**
|
|
10
|
-
* The total count of objects in this connection, using the current filters.
|
|
11
|
-
* number of objects returned in the current page (in the `entities`
|
|
10
|
+
* The total count of objects in this connection, using the current filters.
|
|
11
|
+
* It is different from the number of objects returned in the current page (in the `entities`
|
|
12
|
+
* field).
|
|
12
13
|
**/
|
|
13
14
|
count: number;
|
|
14
15
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an enum of the potential event types that can be associated with your Lightspark
|
|
5
|
+
* wallets. *
|
|
6
|
+
*/
|
|
4
7
|
export enum WebhookEventType {
|
|
5
8
|
/**
|
|
6
9
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -8,11 +8,15 @@ import {
|
|
|
8
8
|
} from "./CurrencyAmount.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* This object represents an L1 withdrawal from your Lightspark Node to any Bitcoin wallet.
|
|
13
|
+
* You can retrieve this object to receive detailed information about any L1 withdrawal associated
|
|
14
|
+
* with your Lightspark Node or account. *
|
|
15
|
+
*/
|
|
12
16
|
interface Withdrawal {
|
|
13
17
|
/**
|
|
14
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
15
|
-
* string.
|
|
18
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
19
|
+
* Should be treated as an opaque string.
|
|
16
20
|
**/
|
|
17
21
|
id: string;
|
|
18
22
|
|