@lightsparkdev/lightspark-sdk 1.2.1 → 1.2.3
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 +14 -0
- package/dist/{BitcoinNetwork-a816c0be.d.ts → BitcoinNetwork-37e9f091.d.ts} +8 -3
- package/dist/{chunk-VTPDR6P4.js → chunk-NCPWHRFO.js} +353 -15
- package/dist/env.d.cts +1 -1
- package/dist/env.d.ts +1 -1
- package/dist/{index-5acc6526.d.ts → index-449c9f58.d.ts} +2089 -644
- package/dist/index.cjs +1082 -470
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +584 -302
- package/dist/objects/index.cjs +345 -5
- package/dist/objects/index.d.cts +2 -2
- package/dist/objects/index.d.ts +2 -2
- package/dist/objects/index.js +9 -1
- package/package.json +4 -4
- package/src/NodeKeyLoaderCache.ts +4 -3
- package/src/SigningKeyLoader.ts +12 -7
- package/src/client.ts +287 -60
- package/src/env.ts +3 -1
- package/src/graphql/ClaimUmaInvitation.ts +21 -0
- package/src/graphql/ClaimUmaInvitationWithIncentives.ts +25 -0
- package/src/graphql/CreateUmaInvitation.ts +19 -0
- package/src/graphql/CreateUmaInvitationWithIncentives.ts +23 -0
- package/src/graphql/FetchUmaInvitation.ts +15 -0
- package/src/objects/Account.ts +7 -3
- package/src/objects/AccountToApiTokensConnection.ts +7 -3
- package/src/objects/AccountToChannelsConnection.ts +3 -2
- package/src/objects/AccountToNodesConnection.ts +7 -3
- package/src/objects/AccountToPaymentRequestsConnection.ts +7 -3
- package/src/objects/AccountToTransactionsConnection.ts +13 -9
- package/src/objects/AccountToWalletsConnection.ts +7 -3
- package/src/objects/ApiToken.ts +13 -7
- package/src/objects/Balances.ts +22 -12
- package/src/objects/BitcoinNetwork.ts +8 -3
- package/src/objects/BlockchainBalance.ts +4 -1
- package/src/objects/Channel.ts +37 -14
- package/src/objects/ChannelClosingTransaction.ts +22 -11
- package/src/objects/ChannelFees.ts +4 -1
- package/src/objects/ChannelOpeningTransaction.ts +22 -11
- package/src/objects/ChannelStatus.ts +33 -8
- package/src/objects/ChannelToTransactionsConnection.ts +9 -8
- package/src/objects/ClaimUmaInvitationInput.ts +26 -0
- package/src/objects/ClaimUmaInvitationOutput.ts +30 -0
- package/src/objects/ClaimUmaInvitationWithIncentivesInput.ts +44 -0
- package/src/objects/ClaimUmaInvitationWithIncentivesOutput.ts +33 -0
- package/src/objects/ComplianceProvider.ts +3 -2
- package/src/objects/Connection.ts +7 -3
- package/src/objects/CreateApiTokenInput.ts +4 -1
- package/src/objects/CreateApiTokenOutput.ts +3 -3
- package/src/objects/CreateInvitationWithIncentivesInput.ts +37 -0
- package/src/objects/CreateInvitationWithIncentivesOutput.ts +32 -0
- package/src/objects/CreateLnurlInvoiceInput.ts +3 -2
- package/src/objects/CreateTestModePaymentInput.ts +2 -2
- package/src/objects/CreateTestModePaymentoutput.ts +5 -1
- package/src/objects/CreateUmaInvitationInput.ts +22 -0
- package/src/objects/CreateUmaInvitationOutput.ts +30 -0
- package/src/objects/CurrencyAmount.ts +6 -4
- package/src/objects/CurrencyUnit.ts +36 -9
- package/src/objects/Deposit.ts +22 -11
- package/src/objects/Entity.ts +21 -3
- package/src/objects/FeeEstimate.ts +5 -1
- package/src/objects/GraphNode.ts +30 -14
- package/src/objects/Hop.ts +12 -4
- package/src/objects/HtlcAttemptFailureCode.ts +7 -3
- package/src/objects/IncentivesIneligibilityReason.ts +48 -0
- package/src/objects/IncentivesStatus.ts +28 -0
- package/src/objects/IncomingPayment.ts +18 -7
- package/src/objects/IncomingPaymentAttempt.ts +8 -3
- package/src/objects/IncomingPaymentAttemptStatus.ts +7 -3
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +7 -3
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/InvoiceData.ts +7 -3
- package/src/objects/InvoiceType.ts +3 -2
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
- package/src/objects/LightningTransaction.ts +12 -4
- package/src/objects/LightsparkNode.ts +33 -18
- package/src/objects/LightsparkNodeOwner.ts +2 -2
- package/src/objects/LightsparkNodeStatus.ts +3 -2
- package/src/objects/LightsparkNodeToChannelsConnection.ts +7 -3
- package/src/objects/LightsparkNodeWithOSK.ts +35 -19
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +31 -18
- package/src/objects/Node.ts +28 -14
- package/src/objects/NodeAddressType.ts +7 -3
- package/src/objects/NodeToAddressesConnection.ts +7 -3
- package/src/objects/OnChainTransaction.ts +23 -11
- package/src/objects/OutgoingPayment.ts +25 -7
- package/src/objects/OutgoingPaymentAttempt.ts +34 -14
- package/src/objects/OutgoingPaymentAttemptStatus.ts +7 -3
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +12 -4
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +7 -3
- package/src/objects/PageInfo.ts +6 -1
- package/src/objects/PayInvoiceInput.ts +6 -3
- package/src/objects/PaymentDirection.ts +3 -2
- package/src/objects/PaymentFailureReason.ts +7 -3
- package/src/objects/PaymentRequest.ts +8 -3
- package/src/objects/PaymentRequestData.ts +5 -1
- package/src/objects/PaymentRequestStatus.ts +7 -3
- package/src/objects/Permission.ts +7 -3
- package/src/objects/PostTransactionData.ts +6 -3
- package/src/objects/RegionCode.ts +541 -0
- package/src/objects/RegisterPaymentInput.ts +12 -7
- package/src/objects/RemoteSigningSubEventType.ts +7 -3
- package/src/objects/RequestWithdrawalInput.ts +2 -2
- package/src/objects/RiskRating.ts +8 -3
- package/src/objects/RoutingTransaction.ts +20 -7
- package/src/objects/RoutingTransactionFailureReason.ts +8 -3
- 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/SignablePayloadStatus.ts +3 -2
- package/src/objects/Transaction.ts +14 -4
- package/src/objects/TransactionFailures.ts +4 -1
- package/src/objects/TransactionStatus.ts +16 -5
- package/src/objects/TransactionType.ts +30 -8
- package/src/objects/TransactionUpdate.ts +6 -3
- package/src/objects/UmaInvitation.ts +119 -0
- package/src/objects/Wallet.ts +13 -4
- package/src/objects/WalletStatus.ts +36 -9
- package/src/objects/WalletToPaymentRequestsConnection.ts +7 -3
- package/src/objects/WalletToTransactionsConnection.ts +7 -3
- package/src/objects/WebhookEventType.ts +11 -3
- package/src/objects/Withdrawal.ts +22 -11
- package/src/objects/WithdrawalMode.ts +7 -3
- package/src/objects/WithdrawalRequest.ts +15 -6
- package/src/objects/WithdrawalRequestStatus.ts +3 -2
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +11 -4
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +11 -4
- package/src/objects/index.ts +21 -6
- package/src/tests/integration/constants.ts +0 -3
- package/src/tests/integration/general-regtest.test.ts +178 -197
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
|
|
4
|
+
|
|
5
|
+
export const ClaimUmaInvitationWithIncentives = `
|
|
6
|
+
mutation ClaimUmaInvitationWithIncentives(
|
|
7
|
+
$invitationCode: String!
|
|
8
|
+
$inviteeUma: String!
|
|
9
|
+
$inviteePhoneHash: String!
|
|
10
|
+
$inviteeRegion: RegionCode!
|
|
11
|
+
) {
|
|
12
|
+
claim_uma_invitation_with_incentives(input: {
|
|
13
|
+
invitation_code: $invitationCode
|
|
14
|
+
invitee_uma: $inviteeUma
|
|
15
|
+
invitee_phone_hash: $inviteePhoneHash
|
|
16
|
+
invitee_region: $inviteeRegion
|
|
17
|
+
}) {
|
|
18
|
+
invitation {
|
|
19
|
+
...UmaInvitationFragment
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
${UmaInvitationFragment}
|
|
25
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
|
|
4
|
+
|
|
5
|
+
export const CreateUmaInvitation = `
|
|
6
|
+
mutation CreateUmaInvitation(
|
|
7
|
+
$inviterUma: String!
|
|
8
|
+
) {
|
|
9
|
+
create_uma_invitation(input: {
|
|
10
|
+
inviter_uma: $inviterUma
|
|
11
|
+
}) {
|
|
12
|
+
invitation {
|
|
13
|
+
...UmaInvitationFragment
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
${UmaInvitationFragment}
|
|
19
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
|
|
4
|
+
|
|
5
|
+
export const CreateUmaInvitationWithIncentives = `
|
|
6
|
+
mutation CreateUmaInvitationWithIncentives(
|
|
7
|
+
$inviterUma: String!
|
|
8
|
+
$inviterPhoneHash: String!
|
|
9
|
+
$inviterRegion: RegionCode!
|
|
10
|
+
) {
|
|
11
|
+
create_uma_invitation_with_incentives(input: {
|
|
12
|
+
inviter_uma: $inviterUma
|
|
13
|
+
inviter_phone_hash: $inviterPhoneHash
|
|
14
|
+
inviter_region: $inviterRegion
|
|
15
|
+
}) {
|
|
16
|
+
invitation {
|
|
17
|
+
...UmaInvitationFragment
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
${UmaInvitationFragment}
|
|
23
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
|
|
4
|
+
|
|
5
|
+
export const FetchUmaInvitation = `
|
|
6
|
+
query FetchUmaInvitation(
|
|
7
|
+
$invitationCode: String!
|
|
8
|
+
) {
|
|
9
|
+
uma_invitation_by_code(code: $invitationCode) {
|
|
10
|
+
...UmaInvitationFragment
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
${UmaInvitationFragment}
|
|
15
|
+
`;
|
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
|
|
32
|
+
* tied to your account. *
|
|
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,12 +7,16 @@ 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
|
|
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
|
|
12
|
+
* (in the `entities` field).
|
|
12
13
|
**/
|
|
13
14
|
count: number;
|
|
14
15
|
|
|
15
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* An object that holds pagination information about the objects in this
|
|
18
|
+
* connection. *
|
|
19
|
+
*/
|
|
16
20
|
pageInfo: PageInfo;
|
|
17
21
|
|
|
18
22
|
/** The API tokens for the current page of this connection. **/
|
|
@@ -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
|
|
11
|
-
*
|
|
10
|
+
* The total count of objects in this connection, using the current
|
|
11
|
+
* filters. It is different from the number of objects returned in the
|
|
12
|
+
* current page (in the `entities` field).
|
|
12
13
|
**/
|
|
13
14
|
public readonly count: number,
|
|
14
15
|
/** The channels for the current page of this connection. **/
|
|
@@ -11,12 +11,16 @@ 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
|
|
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
|
|
16
|
+
* (in the `entities` field).
|
|
16
17
|
**/
|
|
17
18
|
count: number;
|
|
18
19
|
|
|
19
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* An object that holds pagination information about the objects in this
|
|
22
|
+
* connection. *
|
|
23
|
+
*/
|
|
20
24
|
pageInfo: PageInfo;
|
|
21
25
|
|
|
22
26
|
/** The nodes for the current page of this connection. **/
|
|
@@ -10,12 +10,16 @@ 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
|
|
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
|
|
15
|
+
* (in the `entities` field).
|
|
15
16
|
**/
|
|
16
17
|
count: number;
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* An object that holds pagination information about the objects in this
|
|
21
|
+
* connection. *
|
|
22
|
+
*/
|
|
19
23
|
pageInfo: PageInfo;
|
|
20
24
|
|
|
21
25
|
/** The payment requests for the current page of this connection. **/
|
|
@@ -12,12 +12,16 @@ 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
|
|
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
|
|
17
|
+
* (in the `entities` field).
|
|
17
18
|
**/
|
|
18
19
|
count: number;
|
|
19
20
|
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* An object that holds pagination information about the objects in this
|
|
23
|
+
* connection. *
|
|
24
|
+
*/
|
|
21
25
|
pageInfo: PageInfo;
|
|
22
26
|
|
|
23
27
|
/** The transactions for the current page of this connection. **/
|
|
@@ -27,20 +31,20 @@ interface AccountToTransactionsConnection {
|
|
|
27
31
|
typename: string;
|
|
28
32
|
|
|
29
33
|
/**
|
|
30
|
-
* Profit (or loss) generated by the transactions in this connection,
|
|
31
|
-
* constraints provided.
|
|
34
|
+
* Profit (or loss) generated by the transactions in this connection,
|
|
35
|
+
* with the set of filters and constraints provided.
|
|
32
36
|
**/
|
|
33
37
|
profitLoss?: CurrencyAmount | undefined;
|
|
34
38
|
|
|
35
39
|
/**
|
|
36
|
-
* Average fee earned for the transactions in this connection,
|
|
37
|
-
* provided.
|
|
40
|
+
* Average fee earned for the transactions in this connection,
|
|
41
|
+
* with the set of filters and constraints provided.
|
|
38
42
|
**/
|
|
39
43
|
averageFeeEarned?: CurrencyAmount | undefined;
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
|
-
* Total amount transacted by the transactions in this connection,
|
|
43
|
-
* constraints provided.
|
|
46
|
+
* Total amount transacted by the transactions in this connection,
|
|
47
|
+
* with the set of filters and constraints provided.
|
|
44
48
|
**/
|
|
45
49
|
totalAmountTransacted?: CurrencyAmount | undefined;
|
|
46
50
|
}
|
|
@@ -7,12 +7,16 @@ 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
|
|
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
|
|
12
|
+
* (in the `entities` field).
|
|
12
13
|
**/
|
|
13
14
|
count: number;
|
|
14
15
|
|
|
15
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* An object that holds pagination information about the objects in this
|
|
18
|
+
* connection. *
|
|
19
|
+
*/
|
|
16
20
|
pageInfo: PageInfo;
|
|
17
21
|
|
|
18
22
|
/** The wallets for the current page of this connection. **/
|
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
|
|
9
|
+
* our SDKs. See the “Authentication” section of our API docs for more details
|
|
10
|
+
* on its usage. *
|
|
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
|
|
|
@@ -18,14 +23,15 @@ interface ApiToken {
|
|
|
18
23
|
updatedAt: string;
|
|
19
24
|
|
|
20
25
|
/**
|
|
21
|
-
* An opaque identifier that should be used as a client_id (or username) in
|
|
22
|
-
* Authentication scheme when issuing requests against the
|
|
26
|
+
* An opaque identifier that should be used as a client_id (or username) in
|
|
27
|
+
* the HTTP Basic Authentication scheme when issuing requests against the
|
|
28
|
+
* Lightspark API.
|
|
23
29
|
**/
|
|
24
30
|
clientId: string;
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
|
-
* An arbitrary name chosen by the creator of the token to help identify the
|
|
28
|
-
* tokens that have been created for the account.
|
|
33
|
+
* An arbitrary name chosen by the creator of the token to help identify the
|
|
34
|
+
* token in the list of tokens that have been created for the account.
|
|
29
35
|
**/
|
|
30
36
|
name: string;
|
|
31
37
|
|
package/src/objects/Balances.ts
CHANGED
|
@@ -6,28 +6,38 @@ 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
|
|
11
|
+
* account. 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
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
17
|
+
* This represents the balance that should be displayed when asked "how much
|
|
18
|
+
* do I own right now?". It represents the amount currently owned,
|
|
19
|
+
* including things that may not be owned soon (e.g. in-flight outgoing
|
|
20
|
+
* payments, in-flight withdrawals, commit fees, etc.).
|
|
21
|
+
* It really is a snapshot of what is officially owned at this instant.
|
|
16
22
|
**/
|
|
17
23
|
ownedBalance: CurrencyAmount;
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
|
-
* This represents the balance that should be displayed when asked "how much
|
|
21
|
-
*
|
|
22
|
-
*
|
|
26
|
+
* This represents the balance that should be displayed when asked "how much
|
|
27
|
+
* can I send on Lightning right now?".
|
|
28
|
+
* It represents the amount currently available to be sent on the Lightning
|
|
29
|
+
* network. We remove from the balance all the funds that are temporarily
|
|
30
|
+
* locked (e.g. channel reserves).
|
|
23
31
|
**/
|
|
24
32
|
availableToSendBalance: CurrencyAmount;
|
|
25
33
|
|
|
26
34
|
/**
|
|
27
|
-
* This represents the balance that should be displayed when asked "how much
|
|
28
|
-
* the Bitcoin network right now?".
|
|
29
|
-
*
|
|
30
|
-
*
|
|
35
|
+
* This represents the balance that should be displayed when asked "how much
|
|
36
|
+
* money can I withdraw on the Bitcoin network right now?".
|
|
37
|
+
* It represents the amount currently available to withdraw and is usually
|
|
38
|
+
* equal to the `owned_balance` but it does not include in-flight operations
|
|
39
|
+
* (which would likely succeed and therefore likely make your withdrawal
|
|
40
|
+
* fail).
|
|
31
41
|
**/
|
|
32
42
|
availableToWithdrawBalance: CurrencyAmount;
|
|
33
43
|
}
|
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
/** This is an enum identifying a particular Bitcoin Network. **/
|
|
4
4
|
export enum BitcoinNetwork {
|
|
5
5
|
/**
|
|
6
|
-
* This is an enum value that represents values that could be added in the
|
|
7
|
-
* Clients should support unknown values as more of them could be
|
|
6
|
+
* This is an enum value that represents values that could be added in the
|
|
7
|
+
* future. Clients should support unknown values as more of them could be
|
|
8
|
+
* added without notice.
|
|
8
9
|
*/
|
|
9
10
|
FUTURE_VALUE = "FUTURE_VALUE",
|
|
10
11
|
/** The production version of the Bitcoin Blockchain. **/
|
|
11
12
|
MAINNET = "MAINNET",
|
|
12
13
|
/** A test version of the Bitcoin Blockchain, maintained by Lightspark. **/
|
|
13
14
|
REGTEST = "REGTEST",
|
|
14
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* A test version of the Bitcoin Blockchain, maintained by a centralized
|
|
17
|
+
* organization. Not in use at Lightspark.
|
|
18
|
+
* *
|
|
19
|
+
*/
|
|
15
20
|
SIGNET = "SIGNET",
|
|
16
21
|
/** A test version of the Bitcoin Blockchain, publicly available. **/
|
|
17
22
|
TESTNET = "TESTNET",
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
CurrencyAmountToJson,
|
|
7
7
|
} from "./CurrencyAmount.js";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* This is an object representing a detailed breakdown of the balance for a
|
|
11
|
+
* Lightspark Node. *
|
|
12
|
+
*/
|
|
10
13
|
interface BlockchainBalance {
|
|
11
14
|
/** The total wallet balance, including unconfirmed UTXOs. **/
|
|
12
15
|
totalBalance?: CurrencyAmount | undefined;
|
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
|
|
22
|
+
* Lightning Network 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,38 +39,57 @@ 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,
|
|
39
|
-
* channel balance on the
|
|
42
|
+
* The total amount of funds in this channel,
|
|
43
|
+
* including the channel balance on the local node,
|
|
44
|
+
* the channel balance on the remote node and the on-chain fees to close
|
|
45
|
+
* the channel.
|
|
40
46
|
**/
|
|
41
47
|
public readonly capacity?: CurrencyAmount | undefined,
|
|
42
48
|
/** The channel balance on the local node. **/
|
|
43
49
|
public readonly localBalance?: CurrencyAmount | undefined,
|
|
44
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The channel balance on the local node that is currently allocated to
|
|
52
|
+
* in-progress payments. *
|
|
53
|
+
*/
|
|
45
54
|
public readonly localUnsettledBalance?: CurrencyAmount | undefined,
|
|
46
55
|
/** The channel balance on the remote node. **/
|
|
47
56
|
public readonly remoteBalance?: CurrencyAmount | undefined,
|
|
48
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* The channel balance on the remote node that is currently allocated to
|
|
59
|
+
* in-progress payments. *
|
|
60
|
+
*/
|
|
49
61
|
public readonly remoteUnsettledBalance?: CurrencyAmount | undefined,
|
|
50
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* The channel balance that is currently allocated to in-progress payments.
|
|
64
|
+
* *
|
|
65
|
+
*/
|
|
51
66
|
public readonly unsettledBalance?: CurrencyAmount | undefined,
|
|
52
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The total balance in this channel,
|
|
69
|
+
* including the channel balance on both local and remote nodes.
|
|
70
|
+
* *
|
|
71
|
+
*/
|
|
53
72
|
public readonly totalBalance?: CurrencyAmount | undefined,
|
|
54
73
|
/** The current status of this channel. **/
|
|
55
74
|
public readonly status?: ChannelStatus | undefined,
|
|
56
75
|
/**
|
|
57
|
-
* The estimated time to wait for the channel's hash timelock contract to
|
|
58
|
-
* the channel. It is in unit of minutes.
|
|
76
|
+
* The estimated time to wait for the channel's hash timelock contract to
|
|
77
|
+
* expire when force closing the channel. It is in unit of minutes.
|
|
59
78
|
**/
|
|
60
79
|
public readonly estimatedForceClosureWaitMinutes?: number | undefined,
|
|
61
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* The amount to be paid in fees for the current set of commitment
|
|
82
|
+
* transactions. *
|
|
83
|
+
*/
|
|
62
84
|
public readonly commitFee?: CurrencyAmount | undefined,
|
|
63
85
|
/** The fees charged for routing payments through this channel. **/
|
|
64
86
|
public readonly fees?: ChannelFees | undefined,
|
|
65
87
|
/** If known, the remote node of the channel. **/
|
|
66
88
|
public readonly remoteNodeId?: string | undefined,
|
|
67
89
|
/**
|
|
68
|
-
* The unique identifier of the channel on Lightning Network,
|
|
69
|
-
* the channel was confirmed.
|
|
90
|
+
* The unique identifier of the channel on Lightning Network,
|
|
91
|
+
* which is the location in the chain that the channel was confirmed.
|
|
92
|
+
* The format is <block-height>:<tx-index>:<tx-output>.
|
|
70
93
|
**/
|
|
71
94
|
public readonly shortChannelId?: string | undefined,
|
|
72
95
|
) {
|
|
@@ -8,11 +8,16 @@ 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
|
|
13
|
+
* Lightning Network. This operation allocates balances back to the local and
|
|
14
|
+
* remote nodes.
|
|
15
|
+
* *
|
|
16
|
+
*/
|
|
12
17
|
interface ChannelClosingTransaction {
|
|
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
|
|
|
@@ -29,8 +34,8 @@ interface ChannelClosingTransaction {
|
|
|
29
34
|
amount: CurrencyAmount;
|
|
30
35
|
|
|
31
36
|
/**
|
|
32
|
-
* The height of the block that included this transaction.
|
|
33
|
-
* transactions.
|
|
37
|
+
* The height of the block that included this transaction.
|
|
38
|
+
* This will be zero for unconfirmed transactions.
|
|
34
39
|
**/
|
|
35
40
|
blockHeight: number;
|
|
36
41
|
|
|
@@ -43,22 +48,28 @@ interface ChannelClosingTransaction {
|
|
|
43
48
|
/** The date and time when this transaction was completed or failed. **/
|
|
44
49
|
resolvedAt?: string | undefined;
|
|
45
50
|
|
|
46
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* The hash of this transaction, so it can be uniquely identified on the
|
|
53
|
+
* Lightning Network. *
|
|
54
|
+
*/
|
|
47
55
|
transactionHash?: string | undefined;
|
|
48
56
|
|
|
49
57
|
/**
|
|
50
|
-
* The fees that were paid by the wallet sending the transaction to commit it
|
|
51
|
-
* blockchain.
|
|
58
|
+
* The fees that were paid by the wallet sending the transaction to commit it
|
|
59
|
+
* to the Bitcoin blockchain.
|
|
52
60
|
**/
|
|
53
61
|
fees?: CurrencyAmount | undefined;
|
|
54
62
|
|
|
55
63
|
/**
|
|
56
|
-
* The hash of the block that included this transaction.
|
|
57
|
-
* transactions.
|
|
64
|
+
* The hash of the block that included this transaction.
|
|
65
|
+
* This will be null for unconfirmed transactions.
|
|
58
66
|
**/
|
|
59
67
|
blockHash?: string | undefined;
|
|
60
68
|
|
|
61
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* The number of blockchain confirmations for this transaction in real time.
|
|
71
|
+
* *
|
|
72
|
+
*/
|
|
62
73
|
numConfirmations?: number | undefined;
|
|
63
74
|
|
|
64
75
|
/** If known, the channel this transaction is closing. **/
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
CurrencyAmountToJson,
|
|
7
7
|
} from "./CurrencyAmount.js";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* This represents the fee policies set for a channel on the Lightning Network.
|
|
11
|
+
* *
|
|
12
|
+
*/
|
|
10
13
|
interface ChannelFees {
|
|
11
14
|
baseFee?: CurrencyAmount | undefined;
|
|
12
15
|
|
|
@@ -8,11 +8,16 @@ 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
|
|
13
|
+
* Lightning Network. This object occurs only for channels funded by the local
|
|
14
|
+
* Lightspark node.
|
|
15
|
+
* *
|
|
16
|
+
*/
|
|
12
17
|
interface ChannelOpeningTransaction {
|
|
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
|
|
|
@@ -29,8 +34,8 @@ interface ChannelOpeningTransaction {
|
|
|
29
34
|
amount: CurrencyAmount;
|
|
30
35
|
|
|
31
36
|
/**
|
|
32
|
-
* The height of the block that included this transaction.
|
|
33
|
-
* transactions.
|
|
37
|
+
* The height of the block that included this transaction.
|
|
38
|
+
* This will be zero for unconfirmed transactions.
|
|
34
39
|
**/
|
|
35
40
|
blockHeight: number;
|
|
36
41
|
|
|
@@ -43,22 +48,28 @@ interface ChannelOpeningTransaction {
|
|
|
43
48
|
/** The date and time when this transaction was completed or failed. **/
|
|
44
49
|
resolvedAt?: string | undefined;
|
|
45
50
|
|
|
46
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* The hash of this transaction, so it can be uniquely identified on the
|
|
53
|
+
* Lightning Network. *
|
|
54
|
+
*/
|
|
47
55
|
transactionHash?: string | undefined;
|
|
48
56
|
|
|
49
57
|
/**
|
|
50
|
-
* The fees that were paid by the wallet sending the transaction to commit it
|
|
51
|
-
* blockchain.
|
|
58
|
+
* The fees that were paid by the wallet sending the transaction to commit it
|
|
59
|
+
* to the Bitcoin blockchain.
|
|
52
60
|
**/
|
|
53
61
|
fees?: CurrencyAmount | undefined;
|
|
54
62
|
|
|
55
63
|
/**
|
|
56
|
-
* The hash of the block that included this transaction.
|
|
57
|
-
* transactions.
|
|
64
|
+
* The hash of the block that included this transaction.
|
|
65
|
+
* This will be null for unconfirmed transactions.
|
|
58
66
|
**/
|
|
59
67
|
blockHash?: string | undefined;
|
|
60
68
|
|
|
61
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* The number of blockchain confirmations for this transaction in real time.
|
|
71
|
+
* *
|
|
72
|
+
*/
|
|
62
73
|
numConfirmations?: number | undefined;
|
|
63
74
|
|
|
64
75
|
/** If known, the channel this transaction is opening. **/
|