@lightsparkdev/lightspark-sdk 1.1.7 → 1.2.1
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 +19 -0
- package/dist/{chunk-5RDIWPBE.js → chunk-D32EWIPX.js} +3 -1
- package/dist/{chunk-7UT6YX37.js → chunk-VTPDR6P4.js} +393 -275
- package/dist/env.cjs +3 -1
- package/dist/env.d.cts +17 -0
- package/dist/env.js +2 -2
- package/dist/{index-d31f4469.d.ts → index-5acc6526.d.ts} +1403 -408
- package/dist/index.cjs +424 -296
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +32 -27
- package/dist/objects/index.cjs +395 -277
- package/dist/objects/index.d.cts +4 -0
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +6 -6
- package/dist/{text-encoding-MDIPJAHL.js → text-encoding-26SMKBAQ.js} +3 -1
- package/package.json +5 -5
- package/src/auth/AccountTokenAuthProvider.ts +15 -11
- package/src/client.ts +7 -6
- package/src/helpers.ts +3 -1
- package/src/objects/Account.ts +21 -2
- package/src/objects/AccountToApiTokensConnection.ts +16 -5
- package/src/objects/AccountToChannelsConnection.ts +14 -0
- package/src/objects/AccountToNodesConnection.ts +19 -5
- package/src/objects/AccountToPaymentRequestsConnection.ts +21 -5
- package/src/objects/AccountToTransactionsConnection.ts +33 -9
- package/src/objects/AccountToWalletsConnection.ts +13 -4
- package/src/objects/ApiToken.ts +13 -3
- package/src/objects/Balances.ts +17 -3
- package/src/objects/BlockchainBalance.ts +34 -9
- package/src/objects/Channel.ts +92 -16
- package/src/objects/ChannelClosingTransaction.ts +81 -61
- package/src/objects/ChannelFees.ts +16 -5
- package/src/objects/ChannelOpeningTransaction.ts +81 -61
- package/src/objects/ChannelSnapshot.ts +32 -8
- package/src/objects/ChannelToTransactionsConnection.ts +26 -6
- package/src/objects/Connection.ts +205 -10
- package/src/objects/CreateApiTokenInput.ts +8 -2
- package/src/objects/CreateApiTokenOutput.ts +9 -3
- package/src/objects/CreateInvoiceInput.ts +14 -5
- package/src/objects/CreateInvoiceOutput.ts +7 -2
- package/src/objects/CreateLnurlInvoiceInput.ts +13 -3
- package/src/objects/CreateNodeWalletAddressInput.ts +9 -2
- package/src/objects/CreateNodeWalletAddressOutput.ts +10 -2
- package/src/objects/CreateTestModeInvoiceInput.ts +14 -4
- package/src/objects/CreateTestModeInvoiceOutput.ts +10 -2
- package/src/objects/CreateTestModePaymentInput.ts +12 -3
- package/src/objects/CreateTestModePaymentoutput.ts +12 -2
- package/src/objects/CreateUmaInvoiceInput.ts +13 -3
- package/src/objects/CurrencyAmount.ts +13 -2
- package/src/objects/DeclineToSignMessagesInput.ts +9 -2
- package/src/objects/DeclineToSignMessagesOutput.ts +15 -3
- package/src/objects/DeleteApiTokenInput.ts +7 -2
- package/src/objects/DeleteApiTokenOutput.ts +7 -2
- package/src/objects/Deposit.ts +77 -61
- package/src/objects/Entity.ts +2 -2
- package/src/objects/FeeEstimate.ts +12 -3
- package/src/objects/FundNodeInput.ts +9 -3
- package/src/objects/FundNodeOutput.ts +11 -3
- package/src/objects/GraphNode.ts +49 -5
- package/src/objects/Hop.ts +27 -9
- package/src/objects/IdAndSignature.ts +8 -2
- package/src/objects/IncomingPayment.ts +50 -7
- package/src/objects/IncomingPaymentAttempt.ts +21 -5
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
- package/src/objects/Invoice.ts +37 -24
- package/src/objects/InvoiceData.ts +21 -6
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
- package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
- package/src/objects/LightningFeeEstimateOutput.ts +15 -3
- package/src/objects/LightningTransaction.ts +117 -28
- package/src/objects/LightsparkNode.ts +250 -210
- package/src/objects/LightsparkNodeOwner.ts +35 -4
- package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
- package/src/objects/LightsparkNodeWithOSK.ts +127 -17
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +122 -15
- package/src/objects/Node.ts +209 -68
- package/src/objects/NodeAddress.ts +8 -2
- package/src/objects/NodeToAddressesConnection.ts +13 -3
- package/src/objects/OnChainTransaction.ts +156 -44
- package/src/objects/OutgoingPayment.ts +72 -14
- package/src/objects/OutgoingPaymentAttempt.ts +63 -8
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
- package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
- package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
- package/src/objects/PageInfo.ts +14 -6
- package/src/objects/PayInvoiceInput.ts +12 -3
- package/src/objects/PayInvoiceOutput.ts +7 -2
- package/src/objects/PayUmaInvoiceInput.ts +12 -3
- package/src/objects/PaymentRequest.ts +27 -5
- package/src/objects/PaymentRequestData.ts +27 -4
- package/src/objects/PostTransactionData.ts +12 -3
- package/src/objects/RegisterPaymentInput.ts +10 -2
- package/src/objects/RegisterPaymentOutput.ts +9 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
- package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
- package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
- package/src/objects/RequestWithdrawalInput.ts +12 -2
- package/src/objects/RequestWithdrawalOutput.ts +9 -2
- package/src/objects/RichText.ts +7 -2
- package/src/objects/RoutingTransaction.ts +62 -41
- package/src/objects/ScreenNodeInput.ts +8 -2
- package/src/objects/ScreenNodeOutput.ts +7 -2
- package/src/objects/Secret.ts +8 -2
- package/src/objects/SendPaymentInput.ts +11 -2
- package/src/objects/SendPaymentOutput.ts +7 -2
- package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
- package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
- package/src/objects/SignInvoiceInput.ts +9 -2
- package/src/objects/SignInvoiceOutput.ts +7 -2
- package/src/objects/SignMessagesInput.ts +13 -3
- package/src/objects/SignMessagesOutput.ts +13 -3
- package/src/objects/Signable.ts +10 -3
- package/src/objects/SignablePayload.ts +18 -5
- package/src/objects/Transaction.ts +206 -9
- package/src/objects/TransactionFailures.ts +11 -4
- package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
- package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
- package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
- package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
- package/src/objects/Wallet.ts +34 -5
- package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
- package/src/objects/WalletToTransactionsConnection.ts +16 -5
- package/src/objects/Withdrawal.ts +77 -61
- package/src/objects/WithdrawalRequest.ts +42 -4
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
- package/src/objects/index.ts +5 -2
- package/src/tests/integration/constants.ts +13 -0
- package/src/tests/integration/general-regtest.test.ts +652 -0
- package/src/tests/serialization.test.ts +21 -0
- package/src/webhooks.ts +1 -1
- package/src/tests/integration/client.test.ts +0 -207
- /package/dist/{chunk-NIMBE7W3.js → chunk-BMTV3EA2.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface UpdateChannelPerCommitmentPointInput {
|
|
4
4
|
channelId: string;
|
|
5
5
|
|
|
6
6
|
perCommitmentPoint: string;
|
|
7
7
|
|
|
8
8
|
perCommitmentPointIndex: number;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
export const UpdateChannelPerCommitmentPointInputFromJson = (
|
|
12
12
|
obj: any,
|
|
@@ -21,5 +21,16 @@ export const UpdateChannelPerCommitmentPointInputFromJson = (
|
|
|
21
21
|
],
|
|
22
22
|
} as UpdateChannelPerCommitmentPointInput;
|
|
23
23
|
};
|
|
24
|
+
export const UpdateChannelPerCommitmentPointInputToJson = (
|
|
25
|
+
obj: UpdateChannelPerCommitmentPointInput,
|
|
26
|
+
): any => {
|
|
27
|
+
return {
|
|
28
|
+
update_channel_per_commitment_point_input_channel_id: obj.channelId,
|
|
29
|
+
update_channel_per_commitment_point_input_per_commitment_point:
|
|
30
|
+
obj.perCommitmentPoint,
|
|
31
|
+
update_channel_per_commitment_point_input_per_commitment_point_index:
|
|
32
|
+
obj.perCommitmentPointIndex,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
24
35
|
|
|
25
36
|
export default UpdateChannelPerCommitmentPointInput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface UpdateChannelPerCommitmentPointOutput {
|
|
4
4
|
channelId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const UpdateChannelPerCommitmentPointOutputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -11,6 +11,13 @@ export const UpdateChannelPerCommitmentPointOutputFromJson = (
|
|
|
11
11
|
channelId: obj["update_channel_per_commitment_point_output_channel"].id,
|
|
12
12
|
} as UpdateChannelPerCommitmentPointOutput;
|
|
13
13
|
};
|
|
14
|
+
export const UpdateChannelPerCommitmentPointOutputToJson = (
|
|
15
|
+
obj: UpdateChannelPerCommitmentPointOutput,
|
|
16
|
+
): any => {
|
|
17
|
+
return {
|
|
18
|
+
update_channel_per_commitment_point_output_channel: { id: obj.channelId },
|
|
19
|
+
};
|
|
20
|
+
};
|
|
14
21
|
|
|
15
22
|
export const FRAGMENT = `
|
|
16
23
|
fragment UpdateChannelPerCommitmentPointOutputFragment on UpdateChannelPerCommitmentPointOutput {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface UpdateNodeSharedSecretInput {
|
|
4
4
|
nodeId: string;
|
|
5
5
|
|
|
6
6
|
sharedSecret: string;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
export const UpdateNodeSharedSecretInputFromJson = (
|
|
10
10
|
obj: any,
|
|
@@ -14,5 +14,13 @@ export const UpdateNodeSharedSecretInputFromJson = (
|
|
|
14
14
|
sharedSecret: obj["update_node_shared_secret_input_shared_secret"],
|
|
15
15
|
} as UpdateNodeSharedSecretInput;
|
|
16
16
|
};
|
|
17
|
+
export const UpdateNodeSharedSecretInputToJson = (
|
|
18
|
+
obj: UpdateNodeSharedSecretInput,
|
|
19
|
+
): any => {
|
|
20
|
+
return {
|
|
21
|
+
update_node_shared_secret_input_node_id: obj.nodeId,
|
|
22
|
+
update_node_shared_secret_input_shared_secret: obj.sharedSecret,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
17
25
|
|
|
18
26
|
export default UpdateNodeSharedSecretInput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface UpdateNodeSharedSecretOutput {
|
|
4
4
|
nodeId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const UpdateNodeSharedSecretOutputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -11,6 +11,13 @@ export const UpdateNodeSharedSecretOutputFromJson = (
|
|
|
11
11
|
nodeId: obj["update_node_shared_secret_output_node"].id,
|
|
12
12
|
} as UpdateNodeSharedSecretOutput;
|
|
13
13
|
};
|
|
14
|
+
export const UpdateNodeSharedSecretOutputToJson = (
|
|
15
|
+
obj: UpdateNodeSharedSecretOutput,
|
|
16
|
+
): any => {
|
|
17
|
+
return {
|
|
18
|
+
update_node_shared_secret_output_node: { id: obj.nodeId },
|
|
19
|
+
};
|
|
20
|
+
};
|
|
14
21
|
|
|
15
22
|
export const FRAGMENT = `
|
|
16
23
|
fragment UpdateNodeSharedSecretOutputFragment on UpdateNodeSharedSecretOutput {
|
package/src/objects/Wallet.ts
CHANGED
|
@@ -4,9 +4,10 @@ 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 Balances from "./Balances.js";
|
|
7
|
-
import { BalancesFromJson } from "./Balances.js";
|
|
7
|
+
import { BalancesFromJson, BalancesToJson } from "./Balances.js";
|
|
8
8
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
9
9
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
10
|
+
import type Entity from "./Entity.js";
|
|
10
11
|
import type LightsparkNodeOwner from "./LightsparkNodeOwner.js";
|
|
11
12
|
import type TransactionStatus from "./TransactionStatus.js";
|
|
12
13
|
import type TransactionType from "./TransactionType.js";
|
|
@@ -17,17 +18,29 @@ import type WalletToTransactionsConnection from "./WalletToTransactionsConnectio
|
|
|
17
18
|
import { WalletToTransactionsConnectionFromJson } from "./WalletToTransactionsConnection.js";
|
|
18
19
|
|
|
19
20
|
/** This object represents a Lightspark Wallet, tied to your Lightspark account. Wallets can be used to send or receive funds over the Lightning Network. You can retrieve this object to receive information about a specific wallet tied to your Lightspark account. **/
|
|
20
|
-
class Wallet implements LightsparkNodeOwner {
|
|
21
|
+
class Wallet implements LightsparkNodeOwner, Entity {
|
|
21
22
|
constructor(
|
|
23
|
+
/**
|
|
24
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
25
|
+
* string.
|
|
26
|
+
**/
|
|
22
27
|
public readonly id: string,
|
|
28
|
+
/** The date and time when the entity was first created. **/
|
|
23
29
|
public readonly createdAt: string,
|
|
30
|
+
/** The date and time when the entity was last updated. **/
|
|
24
31
|
public readonly updatedAt: string,
|
|
32
|
+
/** The unique identifier of this wallet, as provided by the Lightspark Customer during login. **/
|
|
25
33
|
public readonly thirdPartyIdentifier: string,
|
|
34
|
+
/** The status of this wallet. **/
|
|
26
35
|
public readonly status: WalletStatus,
|
|
36
|
+
/** The typename of the object **/
|
|
27
37
|
public readonly typename: string,
|
|
28
|
-
|
|
29
|
-
public readonly
|
|
30
|
-
|
|
38
|
+
/** The date and time when the wallet user last logged in. **/
|
|
39
|
+
public readonly lastLoginAt?: string | undefined,
|
|
40
|
+
/** The balances that describe the funds in this wallet. **/
|
|
41
|
+
public readonly balances?: Balances | undefined,
|
|
42
|
+
/** The account this wallet belongs to. **/
|
|
43
|
+
public readonly accountId?: string | undefined,
|
|
31
44
|
) {
|
|
32
45
|
autoBind(this);
|
|
33
46
|
}
|
|
@@ -1057,6 +1070,22 @@ ${FRAGMENT}
|
|
|
1057
1070
|
constructObject: (data: any) => WalletFromJson(data.entity),
|
|
1058
1071
|
};
|
|
1059
1072
|
}
|
|
1073
|
+
|
|
1074
|
+
public toJson() {
|
|
1075
|
+
return {
|
|
1076
|
+
__typename: "Wallet",
|
|
1077
|
+
wallet_id: this.id,
|
|
1078
|
+
wallet_created_at: this.createdAt,
|
|
1079
|
+
wallet_updated_at: this.updatedAt,
|
|
1080
|
+
wallet_last_login_at: this.lastLoginAt,
|
|
1081
|
+
wallet_balances: this.balances
|
|
1082
|
+
? BalancesToJson(this.balances)
|
|
1083
|
+
: undefined,
|
|
1084
|
+
wallet_third_party_identifier: this.thirdPartyIdentifier,
|
|
1085
|
+
wallet_account: { id: this.accountId } ?? undefined,
|
|
1086
|
+
wallet_status: this.status,
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1060
1089
|
}
|
|
1061
1090
|
|
|
1062
1091
|
export const WalletFromJson = (obj: any): Wallet => {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type Connection from "./Connection.js";
|
|
4
3
|
import type PageInfo from "./PageInfo.js";
|
|
5
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
4
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
6
5
|
import type PaymentRequest from "./PaymentRequest.js";
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
PaymentRequestFromJson,
|
|
8
|
+
PaymentRequestToJson,
|
|
9
|
+
} from "./PaymentRequest.js";
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
interface WalletToPaymentRequestsConnection {
|
|
10
12
|
/**
|
|
11
13
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
12
14
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -21,7 +23,7 @@ type WalletToPaymentRequestsConnection = Connection & {
|
|
|
21
23
|
|
|
22
24
|
/** The typename of the object **/
|
|
23
25
|
typename: string;
|
|
24
|
-
}
|
|
26
|
+
}
|
|
25
27
|
|
|
26
28
|
export const WalletToPaymentRequestsConnectionFromJson = (
|
|
27
29
|
obj: any,
|
|
@@ -37,6 +39,20 @@ export const WalletToPaymentRequestsConnectionFromJson = (
|
|
|
37
39
|
typename: "WalletToPaymentRequestsConnection",
|
|
38
40
|
} as WalletToPaymentRequestsConnection;
|
|
39
41
|
};
|
|
42
|
+
export const WalletToPaymentRequestsConnectionToJson = (
|
|
43
|
+
obj: WalletToPaymentRequestsConnection,
|
|
44
|
+
): any => {
|
|
45
|
+
return {
|
|
46
|
+
__typename: "WalletToPaymentRequestsConnection",
|
|
47
|
+
wallet_to_payment_requests_connection_count: obj.count,
|
|
48
|
+
wallet_to_payment_requests_connection_page_info: PageInfoToJson(
|
|
49
|
+
obj.pageInfo,
|
|
50
|
+
),
|
|
51
|
+
wallet_to_payment_requests_connection_entities: obj.entities.map((e) =>
|
|
52
|
+
PaymentRequestToJson(e),
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
};
|
|
40
56
|
|
|
41
57
|
export const FRAGMENT = `
|
|
42
58
|
fragment WalletToPaymentRequestsConnectionFragment on WalletToPaymentRequestsConnection {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type Connection from "./Connection.js";
|
|
4
3
|
import type PageInfo from "./PageInfo.js";
|
|
5
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
4
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
6
5
|
import type Transaction from "./Transaction.js";
|
|
7
|
-
import { TransactionFromJson } from "./Transaction.js";
|
|
6
|
+
import { TransactionFromJson, TransactionToJson } from "./Transaction.js";
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
interface WalletToTransactionsConnection {
|
|
10
9
|
/**
|
|
11
10
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
12
11
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -21,7 +20,7 @@ type WalletToTransactionsConnection = Connection & {
|
|
|
21
20
|
|
|
22
21
|
/** The typename of the object **/
|
|
23
22
|
typename: string;
|
|
24
|
-
}
|
|
23
|
+
}
|
|
25
24
|
|
|
26
25
|
export const WalletToTransactionsConnectionFromJson = (
|
|
27
26
|
obj: any,
|
|
@@ -37,6 +36,18 @@ export const WalletToTransactionsConnectionFromJson = (
|
|
|
37
36
|
typename: "WalletToTransactionsConnection",
|
|
38
37
|
} as WalletToTransactionsConnection;
|
|
39
38
|
};
|
|
39
|
+
export const WalletToTransactionsConnectionToJson = (
|
|
40
|
+
obj: WalletToTransactionsConnection,
|
|
41
|
+
): any => {
|
|
42
|
+
return {
|
|
43
|
+
__typename: "WalletToTransactionsConnection",
|
|
44
|
+
wallet_to_transactions_connection_count: obj.count,
|
|
45
|
+
wallet_to_transactions_connection_page_info: PageInfoToJson(obj.pageInfo),
|
|
46
|
+
wallet_to_transactions_connection_entities: obj.entities.map((e) =>
|
|
47
|
+
TransactionToJson(e),
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
40
51
|
|
|
41
52
|
export const FRAGMENT = `
|
|
42
53
|
fragment WalletToTransactionsConnectionFragment on WalletToTransactionsConnection {
|
|
@@ -2,70 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {
|
|
6
|
+
CurrencyAmountFromJson,
|
|
7
|
+
CurrencyAmountToJson,
|
|
8
|
+
} from "./CurrencyAmount.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
11
|
/** This object represents an L1 withdrawal from your Lightspark Node to any Bitcoin wallet. You can retrieve this object to receive detailed information about any L1 withdrawal associated with your Lightspark Node or account. **/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
numConfirmations?: number;
|
|
68
|
-
};
|
|
12
|
+
interface Withdrawal {
|
|
13
|
+
/**
|
|
14
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
15
|
+
* string.
|
|
16
|
+
**/
|
|
17
|
+
id: string;
|
|
18
|
+
|
|
19
|
+
/** The date and time when this transaction was initiated. **/
|
|
20
|
+
createdAt: string;
|
|
21
|
+
|
|
22
|
+
/** The date and time when the entity was last updated. **/
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
|
|
25
|
+
/** The current status of this transaction. **/
|
|
26
|
+
status: TransactionStatus;
|
|
27
|
+
|
|
28
|
+
/** The amount of money involved in this transaction. **/
|
|
29
|
+
amount: CurrencyAmount;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The height of the block that included this transaction. This will be zero for unconfirmed
|
|
33
|
+
* transactions.
|
|
34
|
+
**/
|
|
35
|
+
blockHeight: number;
|
|
36
|
+
|
|
37
|
+
/** The Bitcoin blockchain addresses this transaction was sent to. **/
|
|
38
|
+
destinationAddresses: string[];
|
|
39
|
+
|
|
40
|
+
/** The Lightspark node this withdrawal originated from. **/
|
|
41
|
+
originId: string;
|
|
42
|
+
|
|
43
|
+
/** The typename of the object **/
|
|
44
|
+
typename: string;
|
|
45
|
+
|
|
46
|
+
/** The date and time when this transaction was completed or failed. **/
|
|
47
|
+
resolvedAt?: string | undefined;
|
|
48
|
+
|
|
49
|
+
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
50
|
+
transactionHash?: string | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
|
|
54
|
+
* blockchain.
|
|
55
|
+
**/
|
|
56
|
+
fees?: CurrencyAmount | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The hash of the block that included this transaction. This will be null for unconfirmed
|
|
60
|
+
* transactions.
|
|
61
|
+
**/
|
|
62
|
+
blockHash?: string | undefined;
|
|
63
|
+
|
|
64
|
+
/** The number of blockchain confirmations for this transaction in real time. **/
|
|
65
|
+
numConfirmations?: number | undefined;
|
|
66
|
+
}
|
|
69
67
|
|
|
70
68
|
export const WithdrawalFromJson = (obj: any): Withdrawal => {
|
|
71
69
|
return {
|
|
@@ -89,6 +87,24 @@ export const WithdrawalFromJson = (obj: any): Withdrawal => {
|
|
|
89
87
|
numConfirmations: obj["withdrawal_num_confirmations"],
|
|
90
88
|
} as Withdrawal;
|
|
91
89
|
};
|
|
90
|
+
export const WithdrawalToJson = (obj: Withdrawal): any => {
|
|
91
|
+
return {
|
|
92
|
+
__typename: "Withdrawal",
|
|
93
|
+
withdrawal_id: obj.id,
|
|
94
|
+
withdrawal_created_at: obj.createdAt,
|
|
95
|
+
withdrawal_updated_at: obj.updatedAt,
|
|
96
|
+
withdrawal_status: obj.status,
|
|
97
|
+
withdrawal_resolved_at: obj.resolvedAt,
|
|
98
|
+
withdrawal_amount: CurrencyAmountToJson(obj.amount),
|
|
99
|
+
withdrawal_transaction_hash: obj.transactionHash,
|
|
100
|
+
withdrawal_fees: obj.fees ? CurrencyAmountToJson(obj.fees) : undefined,
|
|
101
|
+
withdrawal_block_hash: obj.blockHash,
|
|
102
|
+
withdrawal_block_height: obj.blockHeight,
|
|
103
|
+
withdrawal_destination_addresses: obj.destinationAddresses,
|
|
104
|
+
withdrawal_num_confirmations: obj.numConfirmations,
|
|
105
|
+
withdrawal_origin: { id: obj.originId },
|
|
106
|
+
};
|
|
107
|
+
};
|
|
92
108
|
|
|
93
109
|
export const FRAGMENT = `
|
|
94
110
|
fragment WithdrawalFragment on Withdrawal {
|
|
@@ -4,7 +4,10 @@ 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";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
CurrencyAmountFromJson,
|
|
9
|
+
CurrencyAmountToJson,
|
|
10
|
+
} from "./CurrencyAmount.js";
|
|
8
11
|
import type Entity from "./Entity.js";
|
|
9
12
|
import WithdrawalMode from "./WithdrawalMode.js";
|
|
10
13
|
import WithdrawalRequestStatus from "./WithdrawalRequestStatus.js";
|
|
@@ -16,17 +19,34 @@ import { WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson } from
|
|
|
16
19
|
/** This object represents a request made for an L1 withdrawal from your Lightspark Node to any Bitcoin wallet. You can retrieve this object to receive detailed information about any withdrawal request made from your Lightspark account. **/
|
|
17
20
|
class WithdrawalRequest implements Entity {
|
|
18
21
|
constructor(
|
|
22
|
+
/**
|
|
23
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
24
|
+
* string.
|
|
25
|
+
**/
|
|
19
26
|
public readonly id: string,
|
|
27
|
+
/** The date and time when the entity was first created. **/
|
|
20
28
|
public readonly createdAt: string,
|
|
29
|
+
/** The date and time when the entity was last updated. **/
|
|
21
30
|
public readonly updatedAt: string,
|
|
31
|
+
/** The amount of money that should be withdrawn in this request. **/
|
|
22
32
|
public readonly amount: CurrencyAmount,
|
|
33
|
+
/** The bitcoin address where the funds should be sent. **/
|
|
23
34
|
public readonly bitcoinAddress: string,
|
|
35
|
+
/** The strategy that should be used to withdraw the funds from the account. **/
|
|
24
36
|
public readonly withdrawalMode: WithdrawalMode,
|
|
37
|
+
/** The current status of this withdrawal request. **/
|
|
25
38
|
public readonly status: WithdrawalRequestStatus,
|
|
39
|
+
/** The typename of the object **/
|
|
26
40
|
public readonly typename: string,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
41
|
+
/**
|
|
42
|
+
* If the requested amount is `-1` (i.e. everything), this field may contain an estimate of the amount
|
|
43
|
+
* for the withdrawal.
|
|
44
|
+
**/
|
|
45
|
+
public readonly estimatedAmount?: CurrencyAmount | undefined,
|
|
46
|
+
/** The time at which this request was completed. **/
|
|
47
|
+
public readonly completedAt?: string | undefined,
|
|
48
|
+
/** The withdrawal transaction that has been generated by this request. **/
|
|
49
|
+
public readonly withdrawalId?: string | undefined,
|
|
30
50
|
) {
|
|
31
51
|
autoBind(this);
|
|
32
52
|
}
|
|
@@ -180,6 +200,24 @@ ${FRAGMENT}
|
|
|
180
200
|
constructObject: (data: any) => WithdrawalRequestFromJson(data.entity),
|
|
181
201
|
};
|
|
182
202
|
}
|
|
203
|
+
|
|
204
|
+
public toJson() {
|
|
205
|
+
return {
|
|
206
|
+
__typename: "WithdrawalRequest",
|
|
207
|
+
withdrawal_request_id: this.id,
|
|
208
|
+
withdrawal_request_created_at: this.createdAt,
|
|
209
|
+
withdrawal_request_updated_at: this.updatedAt,
|
|
210
|
+
withdrawal_request_amount: CurrencyAmountToJson(this.amount),
|
|
211
|
+
withdrawal_request_estimated_amount: this.estimatedAmount
|
|
212
|
+
? CurrencyAmountToJson(this.estimatedAmount)
|
|
213
|
+
: undefined,
|
|
214
|
+
withdrawal_request_bitcoin_address: this.bitcoinAddress,
|
|
215
|
+
withdrawal_request_withdrawal_mode: this.withdrawalMode,
|
|
216
|
+
withdrawal_request_status: this.status,
|
|
217
|
+
withdrawal_request_completed_at: this.completedAt,
|
|
218
|
+
withdrawal_request_withdrawal: { id: this.withdrawalId } ?? undefined,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
183
221
|
}
|
|
184
222
|
|
|
185
223
|
export const WithdrawalRequestFromJson = (obj: any): WithdrawalRequest => {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type ChannelClosingTransaction from "./ChannelClosingTransaction.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ChannelClosingTransactionFromJson,
|
|
6
|
+
ChannelClosingTransactionToJson,
|
|
7
|
+
} from "./ChannelClosingTransaction.js";
|
|
5
8
|
import type PageInfo from "./PageInfo.js";
|
|
6
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
9
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
interface WithdrawalRequestToChannelClosingTransactionsConnection {
|
|
9
12
|
/** An object that holds pagination information about the objects in this connection. **/
|
|
10
13
|
pageInfo: PageInfo;
|
|
11
14
|
|
|
@@ -17,7 +20,7 @@ type WithdrawalRequestToChannelClosingTransactionsConnection = {
|
|
|
17
20
|
|
|
18
21
|
/** The channel closing transactions for the current page of this connection. **/
|
|
19
22
|
entities: ChannelClosingTransaction[];
|
|
20
|
-
}
|
|
23
|
+
}
|
|
21
24
|
|
|
22
25
|
export const WithdrawalRequestToChannelClosingTransactionsConnectionFromJson = (
|
|
23
26
|
obj: any,
|
|
@@ -37,6 +40,18 @@ export const WithdrawalRequestToChannelClosingTransactionsConnectionFromJson = (
|
|
|
37
40
|
].map((e) => ChannelClosingTransactionFromJson(e)),
|
|
38
41
|
} as WithdrawalRequestToChannelClosingTransactionsConnection;
|
|
39
42
|
};
|
|
43
|
+
export const WithdrawalRequestToChannelClosingTransactionsConnectionToJson = (
|
|
44
|
+
obj: WithdrawalRequestToChannelClosingTransactionsConnection,
|
|
45
|
+
): any => {
|
|
46
|
+
return {
|
|
47
|
+
withdrawal_request_to_channel_closing_transactions_connection_page_info:
|
|
48
|
+
PageInfoToJson(obj.pageInfo),
|
|
49
|
+
withdrawal_request_to_channel_closing_transactions_connection_count:
|
|
50
|
+
obj.count,
|
|
51
|
+
withdrawal_request_to_channel_closing_transactions_connection_entities:
|
|
52
|
+
obj.entities.map((e) => ChannelClosingTransactionToJson(e)),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
40
55
|
|
|
41
56
|
export const FRAGMENT = `
|
|
42
57
|
fragment WithdrawalRequestToChannelClosingTransactionsConnectionFragment on WithdrawalRequestToChannelClosingTransactionsConnection {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type ChannelOpeningTransaction from "./ChannelOpeningTransaction.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ChannelOpeningTransactionFromJson,
|
|
6
|
+
ChannelOpeningTransactionToJson,
|
|
7
|
+
} from "./ChannelOpeningTransaction.js";
|
|
5
8
|
import type PageInfo from "./PageInfo.js";
|
|
6
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
9
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
interface WithdrawalRequestToChannelOpeningTransactionsConnection {
|
|
9
12
|
/** An object that holds pagination information about the objects in this connection. **/
|
|
10
13
|
pageInfo: PageInfo;
|
|
11
14
|
|
|
@@ -17,7 +20,7 @@ type WithdrawalRequestToChannelOpeningTransactionsConnection = {
|
|
|
17
20
|
|
|
18
21
|
/** The channel opening transactions for the current page of this connection. **/
|
|
19
22
|
entities: ChannelOpeningTransaction[];
|
|
20
|
-
}
|
|
23
|
+
}
|
|
21
24
|
|
|
22
25
|
export const WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (
|
|
23
26
|
obj: any,
|
|
@@ -37,6 +40,18 @@ export const WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (
|
|
|
37
40
|
].map((e) => ChannelOpeningTransactionFromJson(e)),
|
|
38
41
|
} as WithdrawalRequestToChannelOpeningTransactionsConnection;
|
|
39
42
|
};
|
|
43
|
+
export const WithdrawalRequestToChannelOpeningTransactionsConnectionToJson = (
|
|
44
|
+
obj: WithdrawalRequestToChannelOpeningTransactionsConnection,
|
|
45
|
+
): any => {
|
|
46
|
+
return {
|
|
47
|
+
withdrawal_request_to_channel_opening_transactions_connection_page_info:
|
|
48
|
+
PageInfoToJson(obj.pageInfo),
|
|
49
|
+
withdrawal_request_to_channel_opening_transactions_connection_count:
|
|
50
|
+
obj.count,
|
|
51
|
+
withdrawal_request_to_channel_opening_transactions_connection_entities:
|
|
52
|
+
obj.entities.map((e) => ChannelOpeningTransactionToJson(e)),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
40
55
|
|
|
41
56
|
export const FRAGMENT = `
|
|
42
57
|
fragment WithdrawalRequestToChannelOpeningTransactionsConnectionFragment on WithdrawalRequestToChannelOpeningTransactionsConnection {
|
package/src/objects/index.ts
CHANGED
|
@@ -68,7 +68,10 @@ export {
|
|
|
68
68
|
default as LightningTransaction,
|
|
69
69
|
getLightningTransactionQuery,
|
|
70
70
|
} from "./LightningTransaction.js";
|
|
71
|
-
export {
|
|
71
|
+
export {
|
|
72
|
+
default as LightsparkNode,
|
|
73
|
+
getLightsparkNodeQuery,
|
|
74
|
+
} from "./LightsparkNode.js";
|
|
72
75
|
export {
|
|
73
76
|
default as LightsparkNodeOwner,
|
|
74
77
|
getLightsparkNodeOwnerQuery,
|
|
@@ -77,7 +80,7 @@ export { default as LightsparkNodeStatus } from "./LightsparkNodeStatus.js";
|
|
|
77
80
|
export { default as LightsparkNodeToChannelsConnection } from "./LightsparkNodeToChannelsConnection.js";
|
|
78
81
|
export { default as LightsparkNodeWithOSK } from "./LightsparkNodeWithOSK.js";
|
|
79
82
|
export { default as LightsparkNodeWithRemoteSigning } from "./LightsparkNodeWithRemoteSigning.js";
|
|
80
|
-
export { default as Node } from "./Node.js";
|
|
83
|
+
export { default as Node, getNodeQuery } from "./Node.js";
|
|
81
84
|
export { default as NodeAddress } from "./NodeAddress.js";
|
|
82
85
|
export { default as NodeAddressType } from "./NodeAddressType.js";
|
|
83
86
|
export { default as NodeToAddressesConnection } from "./NodeToAddressesConnection.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const TESTS_TIMEOUT = 60_000; //ms
|
|
2
|
+
export const LONG_TEST_TIMEOUT = 600_0000; //ms
|
|
3
|
+
export const DAY_IN_MS = 86400000; //ms
|
|
4
|
+
export const INVOICE_EXPIRY = 172800; //ms
|
|
5
|
+
export const TRANSACTION_WAIT_TIME = TESTS_TIMEOUT / 1000; //seconds
|
|
6
|
+
export const PAGINATION_STEP = 3;
|
|
7
|
+
|
|
8
|
+
export const PAY_AMOUNT = 1_000; //msats
|
|
9
|
+
export const MAX_FEE = 10000000; //msats
|
|
10
|
+
|
|
11
|
+
export const REGTEST_SIGNING_KEY_PASSWORD = "1234!@#$";
|
|
12
|
+
export const ENCODED_REGTEST_REQUEST_FOR_TESTS =
|
|
13
|
+
"lnbcrt1pjj6zu2pp50qr2p79v65u9l8w3859259yj9fe5nt79hfw5k2am424440tlj09qdq0dp5jqargv4ex2ggcqzpgxqyz5vqsp5v0z0fu99jf37xcasu88evuphx9kdrpvtupdvhu329kx7k7un59zs9qyyssqegzx986rszy96te2kmxl7prlz0p8avthpwzhsz5v220uek7xxrz54svdsjpzwn04m6utj5ua9tmtktygc5xmjmjaqey9dadt33r8gxspvcg8wv";
|