@lightsparkdev/lightspark-sdk 0.4.9 → 0.4.11
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/{chunk-YTXDF6SQ.js → chunk-NXUFC5J7.js} +950 -246
- package/dist/{index-adeff42d.d.ts → index-3ffe9e7b.d.ts} +194 -56
- package/dist/index.cjs +963 -254
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -9
- package/dist/objects/index.cjs +952 -246
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +5 -1
- package/package.json +4 -4
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/auth/AccountTokenAuthProvider.ts +4 -4
- package/src/client.ts +62 -63
- package/src/objects/Account.ts +46 -40
- package/src/objects/AccountToApiTokensConnection.ts +14 -9
- package/src/objects/AccountToChannelsConnection.ts +4 -4
- package/src/objects/AccountToNodesConnection.ts +13 -8
- package/src/objects/AccountToPaymentRequestsConnection.ts +22 -17
- package/src/objects/AccountToTransactionsConnection.ts +24 -19
- package/src/objects/AccountToWalletsConnection.ts +13 -8
- package/src/objects/ApiToken.ts +2 -1
- package/src/objects/Balances.ts +3 -2
- package/src/objects/BitcoinNetwork.ts +2 -1
- package/src/objects/BlockchainBalance.ts +1 -1
- package/src/objects/Channel.ts +6 -6
- package/src/objects/ChannelClosingTransaction.ts +4 -4
- package/src/objects/ChannelFees.ts +1 -0
- package/src/objects/ChannelOpeningTransaction.ts +4 -4
- package/src/objects/ChannelStatus.ts +1 -0
- package/src/objects/ChannelToTransactionsConnection.ts +4 -4
- package/src/objects/Connection.ts +387 -0
- package/src/objects/CreateApiTokenInput.ts +1 -1
- package/src/objects/CreateApiTokenOutput.ts +1 -1
- package/src/objects/CreateInvoiceInput.ts +12 -0
- package/src/objects/CreateLnurlInvoiceInput.ts +11 -1
- package/src/objects/CreateNodeWalletAddressInput.ts +1 -1
- package/src/objects/CreateNodeWalletAddressOutput.ts +1 -1
- package/src/objects/CreateTestModeInvoiceInput.ts +1 -1
- package/src/objects/CreateTestModeInvoiceOutput.ts +1 -1
- package/src/objects/CreateTestModePaymentInput.ts +1 -1
- package/src/objects/CreateTestModePaymentoutput.ts +2 -1
- package/src/objects/CryptoSanctionsScreeningProvider.ts +14 -0
- package/src/objects/CurrencyAmount.ts +1 -1
- package/src/objects/CurrencyUnit.ts +1 -0
- package/src/objects/DeleteApiTokenOutput.ts +1 -1
- package/src/objects/Deposit.ts +2 -2
- package/src/objects/Entity.ts +1 -1
- package/src/objects/FeeEstimate.ts +1 -0
- package/src/objects/GraphNode.ts +5 -5
- package/src/objects/Hop.ts +2 -2
- package/src/objects/HtlcAttemptFailureCode.ts +1 -0
- package/src/objects/IncomingPayment.ts +21 -8
- package/src/objects/IncomingPaymentAttempt.ts +4 -4
- package/src/objects/IncomingPaymentAttemptStatus.ts +1 -1
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +23 -3
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/InvoiceData.ts +1 -1
- package/src/objects/InvoiceType.ts +1 -0
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +1 -1
- package/src/objects/LightningFeeEstimateForNodeInput.ts +1 -1
- package/src/objects/LightningFeeEstimateOutput.ts +2 -2
- package/src/objects/LightningTransaction.ts +8 -8
- package/src/objects/LightsparkNode.ts +15 -9
- package/src/objects/LightsparkNodeOwner.ts +6 -6
- package/src/objects/LightsparkNodePurpose.ts +1 -0
- package/src/objects/LightsparkNodeToChannelsConnection.ts +14 -9
- package/src/objects/Node.ts +7 -8
- package/src/objects/NodeAddress.ts +1 -1
- package/src/objects/NodeAddressType.ts +1 -1
- package/src/objects/NodeToAddressesConnection.ts +2 -2
- package/src/objects/OnChainTransaction.ts +4 -5
- package/src/objects/OutgoingPayment.ts +16 -8
- package/src/objects/OutgoingPaymentAttempt.ts +18 -10
- package/src/objects/OutgoingPaymentAttemptStatus.ts +1 -1
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +23 -3
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +23 -3
- package/src/objects/PageInfo.ts +1 -0
- package/src/objects/PaymentFailureReason.ts +1 -0
- package/src/objects/PaymentRequest.ts +3 -3
- package/src/objects/PaymentRequestData.ts +2 -2
- package/src/objects/PaymentRequestStatus.ts +1 -0
- package/src/objects/Permission.ts +1 -0
- package/src/objects/RequestWithdrawalInput.ts +1 -1
- package/src/objects/RequestWithdrawalOutput.ts +1 -1
- package/src/objects/RiskRating.ts +18 -0
- package/src/objects/RoutingTransaction.ts +3 -3
- package/src/objects/RoutingTransactionFailureReason.ts +1 -0
- package/src/objects/ScreenBitcoinAddressesInput.ts +23 -0
- package/src/objects/ScreenBitcoinAddressesOutput.ts +25 -0
- package/src/objects/Transaction.ts +6 -6
- package/src/objects/TransactionFailures.ts +2 -1
- package/src/objects/TransactionStatus.ts +1 -0
- package/src/objects/TransactionType.ts +1 -0
- package/src/objects/Wallet.ts +636 -11
- package/src/objects/WalletStatus.ts +1 -0
- package/src/objects/WalletToPaymentRequestsConnection.ts +57 -0
- package/src/objects/WalletToTransactionsConnection.ts +57 -0
- package/src/objects/WebhookEventType.ts +3 -0
- package/src/objects/Withdrawal.ts +2 -2
- package/src/objects/WithdrawalMode.ts +1 -0
- package/src/objects/WithdrawalRequest.ts +8 -7
- package/src/objects/WithdrawalRequestStatus.ts +1 -0
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +2 -2
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +2 -2
- package/src/objects/index.ts +7 -0
- package/src/webhooks.ts +1 -1
- package/src/objects/.eslintrc.cjs +0 -5
package/src/objects/ApiToken.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type Entity from "./Entity.js";
|
|
5
5
|
import Permission from "./Permission.js";
|
|
6
6
|
|
|
7
|
+
/** This is an object representing a Lightspark API token, that can be used to authenticate this account when making API calls or using our SDKs. See the “Authentication” section of our API docs for more details on its usage. **/
|
|
7
8
|
type ApiToken = Entity & {
|
|
8
9
|
/**
|
|
9
10
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
package/src/objects/Balances.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
4
4
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
5
5
|
|
|
6
|
+
/** This is an object representing the balance associated with your Lightspark account. You can retrieve this object to see your balance, which can be broken down into several different categorizations. **/
|
|
6
7
|
type Balances = {
|
|
7
8
|
/**
|
|
8
9
|
* This represents the balance that should be displayed when asked "how much do I own right now?". It
|
|
@@ -32,10 +33,10 @@ export const BalancesFromJson = (obj: any): Balances => {
|
|
|
32
33
|
return {
|
|
33
34
|
ownedBalance: CurrencyAmountFromJson(obj["balances_owned_balance"]),
|
|
34
35
|
availableToSendBalance: CurrencyAmountFromJson(
|
|
35
|
-
obj["balances_available_to_send_balance"]
|
|
36
|
+
obj["balances_available_to_send_balance"],
|
|
36
37
|
),
|
|
37
38
|
availableToWithdrawBalance: CurrencyAmountFromJson(
|
|
38
|
-
obj["balances_available_to_withdraw_balance"]
|
|
39
|
+
obj["balances_available_to_withdraw_balance"],
|
|
39
40
|
),
|
|
40
41
|
} as Balances;
|
|
41
42
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum identifying a particular Bitcoin Network. **/
|
|
3
4
|
export enum BitcoinNetwork {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -12,7 +13,7 @@ export enum BitcoinNetwork {
|
|
|
12
13
|
REGTEST = "REGTEST",
|
|
13
14
|
/** A test version of the Bitcoin Blockchain, maintained by a centralized organization. Not in use at Lightspark. **/
|
|
14
15
|
SIGNET = "SIGNET",
|
|
15
|
-
/** A test version of the Bitcoin Blockchain,
|
|
16
|
+
/** A test version of the Bitcoin Blockchain, publicly available. **/
|
|
16
17
|
TESTNET = "TESTNET",
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
4
4
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
5
5
|
|
|
6
|
-
/** This object
|
|
6
|
+
/** This is an object representing a detailed breakdown of the balance for a Lightspark Node. **/
|
|
7
7
|
type BlockchainBalance = {
|
|
8
8
|
/** The total wallet balance, including unconfirmed UTXOs. **/
|
|
9
9
|
totalBalance?: CurrencyAmount;
|
package/src/objects/Channel.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import autoBind from "auto-bind";
|
|
5
5
|
import type LightsparkClient from "../client.js";
|
|
6
6
|
import type ChannelFees from "./ChannelFees.js";
|
|
@@ -13,7 +13,7 @@ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
|
13
13
|
import type Entity from "./Entity.js";
|
|
14
14
|
import type TransactionType from "./TransactionType.js";
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/** This is an object representing a channel on the Lightning Network. You can retrieve this object to get detailed information on a specific Lightning Network channel. **/
|
|
17
17
|
class Channel implements Entity {
|
|
18
18
|
constructor(
|
|
19
19
|
public readonly id: string,
|
|
@@ -34,7 +34,7 @@ class Channel implements Entity {
|
|
|
34
34
|
public readonly commitFee?: CurrencyAmount,
|
|
35
35
|
public readonly fees?: ChannelFees,
|
|
36
36
|
public readonly remoteNodeId?: string,
|
|
37
|
-
public readonly shortChannelId?: string
|
|
37
|
+
public readonly shortChannelId?: string,
|
|
38
38
|
) {
|
|
39
39
|
autoBind(this);
|
|
40
40
|
}
|
|
@@ -42,7 +42,7 @@ class Channel implements Entity {
|
|
|
42
42
|
public async getUptimePercentage(
|
|
43
43
|
client: LightsparkClient,
|
|
44
44
|
afterDate: string | undefined = undefined,
|
|
45
|
-
beforeDate: string | undefined = undefined
|
|
45
|
+
beforeDate: string | undefined = undefined,
|
|
46
46
|
): Promise<number> {
|
|
47
47
|
return await client.executeRawQuery({
|
|
48
48
|
queryPayload: `
|
|
@@ -70,7 +70,7 @@ query FetchChannelUptimePercentage($entity_id: ID!, $after_date: DateTime, $befo
|
|
|
70
70
|
client: LightsparkClient,
|
|
71
71
|
types: TransactionType[] | undefined = undefined,
|
|
72
72
|
afterDate: string | undefined = undefined,
|
|
73
|
-
beforeDate: string | undefined = undefined
|
|
73
|
+
beforeDate: string | undefined = undefined,
|
|
74
74
|
): Promise<ChannelToTransactionsConnection> {
|
|
75
75
|
return (await client.executeRawQuery({
|
|
76
76
|
queryPayload: `
|
|
@@ -181,7 +181,7 @@ export const ChannelFromJson = (obj: any): Channel => {
|
|
|
181
181
|
? ChannelFeesFromJson(obj["channel_fees"])
|
|
182
182
|
: undefined,
|
|
183
183
|
obj["channel_remote_node"]?.id ?? undefined,
|
|
184
|
-
obj["channel_short_channel_id"]
|
|
184
|
+
obj["channel_short_channel_id"],
|
|
185
185
|
);
|
|
186
186
|
};
|
|
187
187
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
5
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
6
6
|
import type Entity from "./Entity.js";
|
|
@@ -8,7 +8,7 @@ import type OnChainTransaction from "./OnChainTransaction.js";
|
|
|
8
8
|
import type Transaction from "./Transaction.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/** This is an object representing a transaction which closes a channel on the Lightning Network. This operation allocates balances back to the local and remote nodes. **/
|
|
12
12
|
type ChannelClosingTransaction = OnChainTransaction &
|
|
13
13
|
Transaction &
|
|
14
14
|
Entity & {
|
|
@@ -68,7 +68,7 @@ type ChannelClosingTransaction = OnChainTransaction &
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export const ChannelClosingTransactionFromJson = (
|
|
71
|
-
obj: any
|
|
71
|
+
obj: any,
|
|
72
72
|
): ChannelClosingTransaction => {
|
|
73
73
|
return {
|
|
74
74
|
id: obj["channel_closing_transaction_id"],
|
|
@@ -128,7 +128,7 @@ fragment ChannelClosingTransactionFragment on ChannelClosingTransaction {
|
|
|
128
128
|
}`;
|
|
129
129
|
|
|
130
130
|
export const getChannelClosingTransactionQuery = (
|
|
131
|
-
id: string
|
|
131
|
+
id: string,
|
|
132
132
|
): Query<ChannelClosingTransaction> => {
|
|
133
133
|
return {
|
|
134
134
|
queryPayload: `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
5
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
6
6
|
import type Entity from "./Entity.js";
|
|
@@ -8,7 +8,7 @@ import type OnChainTransaction from "./OnChainTransaction.js";
|
|
|
8
8
|
import type Transaction from "./Transaction.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/** This is an object representing a transaction which opens a channel on the Lightning Network. This object occurs only for channels funded by the local Lightspark node. **/
|
|
12
12
|
type ChannelOpeningTransaction = OnChainTransaction &
|
|
13
13
|
Transaction &
|
|
14
14
|
Entity & {
|
|
@@ -68,7 +68,7 @@ type ChannelOpeningTransaction = OnChainTransaction &
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export const ChannelOpeningTransactionFromJson = (
|
|
71
|
-
obj: any
|
|
71
|
+
obj: any,
|
|
72
72
|
): ChannelOpeningTransaction => {
|
|
73
73
|
return {
|
|
74
74
|
id: obj["channel_opening_transaction_id"],
|
|
@@ -128,7 +128,7 @@ fragment ChannelOpeningTransactionFragment on ChannelOpeningTransaction {
|
|
|
128
128
|
}`;
|
|
129
129
|
|
|
130
130
|
export const getChannelOpeningTransactionQuery = (
|
|
131
|
-
id: string
|
|
131
|
+
id: string,
|
|
132
132
|
): Query<ChannelOpeningTransaction> => {
|
|
133
133
|
return {
|
|
134
134
|
queryPayload: `
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum representing the status of a channel on the Lightning Network. **/
|
|
3
4
|
export enum ChannelStatus {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -30,25 +30,25 @@ type ChannelToTransactionsConnection = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const ChannelToTransactionsConnectionFromJson = (
|
|
33
|
-
obj: any
|
|
33
|
+
obj: any,
|
|
34
34
|
): ChannelToTransactionsConnection => {
|
|
35
35
|
return {
|
|
36
36
|
count: obj["channel_to_transactions_connection_count"],
|
|
37
37
|
averageFee: !!obj["channel_to_transactions_connection_average_fee"]
|
|
38
38
|
? CurrencyAmountFromJson(
|
|
39
|
-
obj["channel_to_transactions_connection_average_fee"]
|
|
39
|
+
obj["channel_to_transactions_connection_average_fee"],
|
|
40
40
|
)
|
|
41
41
|
: undefined,
|
|
42
42
|
totalAmountTransacted: !!obj[
|
|
43
43
|
"channel_to_transactions_connection_total_amount_transacted"
|
|
44
44
|
]
|
|
45
45
|
? CurrencyAmountFromJson(
|
|
46
|
-
obj["channel_to_transactions_connection_total_amount_transacted"]
|
|
46
|
+
obj["channel_to_transactions_connection_total_amount_transacted"],
|
|
47
47
|
)
|
|
48
48
|
: undefined,
|
|
49
49
|
totalFees: !!obj["channel_to_transactions_connection_total_fees"]
|
|
50
50
|
? CurrencyAmountFromJson(
|
|
51
|
-
obj["channel_to_transactions_connection_total_fees"]
|
|
51
|
+
obj["channel_to_transactions_connection_total_fees"],
|
|
52
52
|
)
|
|
53
53
|
: undefined,
|
|
54
54
|
} as ChannelToTransactionsConnection;
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { LightsparkException } from "@lightsparkdev/core";
|
|
4
|
+
import type AccountToApiTokensConnection from "./AccountToApiTokensConnection.js";
|
|
5
|
+
import type AccountToNodesConnection from "./AccountToNodesConnection.js";
|
|
6
|
+
import type AccountToPaymentRequestsConnection from "./AccountToPaymentRequestsConnection.js";
|
|
7
|
+
import type AccountToTransactionsConnection from "./AccountToTransactionsConnection.js";
|
|
8
|
+
import type AccountToWalletsConnection from "./AccountToWalletsConnection.js";
|
|
9
|
+
import { ApiTokenFromJson } from "./ApiToken.js";
|
|
10
|
+
import { ChannelFromJson } from "./Channel.js";
|
|
11
|
+
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
12
|
+
import { HopFromJson } from "./Hop.js";
|
|
13
|
+
import { IncomingPaymentAttemptFromJson } from "./IncomingPaymentAttempt.js";
|
|
14
|
+
import type IncomingPaymentToAttemptsConnection from "./IncomingPaymentToAttemptsConnection.js";
|
|
15
|
+
import { LightsparkNodeFromJson } from "./LightsparkNode.js";
|
|
16
|
+
import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
|
|
17
|
+
import type LightsparkNodeToChannelsConnection from "./LightsparkNodeToChannelsConnection.js";
|
|
18
|
+
import { OutgoingPaymentAttemptFromJson } from "./OutgoingPaymentAttempt.js";
|
|
19
|
+
import type OutgoingPaymentAttemptToHopsConnection from "./OutgoingPaymentAttemptToHopsConnection.js";
|
|
20
|
+
import type OutgoingPaymentToAttemptsConnection from "./OutgoingPaymentToAttemptsConnection.js";
|
|
21
|
+
import type PageInfo from "./PageInfo.js";
|
|
22
|
+
import { PageInfoFromJson } from "./PageInfo.js";
|
|
23
|
+
import { PaymentRequestFromJson } from "./PaymentRequest.js";
|
|
24
|
+
import { TransactionFromJson } from "./Transaction.js";
|
|
25
|
+
import { WalletFromJson } from "./Wallet.js";
|
|
26
|
+
import type WalletToPaymentRequestsConnection from "./WalletToPaymentRequestsConnection.js";
|
|
27
|
+
import type WalletToTransactionsConnection from "./WalletToTransactionsConnection.js";
|
|
28
|
+
|
|
29
|
+
type Connection = {
|
|
30
|
+
/**
|
|
31
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
32
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
33
|
+
**/
|
|
34
|
+
count: number;
|
|
35
|
+
|
|
36
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
37
|
+
pageInfo: PageInfo;
|
|
38
|
+
|
|
39
|
+
/** The typename of the object **/
|
|
40
|
+
typename: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const ConnectionFromJson = (obj: any): Connection => {
|
|
44
|
+
if (obj["__typename"] == "AccountToApiTokensConnection") {
|
|
45
|
+
return {
|
|
46
|
+
count: obj["account_to_api_tokens_connection_count"],
|
|
47
|
+
pageInfo: PageInfoFromJson(
|
|
48
|
+
obj["account_to_api_tokens_connection_page_info"],
|
|
49
|
+
),
|
|
50
|
+
entities: obj["account_to_api_tokens_connection_entities"].map((e) =>
|
|
51
|
+
ApiTokenFromJson(e),
|
|
52
|
+
),
|
|
53
|
+
typename: "AccountToApiTokensConnection",
|
|
54
|
+
} as AccountToApiTokensConnection;
|
|
55
|
+
}
|
|
56
|
+
if (obj["__typename"] == "AccountToNodesConnection") {
|
|
57
|
+
return {
|
|
58
|
+
count: obj["account_to_nodes_connection_count"],
|
|
59
|
+
pageInfo: PageInfoFromJson(obj["account_to_nodes_connection_page_info"]),
|
|
60
|
+
entities: obj["account_to_nodes_connection_entities"].map((e) =>
|
|
61
|
+
LightsparkNodeFromJson(e),
|
|
62
|
+
),
|
|
63
|
+
typename: "AccountToNodesConnection",
|
|
64
|
+
purpose: !!obj["account_to_nodes_connection_purpose"]
|
|
65
|
+
? LightsparkNodePurpose[obj["account_to_nodes_connection_purpose"]] ??
|
|
66
|
+
LightsparkNodePurpose.FUTURE_VALUE
|
|
67
|
+
: null,
|
|
68
|
+
} as AccountToNodesConnection;
|
|
69
|
+
}
|
|
70
|
+
if (obj["__typename"] == "AccountToPaymentRequestsConnection") {
|
|
71
|
+
return {
|
|
72
|
+
count: obj["account_to_payment_requests_connection_count"],
|
|
73
|
+
pageInfo: PageInfoFromJson(
|
|
74
|
+
obj["account_to_payment_requests_connection_page_info"],
|
|
75
|
+
),
|
|
76
|
+
entities: obj["account_to_payment_requests_connection_entities"].map(
|
|
77
|
+
(e) => PaymentRequestFromJson(e),
|
|
78
|
+
),
|
|
79
|
+
typename: "AccountToPaymentRequestsConnection",
|
|
80
|
+
} as AccountToPaymentRequestsConnection;
|
|
81
|
+
}
|
|
82
|
+
if (obj["__typename"] == "AccountToTransactionsConnection") {
|
|
83
|
+
return {
|
|
84
|
+
count: obj["account_to_transactions_connection_count"],
|
|
85
|
+
pageInfo: PageInfoFromJson(
|
|
86
|
+
obj["account_to_transactions_connection_page_info"],
|
|
87
|
+
),
|
|
88
|
+
entities: obj["account_to_transactions_connection_entities"].map((e) =>
|
|
89
|
+
TransactionFromJson(e),
|
|
90
|
+
),
|
|
91
|
+
typename: "AccountToTransactionsConnection",
|
|
92
|
+
profitLoss: !!obj["account_to_transactions_connection_profit_loss"]
|
|
93
|
+
? CurrencyAmountFromJson(
|
|
94
|
+
obj["account_to_transactions_connection_profit_loss"],
|
|
95
|
+
)
|
|
96
|
+
: undefined,
|
|
97
|
+
averageFeeEarned: !!obj[
|
|
98
|
+
"account_to_transactions_connection_average_fee_earned"
|
|
99
|
+
]
|
|
100
|
+
? CurrencyAmountFromJson(
|
|
101
|
+
obj["account_to_transactions_connection_average_fee_earned"],
|
|
102
|
+
)
|
|
103
|
+
: undefined,
|
|
104
|
+
totalAmountTransacted: !!obj[
|
|
105
|
+
"account_to_transactions_connection_total_amount_transacted"
|
|
106
|
+
]
|
|
107
|
+
? CurrencyAmountFromJson(
|
|
108
|
+
obj["account_to_transactions_connection_total_amount_transacted"],
|
|
109
|
+
)
|
|
110
|
+
: undefined,
|
|
111
|
+
} as AccountToTransactionsConnection;
|
|
112
|
+
}
|
|
113
|
+
if (obj["__typename"] == "AccountToWalletsConnection") {
|
|
114
|
+
return {
|
|
115
|
+
count: obj["account_to_wallets_connection_count"],
|
|
116
|
+
pageInfo: PageInfoFromJson(
|
|
117
|
+
obj["account_to_wallets_connection_page_info"],
|
|
118
|
+
),
|
|
119
|
+
entities: obj["account_to_wallets_connection_entities"].map((e) =>
|
|
120
|
+
WalletFromJson(e),
|
|
121
|
+
),
|
|
122
|
+
typename: "AccountToWalletsConnection",
|
|
123
|
+
} as AccountToWalletsConnection;
|
|
124
|
+
}
|
|
125
|
+
if (obj["__typename"] == "IncomingPaymentToAttemptsConnection") {
|
|
126
|
+
return {
|
|
127
|
+
count: obj["incoming_payment_to_attempts_connection_count"],
|
|
128
|
+
pageInfo: PageInfoFromJson(
|
|
129
|
+
obj["incoming_payment_to_attempts_connection_page_info"],
|
|
130
|
+
),
|
|
131
|
+
entities: obj["incoming_payment_to_attempts_connection_entities"].map(
|
|
132
|
+
(e) => IncomingPaymentAttemptFromJson(e),
|
|
133
|
+
),
|
|
134
|
+
typename: "IncomingPaymentToAttemptsConnection",
|
|
135
|
+
} as IncomingPaymentToAttemptsConnection;
|
|
136
|
+
}
|
|
137
|
+
if (obj["__typename"] == "LightsparkNodeToChannelsConnection") {
|
|
138
|
+
return {
|
|
139
|
+
count: obj["lightspark_node_to_channels_connection_count"],
|
|
140
|
+
pageInfo: PageInfoFromJson(
|
|
141
|
+
obj["lightspark_node_to_channels_connection_page_info"],
|
|
142
|
+
),
|
|
143
|
+
entities: obj["lightspark_node_to_channels_connection_entities"].map(
|
|
144
|
+
(e) => ChannelFromJson(e),
|
|
145
|
+
),
|
|
146
|
+
typename: "LightsparkNodeToChannelsConnection",
|
|
147
|
+
} as LightsparkNodeToChannelsConnection;
|
|
148
|
+
}
|
|
149
|
+
if (obj["__typename"] == "OutgoingPaymentAttemptToHopsConnection") {
|
|
150
|
+
return {
|
|
151
|
+
count: obj["outgoing_payment_attempt_to_hops_connection_count"],
|
|
152
|
+
pageInfo: PageInfoFromJson(
|
|
153
|
+
obj["outgoing_payment_attempt_to_hops_connection_page_info"],
|
|
154
|
+
),
|
|
155
|
+
entities: obj["outgoing_payment_attempt_to_hops_connection_entities"].map(
|
|
156
|
+
(e) => HopFromJson(e),
|
|
157
|
+
),
|
|
158
|
+
typename: "OutgoingPaymentAttemptToHopsConnection",
|
|
159
|
+
} as OutgoingPaymentAttemptToHopsConnection;
|
|
160
|
+
}
|
|
161
|
+
if (obj["__typename"] == "OutgoingPaymentToAttemptsConnection") {
|
|
162
|
+
return {
|
|
163
|
+
count: obj["outgoing_payment_to_attempts_connection_count"],
|
|
164
|
+
pageInfo: PageInfoFromJson(
|
|
165
|
+
obj["outgoing_payment_to_attempts_connection_page_info"],
|
|
166
|
+
),
|
|
167
|
+
entities: obj["outgoing_payment_to_attempts_connection_entities"].map(
|
|
168
|
+
(e) => OutgoingPaymentAttemptFromJson(e),
|
|
169
|
+
),
|
|
170
|
+
typename: "OutgoingPaymentToAttemptsConnection",
|
|
171
|
+
} as OutgoingPaymentToAttemptsConnection;
|
|
172
|
+
}
|
|
173
|
+
if (obj["__typename"] == "WalletToPaymentRequestsConnection") {
|
|
174
|
+
return {
|
|
175
|
+
count: obj["wallet_to_payment_requests_connection_count"],
|
|
176
|
+
pageInfo: PageInfoFromJson(
|
|
177
|
+
obj["wallet_to_payment_requests_connection_page_info"],
|
|
178
|
+
),
|
|
179
|
+
entities: obj["wallet_to_payment_requests_connection_entities"].map((e) =>
|
|
180
|
+
PaymentRequestFromJson(e),
|
|
181
|
+
),
|
|
182
|
+
typename: "WalletToPaymentRequestsConnection",
|
|
183
|
+
} as WalletToPaymentRequestsConnection;
|
|
184
|
+
}
|
|
185
|
+
if (obj["__typename"] == "WalletToTransactionsConnection") {
|
|
186
|
+
return {
|
|
187
|
+
count: obj["wallet_to_transactions_connection_count"],
|
|
188
|
+
pageInfo: PageInfoFromJson(
|
|
189
|
+
obj["wallet_to_transactions_connection_page_info"],
|
|
190
|
+
),
|
|
191
|
+
entities: obj["wallet_to_transactions_connection_entities"].map((e) =>
|
|
192
|
+
TransactionFromJson(e),
|
|
193
|
+
),
|
|
194
|
+
typename: "WalletToTransactionsConnection",
|
|
195
|
+
} as WalletToTransactionsConnection;
|
|
196
|
+
}
|
|
197
|
+
throw new LightsparkException(
|
|
198
|
+
"DeserializationError",
|
|
199
|
+
`Couldn't find a concrete type for interface Connection corresponding to the typename=${obj["__typename"]}`,
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export const FRAGMENT = `
|
|
204
|
+
fragment ConnectionFragment on Connection {
|
|
205
|
+
__typename
|
|
206
|
+
... on AccountToApiTokensConnection {
|
|
207
|
+
__typename
|
|
208
|
+
account_to_api_tokens_connection_count: count
|
|
209
|
+
account_to_api_tokens_connection_page_info: page_info {
|
|
210
|
+
__typename
|
|
211
|
+
page_info_has_next_page: has_next_page
|
|
212
|
+
page_info_has_previous_page: has_previous_page
|
|
213
|
+
page_info_start_cursor: start_cursor
|
|
214
|
+
page_info_end_cursor: end_cursor
|
|
215
|
+
}
|
|
216
|
+
account_to_api_tokens_connection_entities: entities {
|
|
217
|
+
id
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
... on AccountToNodesConnection {
|
|
221
|
+
__typename
|
|
222
|
+
account_to_nodes_connection_count: count
|
|
223
|
+
account_to_nodes_connection_page_info: page_info {
|
|
224
|
+
__typename
|
|
225
|
+
page_info_has_next_page: has_next_page
|
|
226
|
+
page_info_has_previous_page: has_previous_page
|
|
227
|
+
page_info_start_cursor: start_cursor
|
|
228
|
+
page_info_end_cursor: end_cursor
|
|
229
|
+
}
|
|
230
|
+
account_to_nodes_connection_purpose: purpose
|
|
231
|
+
account_to_nodes_connection_entities: entities {
|
|
232
|
+
id
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
... on AccountToPaymentRequestsConnection {
|
|
236
|
+
__typename
|
|
237
|
+
account_to_payment_requests_connection_count: count
|
|
238
|
+
account_to_payment_requests_connection_page_info: page_info {
|
|
239
|
+
__typename
|
|
240
|
+
page_info_has_next_page: has_next_page
|
|
241
|
+
page_info_has_previous_page: has_previous_page
|
|
242
|
+
page_info_start_cursor: start_cursor
|
|
243
|
+
page_info_end_cursor: end_cursor
|
|
244
|
+
}
|
|
245
|
+
account_to_payment_requests_connection_entities: entities {
|
|
246
|
+
id
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
... on AccountToTransactionsConnection {
|
|
250
|
+
__typename
|
|
251
|
+
account_to_transactions_connection_count: count
|
|
252
|
+
account_to_transactions_connection_page_info: page_info {
|
|
253
|
+
__typename
|
|
254
|
+
page_info_has_next_page: has_next_page
|
|
255
|
+
page_info_has_previous_page: has_previous_page
|
|
256
|
+
page_info_start_cursor: start_cursor
|
|
257
|
+
page_info_end_cursor: end_cursor
|
|
258
|
+
}
|
|
259
|
+
account_to_transactions_connection_profit_loss: profit_loss {
|
|
260
|
+
__typename
|
|
261
|
+
currency_amount_original_value: original_value
|
|
262
|
+
currency_amount_original_unit: original_unit
|
|
263
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
264
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
265
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
266
|
+
}
|
|
267
|
+
account_to_transactions_connection_average_fee_earned: average_fee_earned {
|
|
268
|
+
__typename
|
|
269
|
+
currency_amount_original_value: original_value
|
|
270
|
+
currency_amount_original_unit: original_unit
|
|
271
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
272
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
273
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
274
|
+
}
|
|
275
|
+
account_to_transactions_connection_total_amount_transacted: total_amount_transacted {
|
|
276
|
+
__typename
|
|
277
|
+
currency_amount_original_value: original_value
|
|
278
|
+
currency_amount_original_unit: original_unit
|
|
279
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
280
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
281
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
282
|
+
}
|
|
283
|
+
account_to_transactions_connection_entities: entities {
|
|
284
|
+
id
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
... on AccountToWalletsConnection {
|
|
288
|
+
__typename
|
|
289
|
+
account_to_wallets_connection_count: count
|
|
290
|
+
account_to_wallets_connection_page_info: page_info {
|
|
291
|
+
__typename
|
|
292
|
+
page_info_has_next_page: has_next_page
|
|
293
|
+
page_info_has_previous_page: has_previous_page
|
|
294
|
+
page_info_start_cursor: start_cursor
|
|
295
|
+
page_info_end_cursor: end_cursor
|
|
296
|
+
}
|
|
297
|
+
account_to_wallets_connection_entities: entities {
|
|
298
|
+
id
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
... on IncomingPaymentToAttemptsConnection {
|
|
302
|
+
__typename
|
|
303
|
+
incoming_payment_to_attempts_connection_count: count
|
|
304
|
+
incoming_payment_to_attempts_connection_page_info: page_info {
|
|
305
|
+
__typename
|
|
306
|
+
page_info_has_next_page: has_next_page
|
|
307
|
+
page_info_has_previous_page: has_previous_page
|
|
308
|
+
page_info_start_cursor: start_cursor
|
|
309
|
+
page_info_end_cursor: end_cursor
|
|
310
|
+
}
|
|
311
|
+
incoming_payment_to_attempts_connection_entities: entities {
|
|
312
|
+
id
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
... on LightsparkNodeToChannelsConnection {
|
|
316
|
+
__typename
|
|
317
|
+
lightspark_node_to_channels_connection_count: count
|
|
318
|
+
lightspark_node_to_channels_connection_page_info: page_info {
|
|
319
|
+
__typename
|
|
320
|
+
page_info_has_next_page: has_next_page
|
|
321
|
+
page_info_has_previous_page: has_previous_page
|
|
322
|
+
page_info_start_cursor: start_cursor
|
|
323
|
+
page_info_end_cursor: end_cursor
|
|
324
|
+
}
|
|
325
|
+
lightspark_node_to_channels_connection_entities: entities {
|
|
326
|
+
id
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
... on OutgoingPaymentAttemptToHopsConnection {
|
|
330
|
+
__typename
|
|
331
|
+
outgoing_payment_attempt_to_hops_connection_count: count
|
|
332
|
+
outgoing_payment_attempt_to_hops_connection_page_info: page_info {
|
|
333
|
+
__typename
|
|
334
|
+
page_info_has_next_page: has_next_page
|
|
335
|
+
page_info_has_previous_page: has_previous_page
|
|
336
|
+
page_info_start_cursor: start_cursor
|
|
337
|
+
page_info_end_cursor: end_cursor
|
|
338
|
+
}
|
|
339
|
+
outgoing_payment_attempt_to_hops_connection_entities: entities {
|
|
340
|
+
id
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
... on OutgoingPaymentToAttemptsConnection {
|
|
344
|
+
__typename
|
|
345
|
+
outgoing_payment_to_attempts_connection_count: count
|
|
346
|
+
outgoing_payment_to_attempts_connection_page_info: page_info {
|
|
347
|
+
__typename
|
|
348
|
+
page_info_has_next_page: has_next_page
|
|
349
|
+
page_info_has_previous_page: has_previous_page
|
|
350
|
+
page_info_start_cursor: start_cursor
|
|
351
|
+
page_info_end_cursor: end_cursor
|
|
352
|
+
}
|
|
353
|
+
outgoing_payment_to_attempts_connection_entities: entities {
|
|
354
|
+
id
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
... on WalletToPaymentRequestsConnection {
|
|
358
|
+
__typename
|
|
359
|
+
wallet_to_payment_requests_connection_count: count
|
|
360
|
+
wallet_to_payment_requests_connection_page_info: page_info {
|
|
361
|
+
__typename
|
|
362
|
+
page_info_has_next_page: has_next_page
|
|
363
|
+
page_info_has_previous_page: has_previous_page
|
|
364
|
+
page_info_start_cursor: start_cursor
|
|
365
|
+
page_info_end_cursor: end_cursor
|
|
366
|
+
}
|
|
367
|
+
wallet_to_payment_requests_connection_entities: entities {
|
|
368
|
+
id
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
... on WalletToTransactionsConnection {
|
|
372
|
+
__typename
|
|
373
|
+
wallet_to_transactions_connection_count: count
|
|
374
|
+
wallet_to_transactions_connection_page_info: page_info {
|
|
375
|
+
__typename
|
|
376
|
+
page_info_has_next_page: has_next_page
|
|
377
|
+
page_info_has_previous_page: has_previous_page
|
|
378
|
+
page_info_start_cursor: start_cursor
|
|
379
|
+
page_info_end_cursor: end_cursor
|
|
380
|
+
}
|
|
381
|
+
wallet_to_transactions_connection_entities: entities {
|
|
382
|
+
id
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}`;
|
|
386
|
+
|
|
387
|
+
export default Connection;
|
|
@@ -14,7 +14,7 @@ export const CreateApiTokenInputFromJson = (obj: any): CreateApiTokenInput => {
|
|
|
14
14
|
return {
|
|
15
15
|
name: obj["create_api_token_input_name"],
|
|
16
16
|
permissions: obj["create_api_token_input_permissions"].map(
|
|
17
|
-
(e) => Permission[e]
|
|
17
|
+
(e) => Permission[e],
|
|
18
18
|
),
|
|
19
19
|
} as CreateApiTokenInput;
|
|
20
20
|
};
|
|
@@ -3,13 +3,22 @@
|
|
|
3
3
|
import InvoiceType from "./InvoiceType.js";
|
|
4
4
|
|
|
5
5
|
type CreateInvoiceInput = {
|
|
6
|
+
/** The node from which to create the invoice. **/
|
|
6
7
|
nodeId: string;
|
|
7
8
|
|
|
9
|
+
/** The amount for which the invoice should be created, in millisatoshis. **/
|
|
8
10
|
amountMsats: number;
|
|
9
11
|
|
|
10
12
|
memo?: string;
|
|
11
13
|
|
|
12
14
|
invoiceType?: InvoiceType;
|
|
15
|
+
|
|
16
|
+
/** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
|
|
17
|
+
expirySecs?: number;
|
|
18
|
+
|
|
19
|
+
paymentHash?: string;
|
|
20
|
+
|
|
21
|
+
preimageNonce?: string;
|
|
13
22
|
};
|
|
14
23
|
|
|
15
24
|
export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
|
|
@@ -21,6 +30,9 @@ export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
|
|
|
21
30
|
? InvoiceType[obj["create_invoice_input_invoice_type"]] ??
|
|
22
31
|
InvoiceType.FUTURE_VALUE
|
|
23
32
|
: null,
|
|
33
|
+
expirySecs: obj["create_invoice_input_expiry_secs"],
|
|
34
|
+
paymentHash: obj["create_invoice_input_payment_hash"],
|
|
35
|
+
preimageNonce: obj["create_invoice_input_preimage_nonce"],
|
|
24
36
|
} as CreateInvoiceInput;
|
|
25
37
|
};
|
|
26
38
|
|