@lightsparkdev/lightspark-sdk 1.5.13 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/{chunk-FGFVWCTL.js → chunk-UHTZSOPX.js} +272 -144
- package/dist/{index-2b493387.d.ts → index-145ff316.d.ts} +232 -87
- package/dist/index.cjs +351 -142
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +85 -3
- package/dist/objects/index.cjs +262 -133
- package/dist/objects/index.d.cts +1 -1
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +3 -1
- package/package.json +2 -2
- package/src/client.ts +62 -0
- package/src/graphql/InvoiceForPaymentHash.ts +17 -0
- package/src/graphql/OutgoingPaymentsForPaymentHash.ts +21 -0
- package/src/objects/Account.ts +14 -2
- package/src/objects/ChannelClosingTransaction.ts +1 -4
- package/src/objects/ChannelOpeningTransaction.ts +1 -4
- package/src/objects/Connection.ts +116 -0
- package/src/objects/Deposit.ts +1 -4
- package/src/objects/Entity.ts +10 -0
- package/src/objects/FailHtlcsInput.ts +27 -0
- package/src/objects/FailHtlcsOutput.ts +26 -0
- package/src/objects/InvoiceForPaymentHashInput.ts +23 -0
- package/src/objects/InvoiceForPaymentHashOutput.ts +30 -0
- package/src/objects/LightningTransaction.ts +3 -0
- package/src/objects/LightsparkNode.ts +3 -1
- package/src/objects/LightsparkNodeWithOSK.ts +8 -4
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +8 -4
- package/src/objects/OnChainFeeTarget.ts +19 -0
- package/src/objects/OnChainTransaction.ts +1 -4
- package/src/objects/OutgoingPayment.ts +5 -0
- package/src/objects/OutgoingPaymentForIdempotencyKeyInput.ts +24 -0
- package/src/objects/OutgoingPaymentForIdempotencyKeyOutput.ts +33 -0
- package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +1 -0
- package/src/objects/OutgoingPaymentsForPaymentHashQueryInput.ts +34 -0
- package/src/objects/OutgoingPaymentsForPaymentHashQueryOutput.ts +37 -0
- package/src/objects/PayInvoiceInput.ts +8 -0
- package/src/objects/PayUmaInvoiceInput.ts +4 -0
- package/src/objects/PaymentFailureReason.ts +2 -0
- package/src/objects/RemoteSigningSubEventType.ts +2 -0
- package/src/objects/RequestWithdrawalInput.ts +29 -0
- package/src/objects/SendPaymentInput.ts +8 -0
- package/src/objects/Transaction.ts +3 -0
- package/src/objects/TransactionStatus.ts +1 -1
- package/src/objects/Wallet.ts +10 -0
- package/src/objects/Withdrawal.ts +1 -4
- package/src/objects/WithdrawalRequest.ts +107 -11
- package/src/objects/WithdrawalRequestStatus.ts +2 -0
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +15 -10
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +15 -10
- package/src/objects/WithdrawalRequestToWithdrawalsConnection.ts +47 -0
- package/src/objects/index.ts +10 -0
- package/src/webhooks.ts +3 -0
|
@@ -161,15 +161,17 @@ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [Node
|
|
|
161
161
|
public async getChannels(
|
|
162
162
|
client: LightsparkClient,
|
|
163
163
|
first: number | undefined = undefined,
|
|
164
|
-
statuses: ChannelStatus[] | undefined = undefined,
|
|
165
164
|
after: string | undefined = undefined,
|
|
165
|
+
beforeDate: string | undefined = undefined,
|
|
166
|
+
afterDate: string | undefined = undefined,
|
|
167
|
+
statuses: ChannelStatus[] | undefined = undefined,
|
|
166
168
|
): Promise<LightsparkNodeToChannelsConnection> {
|
|
167
169
|
return (await client.executeRawQuery({
|
|
168
170
|
queryPayload: `
|
|
169
|
-
query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!]
|
|
171
|
+
query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $after: String, $before_date: DateTime, $after_date: DateTime, $statuses: [ChannelStatus!]) {
|
|
170
172
|
entity(id: $entity_id) {
|
|
171
173
|
... on LightsparkNodeWithOSK {
|
|
172
|
-
channels(, first: $first,
|
|
174
|
+
channels(, first: $first, after: $after, before_date: $before_date, after_date: $after_date, statuses: $statuses) {
|
|
173
175
|
__typename
|
|
174
176
|
lightspark_node_to_channels_connection_count: count
|
|
175
177
|
lightspark_node_to_channels_connection_page_info: page_info {
|
|
@@ -281,8 +283,10 @@ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $sta
|
|
|
281
283
|
variables: {
|
|
282
284
|
entity_id: this.id,
|
|
283
285
|
first: first,
|
|
284
|
-
statuses: statuses,
|
|
285
286
|
after: after,
|
|
287
|
+
before_date: beforeDate,
|
|
288
|
+
after_date: afterDate,
|
|
289
|
+
statuses: statuses,
|
|
286
290
|
},
|
|
287
291
|
constructObject: (json) => {
|
|
288
292
|
const connection = json["entity"]["channels"];
|
|
@@ -154,15 +154,17 @@ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [Node
|
|
|
154
154
|
public async getChannels(
|
|
155
155
|
client: LightsparkClient,
|
|
156
156
|
first: number | undefined = undefined,
|
|
157
|
-
statuses: ChannelStatus[] | undefined = undefined,
|
|
158
157
|
after: string | undefined = undefined,
|
|
158
|
+
beforeDate: string | undefined = undefined,
|
|
159
|
+
afterDate: string | undefined = undefined,
|
|
160
|
+
statuses: ChannelStatus[] | undefined = undefined,
|
|
159
161
|
): Promise<LightsparkNodeToChannelsConnection> {
|
|
160
162
|
return (await client.executeRawQuery({
|
|
161
163
|
queryPayload: `
|
|
162
|
-
query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!]
|
|
164
|
+
query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $after: String, $before_date: DateTime, $after_date: DateTime, $statuses: [ChannelStatus!]) {
|
|
163
165
|
entity(id: $entity_id) {
|
|
164
166
|
... on LightsparkNodeWithRemoteSigning {
|
|
165
|
-
channels(, first: $first,
|
|
167
|
+
channels(, first: $first, after: $after, before_date: $before_date, after_date: $after_date, statuses: $statuses) {
|
|
166
168
|
__typename
|
|
167
169
|
lightspark_node_to_channels_connection_count: count
|
|
168
170
|
lightspark_node_to_channels_connection_page_info: page_info {
|
|
@@ -274,8 +276,10 @@ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $sta
|
|
|
274
276
|
variables: {
|
|
275
277
|
entity_id: this.id,
|
|
276
278
|
first: first,
|
|
277
|
-
statuses: statuses,
|
|
278
279
|
after: after,
|
|
280
|
+
before_date: beforeDate,
|
|
281
|
+
after_date: afterDate,
|
|
282
|
+
statuses: statuses,
|
|
279
283
|
},
|
|
280
284
|
constructObject: (json) => {
|
|
281
285
|
const connection = json["entity"]["channels"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
export enum OnChainFeeTarget {
|
|
4
|
+
/**
|
|
5
|
+
* This is an enum value that represents values that could be added in the future.
|
|
6
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
7
|
+
*/
|
|
8
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
9
|
+
/** Transaction expected to be confirmed within 2 blocks. **/
|
|
10
|
+
HIGH = "HIGH",
|
|
11
|
+
/** Transaction expected to be confirmed within 6 blocks. **/
|
|
12
|
+
MEDIUM = "MEDIUM",
|
|
13
|
+
/** Transaction expected to be confirmed within 18 blocks. **/
|
|
14
|
+
LOW = "LOW",
|
|
15
|
+
/** Transaction expected to be confirmed within 50 blocks. **/
|
|
16
|
+
BACKGROUND = "BACKGROUND",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default OnChainFeeTarget;
|
|
@@ -54,10 +54,7 @@ interface OnChainTransaction {
|
|
|
54
54
|
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
55
55
|
transactionHash?: string | undefined;
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
|
|
59
|
-
* blockchain.
|
|
60
|
-
**/
|
|
57
|
+
/** The fees that were paid by the node for this transaction. **/
|
|
61
58
|
fees?: CurrencyAmount | undefined;
|
|
62
59
|
|
|
63
60
|
/**
|
|
@@ -77,6 +77,8 @@ class OutgoingPayment implements LightningTransaction, Transaction, Entity {
|
|
|
77
77
|
public readonly umaPostTransactionData?: PostTransactionData[] | undefined,
|
|
78
78
|
/** The preimage of the payment. **/
|
|
79
79
|
public readonly paymentPreimage?: string | undefined,
|
|
80
|
+
/** The idempotency key of the payment. **/
|
|
81
|
+
public readonly idempotencyKey?: string | undefined,
|
|
80
82
|
) {
|
|
81
83
|
autoBind(this);
|
|
82
84
|
}
|
|
@@ -192,6 +194,7 @@ ${FRAGMENT}
|
|
|
192
194
|
this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e)),
|
|
193
195
|
outgoing_payment_payment_preimage: this.paymentPreimage,
|
|
194
196
|
outgoing_payment_is_internal_payment: this.isInternalPayment,
|
|
197
|
+
outgoing_payment_idempotency_key: this.idempotencyKey,
|
|
195
198
|
};
|
|
196
199
|
}
|
|
197
200
|
}
|
|
@@ -228,6 +231,7 @@ export const OutgoingPaymentFromJson = (obj: any): OutgoingPayment => {
|
|
|
228
231
|
PostTransactionDataFromJson(e),
|
|
229
232
|
),
|
|
230
233
|
obj["outgoing_payment_payment_preimage"],
|
|
234
|
+
obj["outgoing_payment_idempotency_key"],
|
|
231
235
|
);
|
|
232
236
|
};
|
|
233
237
|
|
|
@@ -576,6 +580,7 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
|
|
|
576
580
|
}
|
|
577
581
|
outgoing_payment_payment_preimage: payment_preimage
|
|
578
582
|
outgoing_payment_is_internal_payment: is_internal_payment
|
|
583
|
+
outgoing_payment_idempotency_key: idempotency_key
|
|
579
584
|
}`;
|
|
580
585
|
|
|
581
586
|
export default OutgoingPayment;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
interface OutgoingPaymentForIdempotencyKeyInput {
|
|
4
|
+
idempotencyKey: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const OutgoingPaymentForIdempotencyKeyInputFromJson = (
|
|
8
|
+
obj: any,
|
|
9
|
+
): OutgoingPaymentForIdempotencyKeyInput => {
|
|
10
|
+
return {
|
|
11
|
+
idempotencyKey:
|
|
12
|
+
obj["outgoing_payment_for_idempotency_key_input_idempotency_key"],
|
|
13
|
+
} as OutgoingPaymentForIdempotencyKeyInput;
|
|
14
|
+
};
|
|
15
|
+
export const OutgoingPaymentForIdempotencyKeyInputToJson = (
|
|
16
|
+
obj: OutgoingPaymentForIdempotencyKeyInput,
|
|
17
|
+
): any => {
|
|
18
|
+
return {
|
|
19
|
+
outgoing_payment_for_idempotency_key_input_idempotency_key:
|
|
20
|
+
obj.idempotencyKey,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default OutgoingPaymentForIdempotencyKeyInput;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
interface OutgoingPaymentForIdempotencyKeyOutput {
|
|
4
|
+
paymentId?: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const OutgoingPaymentForIdempotencyKeyOutputFromJson = (
|
|
8
|
+
obj: any,
|
|
9
|
+
): OutgoingPaymentForIdempotencyKeyOutput => {
|
|
10
|
+
return {
|
|
11
|
+
paymentId:
|
|
12
|
+
obj["outgoing_payment_for_idempotency_key_output_payment"]?.id ??
|
|
13
|
+
undefined,
|
|
14
|
+
} as OutgoingPaymentForIdempotencyKeyOutput;
|
|
15
|
+
};
|
|
16
|
+
export const OutgoingPaymentForIdempotencyKeyOutputToJson = (
|
|
17
|
+
obj: OutgoingPaymentForIdempotencyKeyOutput,
|
|
18
|
+
): any => {
|
|
19
|
+
return {
|
|
20
|
+
outgoing_payment_for_idempotency_key_output_payment:
|
|
21
|
+
{ id: obj.paymentId } ?? undefined,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const FRAGMENT = `
|
|
26
|
+
fragment OutgoingPaymentForIdempotencyKeyOutputFragment on OutgoingPaymentForIdempotencyKeyOutput {
|
|
27
|
+
__typename
|
|
28
|
+
outgoing_payment_for_idempotency_key_output_payment: payment {
|
|
29
|
+
id
|
|
30
|
+
}
|
|
31
|
+
}`;
|
|
32
|
+
|
|
33
|
+
export default OutgoingPaymentForIdempotencyKeyOutput;
|
|
@@ -373,6 +373,7 @@ fragment OutgoingPaymentsForInvoiceQueryOutputFragment on OutgoingPaymentsForInv
|
|
|
373
373
|
}
|
|
374
374
|
outgoing_payment_payment_preimage: payment_preimage
|
|
375
375
|
outgoing_payment_is_internal_payment: is_internal_payment
|
|
376
|
+
outgoing_payment_idempotency_key: idempotency_key
|
|
376
377
|
}
|
|
377
378
|
}`;
|
|
378
379
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import TransactionStatus from "./TransactionStatus.js";
|
|
4
|
+
|
|
5
|
+
interface OutgoingPaymentsForPaymentHashQueryInput {
|
|
6
|
+
/** The 32-byte hash of the payment preimage for which to fetch payments **/
|
|
7
|
+
paymentHash: string;
|
|
8
|
+
|
|
9
|
+
/** An optional filter to only query outgoing payments of given statuses. **/
|
|
10
|
+
statuses?: TransactionStatus[] | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const OutgoingPaymentsForPaymentHashQueryInputFromJson = (
|
|
14
|
+
obj: any,
|
|
15
|
+
): OutgoingPaymentsForPaymentHashQueryInput => {
|
|
16
|
+
return {
|
|
17
|
+
paymentHash:
|
|
18
|
+
obj["outgoing_payments_for_payment_hash_query_input_payment_hash"],
|
|
19
|
+
statuses: obj[
|
|
20
|
+
"outgoing_payments_for_payment_hash_query_input_statuses"
|
|
21
|
+
]?.map((e) => TransactionStatus[e]),
|
|
22
|
+
} as OutgoingPaymentsForPaymentHashQueryInput;
|
|
23
|
+
};
|
|
24
|
+
export const OutgoingPaymentsForPaymentHashQueryInputToJson = (
|
|
25
|
+
obj: OutgoingPaymentsForPaymentHashQueryInput,
|
|
26
|
+
): any => {
|
|
27
|
+
return {
|
|
28
|
+
outgoing_payments_for_payment_hash_query_input_payment_hash:
|
|
29
|
+
obj.paymentHash,
|
|
30
|
+
outgoing_payments_for_payment_hash_query_input_statuses: obj.statuses,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default OutgoingPaymentsForPaymentHashQueryInput;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import type OutgoingPayment from "./OutgoingPayment.js";
|
|
4
|
+
import { OutgoingPaymentFromJson } from "./OutgoingPayment.js";
|
|
5
|
+
|
|
6
|
+
interface OutgoingPaymentsForPaymentHashQueryOutput {
|
|
7
|
+
payments: OutgoingPayment[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const OutgoingPaymentsForPaymentHashQueryOutputFromJson = (
|
|
11
|
+
obj: any,
|
|
12
|
+
): OutgoingPaymentsForPaymentHashQueryOutput => {
|
|
13
|
+
return {
|
|
14
|
+
payments: obj[
|
|
15
|
+
"outgoing_payments_for_payment_hash_query_output_payments"
|
|
16
|
+
].map((e) => OutgoingPaymentFromJson(e)),
|
|
17
|
+
} as OutgoingPaymentsForPaymentHashQueryOutput;
|
|
18
|
+
};
|
|
19
|
+
export const OutgoingPaymentsForPaymentHashQueryOutputToJson = (
|
|
20
|
+
obj: OutgoingPaymentsForPaymentHashQueryOutput,
|
|
21
|
+
): any => {
|
|
22
|
+
return {
|
|
23
|
+
outgoing_payments_for_payment_hash_query_output_payments: obj.payments.map(
|
|
24
|
+
(e) => e.toJson(),
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const FRAGMENT = `
|
|
30
|
+
fragment OutgoingPaymentsForPaymentHashQueryOutputFragment on OutgoingPaymentsForPaymentHashQueryOutput {
|
|
31
|
+
__typename
|
|
32
|
+
outgoing_payments_for_payment_hash_query_output_payments: payments {
|
|
33
|
+
id
|
|
34
|
+
}
|
|
35
|
+
}`;
|
|
36
|
+
|
|
37
|
+
export default OutgoingPaymentsForPaymentHashQueryOutput;
|
|
@@ -21,6 +21,12 @@ interface PayInvoiceInput {
|
|
|
21
21
|
* invoice amount is zero.
|
|
22
22
|
**/
|
|
23
23
|
amountMsats?: number | undefined;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The idempotency key of the request. The same result will be returned for the same
|
|
27
|
+
* idempotency key. *
|
|
28
|
+
*/
|
|
29
|
+
idempotencyKey?: string | undefined;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
export const PayInvoiceInputFromJson = (obj: any): PayInvoiceInput => {
|
|
@@ -30,6 +36,7 @@ export const PayInvoiceInputFromJson = (obj: any): PayInvoiceInput => {
|
|
|
30
36
|
timeoutSecs: obj["pay_invoice_input_timeout_secs"],
|
|
31
37
|
maximumFeesMsats: obj["pay_invoice_input_maximum_fees_msats"],
|
|
32
38
|
amountMsats: obj["pay_invoice_input_amount_msats"],
|
|
39
|
+
idempotencyKey: obj["pay_invoice_input_idempotency_key"],
|
|
33
40
|
} as PayInvoiceInput;
|
|
34
41
|
};
|
|
35
42
|
export const PayInvoiceInputToJson = (obj: PayInvoiceInput): any => {
|
|
@@ -39,6 +46,7 @@ export const PayInvoiceInputToJson = (obj: PayInvoiceInput): any => {
|
|
|
39
46
|
pay_invoice_input_timeout_secs: obj.timeoutSecs,
|
|
40
47
|
pay_invoice_input_maximum_fees_msats: obj.maximumFeesMsats,
|
|
41
48
|
pay_invoice_input_amount_msats: obj.amountMsats,
|
|
49
|
+
pay_invoice_input_idempotency_key: obj.idempotencyKey,
|
|
42
50
|
};
|
|
43
51
|
};
|
|
44
52
|
|
|
@@ -10,6 +10,8 @@ interface PayUmaInvoiceInput {
|
|
|
10
10
|
maximumFeesMsats: number;
|
|
11
11
|
|
|
12
12
|
amountMsats?: number | undefined;
|
|
13
|
+
|
|
14
|
+
idempotencyKey?: string | undefined;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export const PayUmaInvoiceInputFromJson = (obj: any): PayUmaInvoiceInput => {
|
|
@@ -19,6 +21,7 @@ export const PayUmaInvoiceInputFromJson = (obj: any): PayUmaInvoiceInput => {
|
|
|
19
21
|
timeoutSecs: obj["pay_uma_invoice_input_timeout_secs"],
|
|
20
22
|
maximumFeesMsats: obj["pay_uma_invoice_input_maximum_fees_msats"],
|
|
21
23
|
amountMsats: obj["pay_uma_invoice_input_amount_msats"],
|
|
24
|
+
idempotencyKey: obj["pay_uma_invoice_input_idempotency_key"],
|
|
22
25
|
} as PayUmaInvoiceInput;
|
|
23
26
|
};
|
|
24
27
|
export const PayUmaInvoiceInputToJson = (obj: PayUmaInvoiceInput): any => {
|
|
@@ -28,6 +31,7 @@ export const PayUmaInvoiceInputToJson = (obj: PayUmaInvoiceInput): any => {
|
|
|
28
31
|
pay_uma_invoice_input_timeout_secs: obj.timeoutSecs,
|
|
29
32
|
pay_uma_invoice_input_maximum_fees_msats: obj.maximumFeesMsats,
|
|
30
33
|
pay_uma_invoice_input_amount_msats: obj.amountMsats,
|
|
34
|
+
pay_uma_invoice_input_idempotency_key: obj.idempotencyKey,
|
|
31
35
|
};
|
|
32
36
|
};
|
|
33
37
|
|
|
@@ -32,6 +32,8 @@ export enum PaymentFailureReason {
|
|
|
32
32
|
INVOICE_CANCELLED = "INVOICE_CANCELLED",
|
|
33
33
|
|
|
34
34
|
RISK_SCREENING_FAILED = "RISK_SCREENING_FAILED",
|
|
35
|
+
|
|
36
|
+
INSUFFICIENT_BALANCE_ON_SINGLE_PATH_INVOICE = "INSUFFICIENT_BALANCE_ON_SINGLE_PATH_INVOICE",
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export default PaymentFailureReason;
|
|
@@ -23,6 +23,8 @@ export enum RemoteSigningSubEventType {
|
|
|
23
23
|
REQUEST_INVOICE_PAYMENT_HASH = "REQUEST_INVOICE_PAYMENT_HASH",
|
|
24
24
|
|
|
25
25
|
REVEAL_COUNTERPARTY_PER_COMMITMENT_SECRET = "REVEAL_COUNTERPARTY_PER_COMMITMENT_SECRET",
|
|
26
|
+
|
|
27
|
+
VLS_MESSAGE = "VLS_MESSAGE",
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export default RemoteSigningSubEventType;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
import OnChainFeeTarget from "./OnChainFeeTarget.js";
|
|
3
4
|
import WithdrawalMode from "./WithdrawalMode.js";
|
|
4
5
|
|
|
5
6
|
interface RequestWithdrawalInput {
|
|
@@ -17,6 +18,25 @@ interface RequestWithdrawalInput {
|
|
|
17
18
|
|
|
18
19
|
/** The strategy that should be used to withdraw the funds from this node. **/
|
|
19
20
|
withdrawalMode: WithdrawalMode;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The idempotency key of the request. The same result will be returned for the same
|
|
24
|
+
* idempotency key. *
|
|
25
|
+
*/
|
|
26
|
+
idempotencyKey?: string | undefined;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The target of the fee that should be used when crafting the L1 transaction. You should only
|
|
30
|
+
* set `fee_target` or `sats_per_vbyte`. If neither of them is set, default value of MEDIUM
|
|
31
|
+
* will be used as `fee_target`.
|
|
32
|
+
**/
|
|
33
|
+
feeTarget?: OnChainFeeTarget | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A manual fee rate set in sat/vbyte that should be used when crafting the L1 transaction. You
|
|
37
|
+
* should only set `fee_target` or `sats_per_vbyte`
|
|
38
|
+
**/
|
|
39
|
+
satsPerVbyte?: number | undefined;
|
|
20
40
|
}
|
|
21
41
|
|
|
22
42
|
export const RequestWithdrawalInputFromJson = (
|
|
@@ -29,6 +49,12 @@ export const RequestWithdrawalInputFromJson = (
|
|
|
29
49
|
withdrawalMode:
|
|
30
50
|
WithdrawalMode[obj["request_withdrawal_input_withdrawal_mode"]] ??
|
|
31
51
|
WithdrawalMode.FUTURE_VALUE,
|
|
52
|
+
idempotencyKey: obj["request_withdrawal_input_idempotency_key"],
|
|
53
|
+
feeTarget: !!obj["request_withdrawal_input_fee_target"]
|
|
54
|
+
? OnChainFeeTarget[obj["request_withdrawal_input_fee_target"]] ??
|
|
55
|
+
OnChainFeeTarget.FUTURE_VALUE
|
|
56
|
+
: null,
|
|
57
|
+
satsPerVbyte: obj["request_withdrawal_input_sats_per_vbyte"],
|
|
32
58
|
} as RequestWithdrawalInput;
|
|
33
59
|
};
|
|
34
60
|
export const RequestWithdrawalInputToJson = (
|
|
@@ -39,6 +65,9 @@ export const RequestWithdrawalInputToJson = (
|
|
|
39
65
|
request_withdrawal_input_bitcoin_address: obj.bitcoinAddress,
|
|
40
66
|
request_withdrawal_input_amount_sats: obj.amountSats,
|
|
41
67
|
request_withdrawal_input_withdrawal_mode: obj.withdrawalMode,
|
|
68
|
+
request_withdrawal_input_idempotency_key: obj.idempotencyKey,
|
|
69
|
+
request_withdrawal_input_fee_target: obj.feeTarget,
|
|
70
|
+
request_withdrawal_input_sats_per_vbyte: obj.satsPerVbyte,
|
|
42
71
|
};
|
|
43
72
|
};
|
|
44
73
|
|
|
@@ -18,6 +18,12 @@ interface SendPaymentInput {
|
|
|
18
18
|
* msats. *
|
|
19
19
|
*/
|
|
20
20
|
maximumFeesMsats: number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The idempotency key of the request. The same result will be returned for the same
|
|
24
|
+
* idempotency key. *
|
|
25
|
+
*/
|
|
26
|
+
idempotencyKey?: string | undefined;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
export const SendPaymentInputFromJson = (obj: any): SendPaymentInput => {
|
|
@@ -27,6 +33,7 @@ export const SendPaymentInputFromJson = (obj: any): SendPaymentInput => {
|
|
|
27
33
|
timeoutSecs: obj["send_payment_input_timeout_secs"],
|
|
28
34
|
amountMsats: obj["send_payment_input_amount_msats"],
|
|
29
35
|
maximumFeesMsats: obj["send_payment_input_maximum_fees_msats"],
|
|
36
|
+
idempotencyKey: obj["send_payment_input_idempotency_key"],
|
|
30
37
|
} as SendPaymentInput;
|
|
31
38
|
};
|
|
32
39
|
export const SendPaymentInputToJson = (obj: SendPaymentInput): any => {
|
|
@@ -36,6 +43,7 @@ export const SendPaymentInputToJson = (obj: SendPaymentInput): any => {
|
|
|
36
43
|
send_payment_input_timeout_secs: obj.timeoutSecs,
|
|
37
44
|
send_payment_input_amount_msats: obj.amountMsats,
|
|
38
45
|
send_payment_input_maximum_fees_msats: obj.maximumFeesMsats,
|
|
46
|
+
send_payment_input_idempotency_key: obj.idempotencyKey,
|
|
39
47
|
};
|
|
40
48
|
};
|
|
41
49
|
|
|
@@ -183,6 +183,7 @@ export const TransactionFromJson = (obj: any): Transaction => {
|
|
|
183
183
|
PostTransactionDataFromJson(e),
|
|
184
184
|
),
|
|
185
185
|
obj["outgoing_payment_payment_preimage"],
|
|
186
|
+
obj["outgoing_payment_idempotency_key"],
|
|
186
187
|
);
|
|
187
188
|
}
|
|
188
189
|
if (obj["__typename"] == "RoutingTransaction") {
|
|
@@ -380,6 +381,7 @@ export const TransactionToJson = (obj: Transaction): any => {
|
|
|
380
381
|
),
|
|
381
382
|
outgoing_payment_payment_preimage: outgoingPayment.paymentPreimage,
|
|
382
383
|
outgoing_payment_is_internal_payment: outgoingPayment.isInternalPayment,
|
|
384
|
+
outgoing_payment_idempotency_key: outgoingPayment.idempotencyKey,
|
|
383
385
|
};
|
|
384
386
|
}
|
|
385
387
|
if (obj.typename == "RoutingTransaction") {
|
|
@@ -915,6 +917,7 @@ fragment TransactionFragment on Transaction {
|
|
|
915
917
|
}
|
|
916
918
|
outgoing_payment_payment_preimage: payment_preimage
|
|
917
919
|
outgoing_payment_is_internal_payment: is_internal_payment
|
|
920
|
+
outgoing_payment_idempotency_key: idempotency_key
|
|
918
921
|
}
|
|
919
922
|
... on RoutingTransaction {
|
|
920
923
|
__typename
|
|
@@ -10,7 +10,7 @@ export enum TransactionStatus {
|
|
|
10
10
|
* Clients should support unknown values as more of them could be added without notice.
|
|
11
11
|
*/
|
|
12
12
|
FUTURE_VALUE = "FUTURE_VALUE",
|
|
13
|
-
/** Transaction succeeded
|
|
13
|
+
/** Transaction succeeded. **/
|
|
14
14
|
SUCCESS = "SUCCESS",
|
|
15
15
|
/** Transaction failed. **/
|
|
16
16
|
FAILED = "FAILED",
|
package/src/objects/Wallet.ts
CHANGED
|
@@ -557,6 +557,7 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after:
|
|
|
557
557
|
}
|
|
558
558
|
outgoing_payment_payment_preimage: payment_preimage
|
|
559
559
|
outgoing_payment_is_internal_payment: is_internal_payment
|
|
560
|
+
outgoing_payment_idempotency_key: idempotency_key
|
|
560
561
|
}
|
|
561
562
|
... on RoutingTransaction {
|
|
562
563
|
__typename
|
|
@@ -1092,6 +1093,14 @@ query FetchWalletToWithdrawalRequestsConnection($entity_id: ID!, $first: Int, $a
|
|
|
1092
1093
|
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
1093
1094
|
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
1094
1095
|
}
|
|
1096
|
+
withdrawal_request_total_fees: total_fees {
|
|
1097
|
+
__typename
|
|
1098
|
+
currency_amount_original_value: original_value
|
|
1099
|
+
currency_amount_original_unit: original_unit
|
|
1100
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
1101
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
1102
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
1103
|
+
}
|
|
1095
1104
|
withdrawal_request_bitcoin_address: bitcoin_address
|
|
1096
1105
|
withdrawal_request_withdrawal_mode: withdrawal_mode
|
|
1097
1106
|
withdrawal_request_status: status
|
|
@@ -1099,6 +1108,7 @@ query FetchWalletToWithdrawalRequestsConnection($entity_id: ID!, $first: Int, $a
|
|
|
1099
1108
|
withdrawal_request_withdrawal: withdrawal {
|
|
1100
1109
|
id
|
|
1101
1110
|
}
|
|
1111
|
+
withdrawal_request_idempotency_key: idempotency_key
|
|
1102
1112
|
}
|
|
1103
1113
|
}
|
|
1104
1114
|
}
|
|
@@ -53,10 +53,7 @@ interface Withdrawal {
|
|
|
53
53
|
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
54
54
|
transactionHash?: string | undefined;
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
|
|
58
|
-
* blockchain.
|
|
59
|
-
**/
|
|
56
|
+
/** The fees that were paid by the node for this transaction. **/
|
|
60
57
|
fees?: CurrencyAmount | undefined;
|
|
61
58
|
|
|
62
59
|
/**
|