@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
package/src/objects/Account.ts
CHANGED
|
@@ -26,12 +26,16 @@ import type TransactionFailures from "./TransactionFailures.js";
|
|
|
26
26
|
import type TransactionStatus from "./TransactionStatus.js";
|
|
27
27
|
import type TransactionType from "./TransactionType.js";
|
|
28
28
|
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* This is an object representing the connected Lightspark account.
|
|
31
|
+
* You can retrieve this object to see your account information and objects tied to your account.
|
|
32
|
+
* *
|
|
33
|
+
*/
|
|
30
34
|
class Account implements LightsparkNodeOwner, Entity {
|
|
31
35
|
constructor(
|
|
32
36
|
/**
|
|
33
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
34
|
-
* string.
|
|
37
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
38
|
+
* Should be treated as an opaque string.
|
|
35
39
|
**/
|
|
36
40
|
public readonly id: string,
|
|
37
41
|
/** The date and time when the entity was first created. **/
|
|
@@ -7,8 +7,9 @@ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
|
7
7
|
|
|
8
8
|
interface AccountToApiTokensConnection {
|
|
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
|
|
|
@@ -7,8 +7,9 @@ import { ChannelFromJson } from "./Channel.js";
|
|
|
7
7
|
class AccountToChannelsConnection {
|
|
8
8
|
constructor(
|
|
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
|
public readonly count: number,
|
|
14
15
|
/** The channels for the current page of this connection. **/
|
|
@@ -11,8 +11,9 @@ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
|
11
11
|
/** A connection between an account and the nodes it manages. **/
|
|
12
12
|
interface AccountToNodesConnection {
|
|
13
13
|
/**
|
|
14
|
-
* The total count of objects in this connection, using the current filters.
|
|
15
|
-
* 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).
|
|
16
17
|
**/
|
|
17
18
|
count: number;
|
|
18
19
|
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
|
|
11
11
|
interface AccountToPaymentRequestsConnection {
|
|
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
|
|
|
@@ -12,8 +12,9 @@ import { TransactionFromJson, TransactionToJson } from "./Transaction.js";
|
|
|
12
12
|
|
|
13
13
|
interface AccountToTransactionsConnection {
|
|
14
14
|
/**
|
|
15
|
-
* The total count of objects in this connection, using the current filters.
|
|
16
|
-
* number of objects returned in the current page (in the `entities`
|
|
15
|
+
* The total count of objects in this connection, using the current filters.
|
|
16
|
+
* It is different from the number of objects returned in the current page (in the `entities`
|
|
17
|
+
* field).
|
|
17
18
|
**/
|
|
18
19
|
count: number;
|
|
19
20
|
|
|
@@ -27,14 +28,14 @@ interface AccountToTransactionsConnection {
|
|
|
27
28
|
typename: string;
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
|
-
* Profit (or loss) generated by the transactions in this connection,
|
|
31
|
-
* constraints provided.
|
|
31
|
+
* Profit (or loss) generated by the transactions in this connection,
|
|
32
|
+
* with the set of filters and constraints provided.
|
|
32
33
|
**/
|
|
33
34
|
profitLoss?: CurrencyAmount | undefined;
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
* Average fee earned for the transactions in this connection,
|
|
37
|
-
* provided.
|
|
37
|
+
* Average fee earned for the transactions in this connection,
|
|
38
|
+
* with the set of filters and constraints provided.
|
|
38
39
|
**/
|
|
39
40
|
averageFeeEarned?: CurrencyAmount | undefined;
|
|
40
41
|
|
|
@@ -7,8 +7,9 @@ import { WalletFromJson } from "./Wallet.js";
|
|
|
7
7
|
|
|
8
8
|
interface AccountToWalletsConnection {
|
|
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
|
|
package/src/objects/ApiToken.ts
CHANGED
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import Permission from "./Permission.js";
|
|
5
5
|
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* This is an object representing a Lightspark API token,
|
|
8
|
+
* that can be used to authenticate this account when making API calls or using our SDKs.
|
|
9
|
+
* See the “Authentication” section of our API docs for more details on its usage.
|
|
10
|
+
* *
|
|
11
|
+
*/
|
|
7
12
|
interface ApiToken {
|
|
8
13
|
/**
|
|
9
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
10
|
-
* string.
|
|
14
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
15
|
+
* Should be treated as an opaque string.
|
|
11
16
|
**/
|
|
12
17
|
id: string;
|
|
13
18
|
|
|
@@ -24,8 +29,8 @@ interface ApiToken {
|
|
|
24
29
|
clientId: string;
|
|
25
30
|
|
|
26
31
|
/**
|
|
27
|
-
* An arbitrary name chosen by the creator of the token to help identify the token in the list
|
|
28
|
-
* tokens that have been created for the account.
|
|
32
|
+
* An arbitrary name chosen by the creator of the token to help identify the token in the list
|
|
33
|
+
* of tokens that have been created for the account.
|
|
29
34
|
**/
|
|
30
35
|
name: string;
|
|
31
36
|
|
package/src/objects/Balances.ts
CHANGED
|
@@ -6,28 +6,36 @@ import {
|
|
|
6
6
|
CurrencyAmountToJson,
|
|
7
7
|
} from "./CurrencyAmount.js";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* This is an object representing the balance associated with your Lightspark account.
|
|
11
|
+
* You can retrieve this object to see your balance,
|
|
12
|
+
* which can be broken down into several different categorizations.
|
|
13
|
+
* *
|
|
14
|
+
*/
|
|
10
15
|
interface Balances {
|
|
11
16
|
/**
|
|
12
|
-
* This represents the balance that should be displayed when asked "how much do I own right
|
|
13
|
-
* represents the amount currently owned,
|
|
14
|
-
*
|
|
15
|
-
* officially owned at this
|
|
17
|
+
* This represents the balance that should be displayed when asked "how much do I own right
|
|
18
|
+
* now?". It represents the amount currently owned,
|
|
19
|
+
* including things that may not be owned soon (e.g. in-flight outgoing payments, in-flight
|
|
20
|
+
* withdrawals, commit fees, etc.). It really is a snapshot of what is officially owned at this
|
|
21
|
+
* instant.
|
|
16
22
|
**/
|
|
17
23
|
ownedBalance: CurrencyAmount;
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
|
-
* This represents the balance that should be displayed when asked "how much can I send on
|
|
21
|
-
* right now?". It represents the amount currently available to be sent on the
|
|
22
|
-
* remove from the balance all the funds that are temporarily locked
|
|
26
|
+
* This represents the balance that should be displayed when asked "how much can I send on
|
|
27
|
+
* Lightning right now?". It represents the amount currently available to be sent on the
|
|
28
|
+
* Lightning network. We remove from the balance all the funds that are temporarily locked
|
|
29
|
+
* (e.g. channel reserves).
|
|
23
30
|
**/
|
|
24
31
|
availableToSendBalance: CurrencyAmount;
|
|
25
32
|
|
|
26
33
|
/**
|
|
27
|
-
* This represents the balance that should be displayed when asked "how much money can I
|
|
28
|
-
* the Bitcoin network right now?".
|
|
29
|
-
*
|
|
30
|
-
*
|
|
34
|
+
* This represents the balance that should be displayed when asked "how much money can I
|
|
35
|
+
* withdraw on the Bitcoin network right now?".
|
|
36
|
+
* It represents the amount currently available to withdraw and is usually equal to the
|
|
37
|
+
* `owned_balance` but it does not include in-flight operations (which would likely succeed and
|
|
38
|
+
* therefore likely make your withdrawal fail).
|
|
31
39
|
**/
|
|
32
40
|
availableToWithdrawBalance: CurrencyAmount;
|
|
33
41
|
}
|
|
@@ -11,7 +11,10 @@ export enum BitcoinNetwork {
|
|
|
11
11
|
MAINNET = "MAINNET",
|
|
12
12
|
/** A test version of the Bitcoin Blockchain, maintained by Lightspark. **/
|
|
13
13
|
REGTEST = "REGTEST",
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* A test version of the Bitcoin Blockchain, maintained by a centralized organization.
|
|
16
|
+
* Not in use at Lightspark. *
|
|
17
|
+
*/
|
|
15
18
|
SIGNET = "SIGNET",
|
|
16
19
|
/** A test version of the Bitcoin Blockchain, publicly available. **/
|
|
17
20
|
TESTNET = "TESTNET",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
interface CancelInvoiceInput {
|
|
4
|
+
invoiceId: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const CancelInvoiceInputFromJson = (obj: any): CancelInvoiceInput => {
|
|
8
|
+
return {
|
|
9
|
+
invoiceId: obj["cancel_invoice_input_invoice_id"],
|
|
10
|
+
} as CancelInvoiceInput;
|
|
11
|
+
};
|
|
12
|
+
export const CancelInvoiceInputToJson = (obj: CancelInvoiceInput): any => {
|
|
13
|
+
return {
|
|
14
|
+
cancel_invoice_input_invoice_id: obj.invoiceId,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default CancelInvoiceInput;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
interface CancelInvoiceOutput {
|
|
4
|
+
invoiceId: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const CancelInvoiceOutputFromJson = (obj: any): CancelInvoiceOutput => {
|
|
8
|
+
return {
|
|
9
|
+
invoiceId: obj["cancel_invoice_output_invoice"].id,
|
|
10
|
+
} as CancelInvoiceOutput;
|
|
11
|
+
};
|
|
12
|
+
export const CancelInvoiceOutputToJson = (obj: CancelInvoiceOutput): any => {
|
|
13
|
+
return {
|
|
14
|
+
cancel_invoice_output_invoice: { id: obj.invoiceId },
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const FRAGMENT = `
|
|
19
|
+
fragment CancelInvoiceOutputFragment on CancelInvoiceOutput {
|
|
20
|
+
__typename
|
|
21
|
+
cancel_invoice_output_invoice: invoice {
|
|
22
|
+
id
|
|
23
|
+
}
|
|
24
|
+
}`;
|
|
25
|
+
|
|
26
|
+
export default CancelInvoiceOutput;
|
package/src/objects/Channel.ts
CHANGED
|
@@ -16,12 +16,16 @@ import {
|
|
|
16
16
|
import type Entity from "./Entity.js";
|
|
17
17
|
import type TransactionType from "./TransactionType.js";
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* This is an object representing a channel on the Lightning Network.
|
|
21
|
+
* You can retrieve this object to get detailed information on a specific Lightning Network
|
|
22
|
+
* channel. *
|
|
23
|
+
*/
|
|
20
24
|
class Channel implements Entity {
|
|
21
25
|
constructor(
|
|
22
26
|
/**
|
|
23
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
24
|
-
* string.
|
|
27
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
28
|
+
* Should be treated as an opaque string.
|
|
25
29
|
**/
|
|
26
30
|
public readonly id: string,
|
|
27
31
|
/** The date and time when the entity was first created. **/
|
|
@@ -35,27 +39,36 @@ class Channel implements Entity {
|
|
|
35
39
|
/** The transaction that funded the channel upon channel opening. **/
|
|
36
40
|
public readonly fundingTransactionId?: string | undefined,
|
|
37
41
|
/**
|
|
38
|
-
* The total amount of funds in this channel, including the channel balance on the local node,
|
|
39
|
-
* channel balance on the remote node and the on-chain fees to close the channel.
|
|
42
|
+
* The total amount of funds in this channel, including the channel balance on the local node,
|
|
43
|
+
* the channel balance on the remote node and the on-chain fees to close the channel.
|
|
40
44
|
**/
|
|
41
45
|
public readonly capacity?: CurrencyAmount | undefined,
|
|
42
46
|
/** The channel balance on the local node. **/
|
|
43
47
|
public readonly localBalance?: CurrencyAmount | undefined,
|
|
44
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The channel balance on the local node that is currently allocated to in-progress payments.
|
|
50
|
+
* *
|
|
51
|
+
*/
|
|
45
52
|
public readonly localUnsettledBalance?: CurrencyAmount | undefined,
|
|
46
53
|
/** The channel balance on the remote node. **/
|
|
47
54
|
public readonly remoteBalance?: CurrencyAmount | undefined,
|
|
48
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The channel balance on the remote node that is currently allocated to in-progress payments.
|
|
57
|
+
* *
|
|
58
|
+
*/
|
|
49
59
|
public readonly remoteUnsettledBalance?: CurrencyAmount | undefined,
|
|
50
60
|
/** The channel balance that is currently allocated to in-progress payments. **/
|
|
51
61
|
public readonly unsettledBalance?: CurrencyAmount | undefined,
|
|
52
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* The total balance in this channel, including the channel balance on both local and remote
|
|
64
|
+
* nodes. *
|
|
65
|
+
*/
|
|
53
66
|
public readonly totalBalance?: CurrencyAmount | undefined,
|
|
54
67
|
/** The current status of this channel. **/
|
|
55
68
|
public readonly status?: ChannelStatus | undefined,
|
|
56
69
|
/**
|
|
57
|
-
* The estimated time to wait for the channel's hash timelock contract to expire when force
|
|
58
|
-
* the channel. It is in unit of minutes.
|
|
70
|
+
* The estimated time to wait for the channel's hash timelock contract to expire when force
|
|
71
|
+
* closing the channel. It is in unit of minutes.
|
|
59
72
|
**/
|
|
60
73
|
public readonly estimatedForceClosureWaitMinutes?: number | undefined,
|
|
61
74
|
/** The amount to be paid in fees for the current set of commitment transactions. **/
|
|
@@ -65,8 +78,9 @@ class Channel implements Entity {
|
|
|
65
78
|
/** If known, the remote node of the channel. **/
|
|
66
79
|
public readonly remoteNodeId?: string | undefined,
|
|
67
80
|
/**
|
|
68
|
-
* The unique identifier of the channel on Lightning Network,
|
|
69
|
-
* the channel was confirmed. The format is
|
|
81
|
+
* The unique identifier of the channel on Lightning Network,
|
|
82
|
+
* which is the location in the chain that the channel was confirmed. The format is
|
|
83
|
+
* <block-height>:<tx-index>:<tx-output>.
|
|
70
84
|
**/
|
|
71
85
|
public readonly shortChannelId?: string | undefined,
|
|
72
86
|
) {
|
|
@@ -8,11 +8,15 @@ import {
|
|
|
8
8
|
} from "./CurrencyAmount.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* This is an object representing a transaction which closes a channel on the Lightning Network.
|
|
13
|
+
* This operation allocates balances back to the local and remote nodes.
|
|
14
|
+
* *
|
|
15
|
+
*/
|
|
12
16
|
interface ChannelClosingTransaction {
|
|
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
|
|
|
@@ -8,11 +8,15 @@ import {
|
|
|
8
8
|
} from "./CurrencyAmount.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* This is an object representing a transaction which opens a channel on the Lightning Network.
|
|
13
|
+
* This object occurs only for channels funded by the local Lightspark node.
|
|
14
|
+
* *
|
|
15
|
+
*/
|
|
12
16
|
interface ChannelOpeningTransaction {
|
|
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
|
|
|
@@ -9,17 +9,36 @@ export enum ChannelStatus {
|
|
|
9
9
|
FUTURE_VALUE = "FUTURE_VALUE",
|
|
10
10
|
/** The channel is online and ready to send and receive funds. **/
|
|
11
11
|
OK = "OK",
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The channel has been created, but the Bitcoin transaction that initiates it still needs to be
|
|
14
|
+
* confirmed on the Bitcoin blockchain. *
|
|
15
|
+
*/
|
|
13
16
|
PENDING = "PENDING",
|
|
14
17
|
/** The channel is not available, likely because the peer is not online. **/
|
|
15
18
|
OFFLINE = "OFFLINE",
|
|
16
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The channel is behaving properly, but its remote balance is much higher than its local balance
|
|
21
|
+
* so it is not balanced properly for sending funds out.
|
|
22
|
+
* *
|
|
23
|
+
*/
|
|
17
24
|
UNBALANCED_FOR_SEND = "UNBALANCED_FOR_SEND",
|
|
18
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The channel is behaving properly, but its remote balance is much lower than its local balance
|
|
27
|
+
* so it is not balanced properly for receiving funds.
|
|
28
|
+
* *
|
|
29
|
+
*/
|
|
19
30
|
UNBALANCED_FOR_RECEIVE = "UNBALANCED_FOR_RECEIVE",
|
|
20
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* The channel has been closed. Information about the channel is still available for historical
|
|
33
|
+
* purposes but the channel cannot be used anymore.
|
|
34
|
+
* *
|
|
35
|
+
*/
|
|
21
36
|
CLOSED = "CLOSED",
|
|
22
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Something unexpected happened and we cannot determine the status of this channel.
|
|
39
|
+
* Please try again later or contact the support.
|
|
40
|
+
* *
|
|
41
|
+
*/
|
|
23
42
|
ERROR = "ERROR",
|
|
24
43
|
}
|
|
25
44
|
|
|
@@ -8,26 +8,27 @@ import {
|
|
|
8
8
|
|
|
9
9
|
interface ChannelToTransactionsConnection {
|
|
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
|
|
|
16
17
|
/**
|
|
17
|
-
* The average fee for the transactions that transited through this channel,
|
|
18
|
-
* and constraints of the connection.
|
|
18
|
+
* The average fee for the transactions that transited through this channel,
|
|
19
|
+
* according to the filters and constraints of the connection.
|
|
19
20
|
**/
|
|
20
21
|
averageFee?: CurrencyAmount | undefined;
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
* The total amount transacted for the transactions that transited through this channel,
|
|
24
|
-
* the filters and constraints of the connection.
|
|
24
|
+
* The total amount transacted for the transactions that transited through this channel,
|
|
25
|
+
* according to the filters and constraints of the connection.
|
|
25
26
|
**/
|
|
26
27
|
totalAmountTransacted?: CurrencyAmount | undefined;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* The total amount of fees for the transactions that transited through this channel,
|
|
30
|
-
* filters and constraints of the connection.
|
|
30
|
+
* The total amount of fees for the transactions that transited through this channel,
|
|
31
|
+
* according to the filters and constraints of the connection.
|
|
31
32
|
**/
|
|
32
33
|
totalFees?: CurrencyAmount | undefined;
|
|
33
34
|
}
|
|
@@ -39,8 +39,9 @@ import type WalletToTransactionsConnection from "./WalletToTransactionsConnectio
|
|
|
39
39
|
|
|
40
40
|
interface Connection {
|
|
41
41
|
/**
|
|
42
|
-
* The total count of objects in this connection, using the current filters.
|
|
43
|
-
* number of objects returned in the current page (in the `entities`
|
|
42
|
+
* The total count of objects in this connection, using the current filters.
|
|
43
|
+
* It is different from the number of objects returned in the current page (in the `entities`
|
|
44
|
+
* field).
|
|
44
45
|
**/
|
|
45
46
|
count: number;
|
|
46
47
|
|
|
@@ -8,9 +8,9 @@ interface CreateApiTokenOutput {
|
|
|
8
8
|
apiToken: ApiToken;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The secret that should be used to authenticate against our API.
|
|
12
|
-
* never be available again after this.
|
|
13
|
-
* account.
|
|
11
|
+
* The secret that should be used to authenticate against our API.
|
|
12
|
+
* This secret is not stored and will never be available again after this.
|
|
13
|
+
* You must keep this secret secure as it grants access to your account.
|
|
14
14
|
**/
|
|
15
15
|
clientSecret: string;
|
|
16
16
|
}
|
|
@@ -8,8 +8,9 @@ interface CreateLnurlInvoiceInput {
|
|
|
8
8
|
amountMsats: number;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The SHA256 hash of the LNURL metadata payload.
|
|
12
|
-
* payment) of the resulting Bolt 11
|
|
11
|
+
* The SHA256 hash of the LNURL metadata payload.
|
|
12
|
+
* This will be present in the h-tag (SHA256 purpose of payment) of the resulting Bolt 11
|
|
13
|
+
* invoice.
|
|
13
14
|
**/
|
|
14
15
|
metadataHash: string;
|
|
15
16
|
|
|
@@ -8,8 +8,8 @@ interface CreateTestModePaymentInput {
|
|
|
8
8
|
encodedInvoice: string;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The amount you will be paid for this invoice, expressed in msats.
|
|
12
|
-
* invoice amount is zero.
|
|
11
|
+
* The amount you will be paid for this invoice, expressed in msats.
|
|
12
|
+
* It should ONLY be set when the invoice amount is zero.
|
|
13
13
|
**/
|
|
14
14
|
amountMsats?: number | undefined;
|
|
15
15
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This is an object identifying the output of a test mode payment.
|
|
5
|
+
* This object can be used to retrieve the associated payment made from a Test Mode Payment call.
|
|
6
|
+
* *
|
|
7
|
+
*/
|
|
4
8
|
interface CreateTestModePaymentoutput {
|
|
5
9
|
/**
|
|
6
10
|
* The payment that has been sent.
|
|
@@ -20,8 +20,8 @@ interface CurrencyAmount {
|
|
|
20
20
|
preferredCurrencyValueRounded: number;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* The approximate float value for this CurrencyAmount in the very base level of user's
|
|
24
|
-
* currency. For example, for USD, the value will be in cents.
|
|
23
|
+
* The approximate float value for this CurrencyAmount in the very base level of user's
|
|
24
|
+
* preferred currency. For example, for USD, the value will be in cents.
|
|
25
25
|
**/
|
|
26
26
|
preferredCurrencyValueApprox: number;
|
|
27
27
|
}
|
|
@@ -7,19 +7,42 @@ export enum CurrencyUnit {
|
|
|
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
|
+
* Bitcoin is the cryptocurrency native to the Bitcoin network.
|
|
12
|
+
* It is used as the native medium for value transfer for the Lightning Network.
|
|
13
|
+
* *
|
|
14
|
+
*/
|
|
11
15
|
BITCOIN = "BITCOIN",
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* 0.00000001 (10e-8) Bitcoin or one hundred millionth of a Bitcoin.
|
|
18
|
+
* This is the unit most commonly used in Lightning transactions.
|
|
19
|
+
* *
|
|
20
|
+
*/
|
|
13
21
|
SATOSHI = "SATOSHI",
|
|
14
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* 0.001 Satoshi, or 10e-11 Bitcoin. We recommend using the Satoshi unit instead when possible.
|
|
24
|
+
* *
|
|
25
|
+
*/
|
|
15
26
|
MILLISATOSHI = "MILLISATOSHI",
|
|
16
27
|
/** United States Dollar. **/
|
|
17
28
|
USD = "USD",
|
|
18
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* 0.000000001 (10e-9) Bitcoin or a billionth of a Bitcoin.
|
|
31
|
+
* We recommend using the Satoshi unit instead when possible.
|
|
32
|
+
* *
|
|
33
|
+
*/
|
|
19
34
|
NANOBITCOIN = "NANOBITCOIN",
|
|
20
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* 0.000001 (10e-6) Bitcoin or a millionth of a Bitcoin.
|
|
37
|
+
* We recommend using the Satoshi unit instead when possible.
|
|
38
|
+
* *
|
|
39
|
+
*/
|
|
21
40
|
MICROBITCOIN = "MICROBITCOIN",
|
|
22
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* 0.001 (10e-3) Bitcoin or a thousandth of a Bitcoin.
|
|
43
|
+
* We recommend using the Satoshi unit instead when possible.
|
|
44
|
+
* *
|
|
45
|
+
*/
|
|
23
46
|
MILLIBITCOIN = "MILLIBITCOIN",
|
|
24
47
|
}
|
|
25
48
|
|
package/src/objects/Deposit.ts
CHANGED
|
@@ -8,11 +8,16 @@ import {
|
|
|
8
8
|
} from "./CurrencyAmount.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* This object represents a Deposit made to a Lightspark node wallet.
|
|
13
|
+
* This operation occurs for any L1 funding transaction to the wallet.
|
|
14
|
+
* You can retrieve this object to receive detailed information about the deposit.
|
|
15
|
+
* *
|
|
16
|
+
*/
|
|
12
17
|
interface Deposit {
|
|
13
18
|
/**
|
|
14
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
15
|
-
* string.
|
|
19
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
20
|
+
* Should be treated as an opaque string.
|
|
16
21
|
**/
|
|
17
22
|
id: string;
|
|
18
23
|
|
package/src/objects/Entity.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* This interface is used by all the entities in the Lightspark system.
|
|
5
|
+
* It defines a few core fields that are available everywhere.
|
|
6
|
+
* Any object that implements this interface can be queried using the `entity` query and its ID.
|
|
7
|
+
* *
|
|
8
|
+
*/
|
|
4
9
|
interface Entity {
|
|
5
10
|
/**
|
|
6
|
-
* The unique identifier of this entity across all Lightspark systems.
|
|
7
|
-
* string.
|
|
11
|
+
* The unique identifier of this entity across all Lightspark systems.
|
|
12
|
+
* Should be treated as an opaque string.
|
|
8
13
|
**/
|
|
9
14
|
id: string;
|
|
10
15
|
|
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
CurrencyAmountToJson,
|
|
7
7
|
} from "./CurrencyAmount.js";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* This object represents the estimated L1 transaction fees for the Bitcoin network.
|
|
11
|
+
* Fee estimates are separated by potential confirmation speeds for settlement.
|
|
12
|
+
* *
|
|
13
|
+
*/
|
|
10
14
|
interface FeeEstimate {
|
|
11
15
|
feeFast: CurrencyAmount;
|
|
12
16
|
|