@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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import { LightsparkException } from "@lightsparkdev/core";
|
|
3
|
+
import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
5
4
|
import Account from "./Account.js";
|
|
6
5
|
import { BalancesFromJson } from "./Balances.js";
|
|
7
6
|
import type Entity from "./Entity.js";
|
|
8
7
|
import Wallet from "./Wallet.js";
|
|
9
8
|
import WalletStatus from "./WalletStatus.js";
|
|
10
9
|
|
|
10
|
+
/** This is an object representing the owner of a LightsparkNode. **/
|
|
11
11
|
type LightsparkNodeOwner = Entity & {
|
|
12
12
|
/**
|
|
13
13
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
@@ -32,7 +32,7 @@ export const LightsparkNodeOwnerFromJson = (obj: any): LightsparkNodeOwner => {
|
|
|
32
32
|
obj["account_created_at"],
|
|
33
33
|
obj["account_updated_at"],
|
|
34
34
|
"Account",
|
|
35
|
-
obj["account_name"]
|
|
35
|
+
obj["account_name"],
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
if (obj["__typename"] == "Wallet") {
|
|
@@ -46,12 +46,12 @@ export const LightsparkNodeOwnerFromJson = (obj: any): LightsparkNodeOwner => {
|
|
|
46
46
|
obj["wallet_last_login_at"],
|
|
47
47
|
!!obj["wallet_balances"]
|
|
48
48
|
? BalancesFromJson(obj["wallet_balances"])
|
|
49
|
-
: undefined
|
|
49
|
+
: undefined,
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
throw new LightsparkException(
|
|
53
53
|
"DeserializationError",
|
|
54
|
-
`Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}
|
|
54
|
+
`Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`,
|
|
55
55
|
);
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -104,7 +104,7 @@ fragment LightsparkNodeOwnerFragment on LightsparkNodeOwner {
|
|
|
104
104
|
}`;
|
|
105
105
|
|
|
106
106
|
export const getLightsparkNodeOwnerQuery = (
|
|
107
|
-
id: string
|
|
107
|
+
id: string,
|
|
108
108
|
): Query<LightsparkNodeOwner> => {
|
|
109
109
|
return {
|
|
110
110
|
queryPayload: `
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum of potential purposes set by a user for a Lightspark node. **/
|
|
3
4
|
export enum LightsparkNodePurpose {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -2,40 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
import type Channel from "./Channel.js";
|
|
4
4
|
import { ChannelFromJson } from "./Channel.js";
|
|
5
|
+
import type Connection from "./Connection.js";
|
|
5
6
|
import type PageInfo from "./PageInfo.js";
|
|
6
7
|
import { PageInfoFromJson } from "./PageInfo.js";
|
|
7
8
|
|
|
8
|
-
type LightsparkNodeToChannelsConnection = {
|
|
9
|
-
/** An object that holds pagination information about the objects in this connection. **/
|
|
10
|
-
pageInfo: PageInfo;
|
|
11
|
-
|
|
9
|
+
type LightsparkNodeToChannelsConnection = Connection & {
|
|
12
10
|
/**
|
|
13
11
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
14
12
|
* number of objects returned in the current page (in the `entities` field).
|
|
15
13
|
**/
|
|
16
14
|
count: number;
|
|
17
15
|
|
|
16
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
17
|
+
pageInfo: PageInfo;
|
|
18
|
+
|
|
18
19
|
/** The channels for the current page of this connection. **/
|
|
19
20
|
entities: Channel[];
|
|
21
|
+
|
|
22
|
+
/** The typename of the object **/
|
|
23
|
+
typename: string;
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
export const LightsparkNodeToChannelsConnectionFromJson = (
|
|
23
|
-
obj: any
|
|
27
|
+
obj: any,
|
|
24
28
|
): LightsparkNodeToChannelsConnection => {
|
|
25
29
|
return {
|
|
30
|
+
count: obj["lightspark_node_to_channels_connection_count"],
|
|
26
31
|
pageInfo: PageInfoFromJson(
|
|
27
|
-
obj["lightspark_node_to_channels_connection_page_info"]
|
|
32
|
+
obj["lightspark_node_to_channels_connection_page_info"],
|
|
28
33
|
),
|
|
29
|
-
count: obj["lightspark_node_to_channels_connection_count"],
|
|
30
34
|
entities: obj["lightspark_node_to_channels_connection_entities"].map((e) =>
|
|
31
|
-
ChannelFromJson(e)
|
|
35
|
+
ChannelFromJson(e),
|
|
32
36
|
),
|
|
37
|
+
typename: "LightsparkNodeToChannelsConnection",
|
|
33
38
|
} as LightsparkNodeToChannelsConnection;
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
export const FRAGMENT = `
|
|
37
42
|
fragment LightsparkNodeToChannelsConnectionFragment on LightsparkNodeToChannelsConnection {
|
|
38
43
|
__typename
|
|
44
|
+
lightspark_node_to_channels_connection_count: count
|
|
39
45
|
lightspark_node_to_channels_connection_page_info: page_info {
|
|
40
46
|
__typename
|
|
41
47
|
page_info_has_next_page: has_next_page
|
|
@@ -43,7 +49,6 @@ fragment LightsparkNodeToChannelsConnectionFragment on LightsparkNodeToChannelsC
|
|
|
43
49
|
page_info_start_cursor: start_cursor
|
|
44
50
|
page_info_end_cursor: end_cursor
|
|
45
51
|
}
|
|
46
|
-
lightspark_node_to_channels_connection_count: count
|
|
47
52
|
lightspark_node_to_channels_connection_entities: entities {
|
|
48
53
|
id
|
|
49
54
|
}
|
package/src/objects/Node.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import { LightsparkException } from "@lightsparkdev/core";
|
|
3
|
+
import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
5
4
|
import autoBind from "auto-bind";
|
|
6
5
|
import type LightsparkClient from "../client.js";
|
|
7
6
|
import BitcoinNetwork from "./BitcoinNetwork.js";
|
|
@@ -17,7 +16,7 @@ import type NodeToAddressesConnection from "./NodeToAddressesConnection.js";
|
|
|
17
16
|
import { NodeToAddressesConnectionFromJson } from "./NodeToAddressesConnection.js";
|
|
18
17
|
import { SecretFromJson } from "./Secret.js";
|
|
19
18
|
|
|
20
|
-
/** This interface
|
|
19
|
+
/** This object is an interface representing a Lightning Node on the Lightning Network, and could either be a Lightspark node or a node managed by a third party. **/
|
|
21
20
|
class Node implements Entity {
|
|
22
21
|
constructor(
|
|
23
22
|
public readonly id: string,
|
|
@@ -29,7 +28,7 @@ class Node implements Entity {
|
|
|
29
28
|
public readonly alias?: string,
|
|
30
29
|
public readonly color?: string,
|
|
31
30
|
public readonly conductivity?: number,
|
|
32
|
-
public readonly publicKey?: string
|
|
31
|
+
public readonly publicKey?: string,
|
|
33
32
|
) {
|
|
34
33
|
autoBind(this);
|
|
35
34
|
}
|
|
@@ -37,7 +36,7 @@ class Node implements Entity {
|
|
|
37
36
|
public async getAddresses(
|
|
38
37
|
client: LightsparkClient,
|
|
39
38
|
first: number | undefined = undefined,
|
|
40
|
-
types: NodeAddressType[] | undefined = undefined
|
|
39
|
+
types: NodeAddressType[] | undefined = undefined,
|
|
41
40
|
): Promise<NodeToAddressesConnection> {
|
|
42
41
|
return (await client.executeRawQuery({
|
|
43
42
|
queryPayload: `
|
|
@@ -97,7 +96,7 @@ export const NodeFromJson = (obj: any): Node => {
|
|
|
97
96
|
obj["graph_node_alias"],
|
|
98
97
|
obj["graph_node_color"],
|
|
99
98
|
obj["graph_node_conductivity"],
|
|
100
|
-
obj["graph_node_public_key"]
|
|
99
|
+
obj["graph_node_public_key"],
|
|
101
100
|
);
|
|
102
101
|
}
|
|
103
102
|
if (obj["__typename"] == "LightsparkNode") {
|
|
@@ -140,12 +139,12 @@ export const NodeFromJson = (obj: any): Node => {
|
|
|
140
139
|
!!obj["lightspark_node_status"]
|
|
141
140
|
? LightsparkNodeStatus[obj["lightspark_node_status"]] ??
|
|
142
141
|
LightsparkNodeStatus.FUTURE_VALUE
|
|
143
|
-
: null
|
|
142
|
+
: null,
|
|
144
143
|
);
|
|
145
144
|
}
|
|
146
145
|
throw new LightsparkException(
|
|
147
146
|
"DeserializationError",
|
|
148
|
-
`Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}
|
|
147
|
+
`Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`,
|
|
149
148
|
);
|
|
150
149
|
};
|
|
151
150
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import NodeAddressType from "./NodeAddressType.js";
|
|
4
4
|
|
|
5
|
-
/**
|
|
5
|
+
/** This object represents the address of a node on the Lightning Network. **/
|
|
6
6
|
type NodeAddress = {
|
|
7
7
|
/** The string representation of the address. **/
|
|
8
8
|
address: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/** This is an enum of the potential types of addresses that a node on the Lightning Network can have. **/
|
|
4
4
|
export enum NodeAddressType {
|
|
5
5
|
/**
|
|
6
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -16,12 +16,12 @@ type NodeToAddressesConnection = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const NodeToAddressesConnectionFromJson = (
|
|
19
|
-
obj: any
|
|
19
|
+
obj: any,
|
|
20
20
|
): NodeToAddressesConnection => {
|
|
21
21
|
return {
|
|
22
22
|
count: obj["node_to_addresses_connection_count"],
|
|
23
23
|
entities: obj["node_to_addresses_connection_entities"].map((e) =>
|
|
24
|
-
NodeAddressFromJson(e)
|
|
24
|
+
NodeAddressFromJson(e),
|
|
25
25
|
),
|
|
26
26
|
} as NodeToAddressesConnection;
|
|
27
27
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import { LightsparkException } from "@lightsparkdev/core";
|
|
3
|
+
import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
5
4
|
import type ChannelClosingTransaction from "./ChannelClosingTransaction.js";
|
|
6
5
|
import type ChannelOpeningTransaction from "./ChannelOpeningTransaction.js";
|
|
7
6
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
@@ -12,7 +11,7 @@ import type Transaction from "./Transaction.js";
|
|
|
12
11
|
import TransactionStatus from "./TransactionStatus.js";
|
|
13
12
|
import type Withdrawal from "./Withdrawal.js";
|
|
14
13
|
|
|
15
|
-
/**
|
|
14
|
+
/** This object represents an L1 transaction that occurred on the Bitcoin Network. You can retrieve this object to receive information about a specific on-chain transaction made on the Lightning Network associated with your Lightspark Node. **/
|
|
16
15
|
type OnChainTransaction = Transaction &
|
|
17
16
|
Entity & {
|
|
18
17
|
/**
|
|
@@ -160,7 +159,7 @@ export const OnChainTransactionFromJson = (obj: any): OnChainTransaction => {
|
|
|
160
159
|
}
|
|
161
160
|
throw new LightsparkException(
|
|
162
161
|
"DeserializationError",
|
|
163
|
-
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}
|
|
162
|
+
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`,
|
|
164
163
|
);
|
|
165
164
|
};
|
|
166
165
|
|
|
@@ -298,7 +297,7 @@ fragment OnChainTransactionFragment on OnChainTransaction {
|
|
|
298
297
|
}`;
|
|
299
298
|
|
|
300
299
|
export const getOnChainTransactionQuery = (
|
|
301
|
-
id: string
|
|
300
|
+
id: string,
|
|
302
301
|
): Query<OnChainTransaction> => {
|
|
303
302
|
return {
|
|
304
303
|
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 autoBind from "auto-bind";
|
|
5
5
|
import type LightsparkClient from "../client.js";
|
|
6
6
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
@@ -15,7 +15,7 @@ import type RichText from "./RichText.js";
|
|
|
15
15
|
import { RichTextFromJson } from "./RichText.js";
|
|
16
16
|
import TransactionStatus from "./TransactionStatus.js";
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/** This object represents a Lightning Network payment sent from a Lightspark Node. You can retrieve this object to receive payment related information about any payment sent from your Lightspark Node on the Lightning Network. **/
|
|
19
19
|
class OutgoingPayment implements LightningTransaction {
|
|
20
20
|
constructor(
|
|
21
21
|
public readonly id: string,
|
|
@@ -31,23 +31,31 @@ class OutgoingPayment implements LightningTransaction {
|
|
|
31
31
|
public readonly fees?: CurrencyAmount,
|
|
32
32
|
public readonly paymentRequestData?: PaymentRequestData,
|
|
33
33
|
public readonly failureReason?: PaymentFailureReason,
|
|
34
|
-
public readonly failureMessage?: RichText
|
|
34
|
+
public readonly failureMessage?: RichText,
|
|
35
35
|
) {
|
|
36
36
|
autoBind(this);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
public async getAttempts(
|
|
40
40
|
client: LightsparkClient,
|
|
41
|
-
first: number | undefined = undefined
|
|
41
|
+
first: number | undefined = undefined,
|
|
42
|
+
after: string | undefined = undefined,
|
|
42
43
|
): Promise<OutgoingPaymentToAttemptsConnection> {
|
|
43
44
|
return (await client.executeRawQuery({
|
|
44
45
|
queryPayload: `
|
|
45
|
-
query FetchOutgoingPaymentToAttemptsConnection($entity_id: ID!, $first: Int) {
|
|
46
|
+
query FetchOutgoingPaymentToAttemptsConnection($entity_id: ID!, $first: Int, $after: String) {
|
|
46
47
|
entity(id: $entity_id) {
|
|
47
48
|
... on OutgoingPayment {
|
|
48
|
-
attempts(, first: $first) {
|
|
49
|
+
attempts(, first: $first, after: $after) {
|
|
49
50
|
__typename
|
|
50
51
|
outgoing_payment_to_attempts_connection_count: count
|
|
52
|
+
outgoing_payment_to_attempts_connection_page_info: page_info {
|
|
53
|
+
__typename
|
|
54
|
+
page_info_has_next_page: has_next_page
|
|
55
|
+
page_info_has_previous_page: has_previous_page
|
|
56
|
+
page_info_start_cursor: start_cursor
|
|
57
|
+
page_info_end_cursor: end_cursor
|
|
58
|
+
}
|
|
51
59
|
outgoing_payment_to_attempts_connection_entities: entities {
|
|
52
60
|
__typename
|
|
53
61
|
outgoing_payment_attempt_id: id
|
|
@@ -82,7 +90,7 @@ query FetchOutgoingPaymentToAttemptsConnection($entity_id: ID!, $first: Int) {
|
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
92
|
`,
|
|
85
|
-
variables: { entity_id: this.id, first: first },
|
|
93
|
+
variables: { entity_id: this.id, first: first, after: after },
|
|
86
94
|
constructObject: (json) => {
|
|
87
95
|
const connection = json["entity"]["attempts"];
|
|
88
96
|
return OutgoingPaymentToAttemptsConnectionFromJson(connection);
|
|
@@ -134,7 +142,7 @@ export const OutgoingPaymentFromJson = (obj: any): OutgoingPayment => {
|
|
|
134
142
|
: null,
|
|
135
143
|
!!obj["outgoing_payment_failure_message"]
|
|
136
144
|
? RichTextFromJson(obj["outgoing_payment_failure_message"])
|
|
137
|
-
: undefined
|
|
145
|
+
: undefined,
|
|
138
146
|
);
|
|
139
147
|
};
|
|
140
148
|
|
|
@@ -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 CurrencyAmount from "./CurrencyAmount.js";
|
|
@@ -11,7 +11,7 @@ import OutgoingPaymentAttemptStatus from "./OutgoingPaymentAttemptStatus.js";
|
|
|
11
11
|
import type OutgoingPaymentAttemptToHopsConnection from "./OutgoingPaymentAttemptToHopsConnection.js";
|
|
12
12
|
import { OutgoingPaymentAttemptToHopsConnectionFromJson } from "./OutgoingPaymentAttemptToHopsConnection.js";
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/** This object represents an attempted Lightning Network payment sent from a Lightspark Node. You can retrieve this object to receive payment related information about any payment attempt sent from your Lightspark Node on the Lightning Network, including any potential reasons the payment may have failed. **/
|
|
15
15
|
class OutgoingPaymentAttempt implements Entity {
|
|
16
16
|
constructor(
|
|
17
17
|
public readonly id: string,
|
|
@@ -24,23 +24,31 @@ class OutgoingPaymentAttempt implements Entity {
|
|
|
24
24
|
public readonly failureSourceIndex?: number,
|
|
25
25
|
public readonly resolvedAt?: string,
|
|
26
26
|
public readonly amount?: CurrencyAmount,
|
|
27
|
-
public readonly fees?: CurrencyAmount
|
|
27
|
+
public readonly fees?: CurrencyAmount,
|
|
28
28
|
) {
|
|
29
29
|
autoBind(this);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
public async getHops(
|
|
33
33
|
client: LightsparkClient,
|
|
34
|
-
first: number | undefined = undefined
|
|
34
|
+
first: number | undefined = undefined,
|
|
35
|
+
after: string | undefined = undefined,
|
|
35
36
|
): Promise<OutgoingPaymentAttemptToHopsConnection> {
|
|
36
37
|
return (await client.executeRawQuery({
|
|
37
38
|
queryPayload: `
|
|
38
|
-
query FetchOutgoingPaymentAttemptToHopsConnection($entity_id: ID!, $first: Int) {
|
|
39
|
+
query FetchOutgoingPaymentAttemptToHopsConnection($entity_id: ID!, $first: Int, $after: String) {
|
|
39
40
|
entity(id: $entity_id) {
|
|
40
41
|
... on OutgoingPaymentAttempt {
|
|
41
|
-
hops(, first: $first) {
|
|
42
|
+
hops(, first: $first, after: $after) {
|
|
42
43
|
__typename
|
|
43
44
|
outgoing_payment_attempt_to_hops_connection_count: count
|
|
45
|
+
outgoing_payment_attempt_to_hops_connection_page_info: page_info {
|
|
46
|
+
__typename
|
|
47
|
+
page_info_has_next_page: has_next_page
|
|
48
|
+
page_info_has_previous_page: has_previous_page
|
|
49
|
+
page_info_start_cursor: start_cursor
|
|
50
|
+
page_info_end_cursor: end_cursor
|
|
51
|
+
}
|
|
44
52
|
outgoing_payment_attempt_to_hops_connection_entities: entities {
|
|
45
53
|
__typename
|
|
46
54
|
hop_id: id
|
|
@@ -74,7 +82,7 @@ query FetchOutgoingPaymentAttemptToHopsConnection($entity_id: ID!, $first: Int)
|
|
|
74
82
|
}
|
|
75
83
|
}
|
|
76
84
|
`,
|
|
77
|
-
variables: { entity_id: this.id, first: first },
|
|
85
|
+
variables: { entity_id: this.id, first: first, after: after },
|
|
78
86
|
constructObject: (json) => {
|
|
79
87
|
const connection = json["entity"]["hops"];
|
|
80
88
|
return OutgoingPaymentAttemptToHopsConnectionFromJson(connection);
|
|
@@ -83,7 +91,7 @@ query FetchOutgoingPaymentAttemptToHopsConnection($entity_id: ID!, $first: Int)
|
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
static getOutgoingPaymentAttemptQuery(
|
|
86
|
-
id: string
|
|
94
|
+
id: string,
|
|
87
95
|
): Query<OutgoingPaymentAttempt> {
|
|
88
96
|
return {
|
|
89
97
|
queryPayload: `
|
|
@@ -105,7 +113,7 @@ ${FRAGMENT}
|
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
export const OutgoingPaymentAttemptFromJson = (
|
|
108
|
-
obj: any
|
|
116
|
+
obj: any,
|
|
109
117
|
): OutgoingPaymentAttempt => {
|
|
110
118
|
return new OutgoingPaymentAttempt(
|
|
111
119
|
obj["outgoing_payment_attempt_id"],
|
|
@@ -126,7 +134,7 @@ export const OutgoingPaymentAttemptFromJson = (
|
|
|
126
134
|
: undefined,
|
|
127
135
|
!!obj["outgoing_payment_attempt_fees"]
|
|
128
136
|
? CurrencyAmountFromJson(obj["outgoing_payment_attempt_fees"])
|
|
129
|
-
: undefined
|
|
137
|
+
: undefined,
|
|
130
138
|
);
|
|
131
139
|
};
|
|
132
140
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/** This is an enum of all potential statuses of a payment attempt made from a Lightspark Node. **/
|
|
4
4
|
export enum OutgoingPaymentAttemptStatus {
|
|
5
5
|
/**
|
|
6
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -1,28 +1,41 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
import type Connection from "./Connection.js";
|
|
3
4
|
import type Hop from "./Hop.js";
|
|
4
5
|
import { HopFromJson } from "./Hop.js";
|
|
6
|
+
import type PageInfo from "./PageInfo.js";
|
|
7
|
+
import { PageInfoFromJson } from "./PageInfo.js";
|
|
5
8
|
|
|
6
9
|
/** The connection from an outgoing payment attempt to the list of sequential hops that define the path from sender node to recipient node. **/
|
|
7
|
-
type OutgoingPaymentAttemptToHopsConnection = {
|
|
10
|
+
type OutgoingPaymentAttemptToHopsConnection = Connection & {
|
|
8
11
|
/**
|
|
9
12
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
10
13
|
* number of objects returned in the current page (in the `entities` field).
|
|
11
14
|
**/
|
|
12
15
|
count: number;
|
|
13
16
|
|
|
17
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
18
|
+
pageInfo: PageInfo;
|
|
19
|
+
|
|
14
20
|
/** The hops for the current page of this connection. **/
|
|
15
21
|
entities: Hop[];
|
|
22
|
+
|
|
23
|
+
/** The typename of the object **/
|
|
24
|
+
typename: string;
|
|
16
25
|
};
|
|
17
26
|
|
|
18
27
|
export const OutgoingPaymentAttemptToHopsConnectionFromJson = (
|
|
19
|
-
obj: any
|
|
28
|
+
obj: any,
|
|
20
29
|
): OutgoingPaymentAttemptToHopsConnection => {
|
|
21
30
|
return {
|
|
22
31
|
count: obj["outgoing_payment_attempt_to_hops_connection_count"],
|
|
32
|
+
pageInfo: PageInfoFromJson(
|
|
33
|
+
obj["outgoing_payment_attempt_to_hops_connection_page_info"],
|
|
34
|
+
),
|
|
23
35
|
entities: obj["outgoing_payment_attempt_to_hops_connection_entities"].map(
|
|
24
|
-
(e) => HopFromJson(e)
|
|
36
|
+
(e) => HopFromJson(e),
|
|
25
37
|
),
|
|
38
|
+
typename: "OutgoingPaymentAttemptToHopsConnection",
|
|
26
39
|
} as OutgoingPaymentAttemptToHopsConnection;
|
|
27
40
|
};
|
|
28
41
|
|
|
@@ -30,6 +43,13 @@ export const FRAGMENT = `
|
|
|
30
43
|
fragment OutgoingPaymentAttemptToHopsConnectionFragment on OutgoingPaymentAttemptToHopsConnection {
|
|
31
44
|
__typename
|
|
32
45
|
outgoing_payment_attempt_to_hops_connection_count: count
|
|
46
|
+
outgoing_payment_attempt_to_hops_connection_page_info: page_info {
|
|
47
|
+
__typename
|
|
48
|
+
page_info_has_next_page: has_next_page
|
|
49
|
+
page_info_has_previous_page: has_previous_page
|
|
50
|
+
page_info_start_cursor: start_cursor
|
|
51
|
+
page_info_end_cursor: end_cursor
|
|
52
|
+
}
|
|
33
53
|
outgoing_payment_attempt_to_hops_connection_entities: entities {
|
|
34
54
|
id
|
|
35
55
|
}
|
|
@@ -1,28 +1,41 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
import type Connection from "./Connection.js";
|
|
3
4
|
import type OutgoingPaymentAttempt from "./OutgoingPaymentAttempt.js";
|
|
4
5
|
import { OutgoingPaymentAttemptFromJson } from "./OutgoingPaymentAttempt.js";
|
|
6
|
+
import type PageInfo from "./PageInfo.js";
|
|
7
|
+
import { PageInfoFromJson } from "./PageInfo.js";
|
|
5
8
|
|
|
6
9
|
/** The connection from outgoing payment to all attempts. **/
|
|
7
|
-
type OutgoingPaymentToAttemptsConnection = {
|
|
10
|
+
type OutgoingPaymentToAttemptsConnection = Connection & {
|
|
8
11
|
/**
|
|
9
12
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
10
13
|
* number of objects returned in the current page (in the `entities` field).
|
|
11
14
|
**/
|
|
12
15
|
count: number;
|
|
13
16
|
|
|
17
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
18
|
+
pageInfo: PageInfo;
|
|
19
|
+
|
|
14
20
|
/** The attempts for the current page of this connection. **/
|
|
15
21
|
entities: OutgoingPaymentAttempt[];
|
|
22
|
+
|
|
23
|
+
/** The typename of the object **/
|
|
24
|
+
typename: string;
|
|
16
25
|
};
|
|
17
26
|
|
|
18
27
|
export const OutgoingPaymentToAttemptsConnectionFromJson = (
|
|
19
|
-
obj: any
|
|
28
|
+
obj: any,
|
|
20
29
|
): OutgoingPaymentToAttemptsConnection => {
|
|
21
30
|
return {
|
|
22
31
|
count: obj["outgoing_payment_to_attempts_connection_count"],
|
|
32
|
+
pageInfo: PageInfoFromJson(
|
|
33
|
+
obj["outgoing_payment_to_attempts_connection_page_info"],
|
|
34
|
+
),
|
|
23
35
|
entities: obj["outgoing_payment_to_attempts_connection_entities"].map((e) =>
|
|
24
|
-
OutgoingPaymentAttemptFromJson(e)
|
|
36
|
+
OutgoingPaymentAttemptFromJson(e),
|
|
25
37
|
),
|
|
38
|
+
typename: "OutgoingPaymentToAttemptsConnection",
|
|
26
39
|
} as OutgoingPaymentToAttemptsConnection;
|
|
27
40
|
};
|
|
28
41
|
|
|
@@ -30,6 +43,13 @@ export const FRAGMENT = `
|
|
|
30
43
|
fragment OutgoingPaymentToAttemptsConnectionFragment on OutgoingPaymentToAttemptsConnection {
|
|
31
44
|
__typename
|
|
32
45
|
outgoing_payment_to_attempts_connection_count: count
|
|
46
|
+
outgoing_payment_to_attempts_connection_page_info: page_info {
|
|
47
|
+
__typename
|
|
48
|
+
page_info_has_next_page: has_next_page
|
|
49
|
+
page_info_has_previous_page: has_previous_page
|
|
50
|
+
page_info_start_cursor: start_cursor
|
|
51
|
+
page_info_end_cursor: end_cursor
|
|
52
|
+
}
|
|
33
53
|
outgoing_payment_to_attempts_connection_entities: entities {
|
|
34
54
|
id
|
|
35
55
|
}
|
package/src/objects/PageInfo.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an object representing information about a page returned by the Lightspark API. For more information, please see the “Pagination” section of our API docs for more information about its usage. **/
|
|
3
4
|
type PageInfo = {
|
|
4
5
|
hasNextPage?: boolean;
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum of the potential reasons why an OutgoingPayment sent from a Lightspark Node may have failed. **/
|
|
3
4
|
export enum PaymentFailureReason {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import { LightsparkException } from "@lightsparkdev/core";
|
|
3
|
+
import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
5
4
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
6
5
|
import type Entity from "./Entity.js";
|
|
7
6
|
import type Invoice from "./Invoice.js";
|
|
@@ -9,6 +8,7 @@ import { InvoiceDataFromJson } from "./InvoiceData.js";
|
|
|
9
8
|
import type PaymentRequestData from "./PaymentRequestData.js";
|
|
10
9
|
import PaymentRequestStatus from "./PaymentRequestStatus.js";
|
|
11
10
|
|
|
11
|
+
/** This object contains information related to a payment request generated or received by a LightsparkNode. You can retrieve this object to receive payment information about a specific invoice. **/
|
|
12
12
|
type PaymentRequest = Entity & {
|
|
13
13
|
/**
|
|
14
14
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
@@ -50,7 +50,7 @@ export const PaymentRequestFromJson = (obj: any): PaymentRequest => {
|
|
|
50
50
|
}
|
|
51
51
|
throw new LightsparkException(
|
|
52
52
|
"DeserializationError",
|
|
53
|
-
`Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}
|
|
53
|
+
`Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`,
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -6,7 +6,7 @@ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
|
6
6
|
import type InvoiceData from "./InvoiceData.js";
|
|
7
7
|
import { NodeFromJson } from "./Node.js";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/** This object is an interface of a payment request on the Lightning Network (i.e., a Lightning Invoice). It contains data related to parsing the payment details of a Lightning Invoice. **/
|
|
10
10
|
type PaymentRequestData = {
|
|
11
11
|
encodedPaymentRequest: string;
|
|
12
12
|
|
|
@@ -34,7 +34,7 @@ export const PaymentRequestDataFromJson = (obj: any): PaymentRequestData => {
|
|
|
34
34
|
}
|
|
35
35
|
throw new LightsparkException(
|
|
36
36
|
"DeserializationError",
|
|
37
|
-
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}
|
|
37
|
+
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`,
|
|
38
38
|
);
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum of the potential states that a payment request on the Lightning Network can take. **/
|
|
3
4
|
export enum PaymentRequestStatus {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum of the potential permissions that a Lightspark user can have in regards to account management. **/
|
|
3
4
|
export enum Permission {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
/** This is an enum of the potential risk ratings related to a transaction made over the Lightning Network. These risk ratings are returned from the CryptoSanctionScreeningProvider. **/
|
|
4
|
+
export enum RiskRating {
|
|
5
|
+
/**
|
|
6
|
+
* This is an enum value that represents values that could be added in the future.
|
|
7
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
8
|
+
*/
|
|
9
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
10
|
+
|
|
11
|
+
HIGH_RISK = "HIGH_RISK",
|
|
12
|
+
|
|
13
|
+
LOW_RISK = "LOW_RISK",
|
|
14
|
+
|
|
15
|
+
UNKNOWN = "UNKNOWN",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default RiskRating;
|