@lightsparkdev/lightspark-sdk 0.1.7 → 0.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/Withdrawal-ebb4865c.d.ts +1688 -0
- package/dist/chunk-5Z7FB6OT.js +5530 -0
- package/dist/chunk-XFOVS6EY.js +5524 -0
- package/dist/index.cjs +133 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +107 -4
- package/dist/objects/index.cjs +24 -8
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +1 -1
- package/package.json +2 -2
- package/src/client.ts +7 -4
- package/src/objects/Account.ts +2 -2
- package/src/objects/Entity.ts +10 -2
- package/src/objects/Invoice.ts +1 -1
- package/src/objects/InvoiceData.ts +10 -1
- package/src/objects/LightningTransaction.ts +1 -1
- package/src/objects/LightsparkNodeStatus.ts +2 -0
- package/src/objects/OutgoingPayment.ts +1 -1
- package/src/objects/PaymentRequest.ts +1 -1
- package/src/objects/PaymentRequestData.ts +1 -1
- package/src/objects/Transaction.ts +1 -1
- package/src/objects/WebhookEventType.ts +10 -0
- package/src/objects/WithdrawalRequest.ts +12 -0
package/dist/objects/index.js
CHANGED
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
getRoutingTransactionQuery,
|
|
42
42
|
getTransactionQuery,
|
|
43
43
|
getWithdrawalQuery
|
|
44
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-5Z7FB6OT.js";
|
|
45
45
|
export {
|
|
46
46
|
Account_default as Account,
|
|
47
47
|
AccountToChannelsConnection_default as AccountToChannelsConnection,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"license": "Apache-2.0",
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@lightsparkdev/core": "^0.1
|
|
71
|
+
"@lightsparkdev/core": "^0.2.1",
|
|
72
72
|
"auto-bind": "^5.0.1",
|
|
73
73
|
"crypto": "^1.0.1",
|
|
74
74
|
"crypto-browserify": "^3.12.0",
|
package/src/client.ts
CHANGED
|
@@ -98,12 +98,13 @@ class LightsparkClient {
|
|
|
98
98
|
constructor(
|
|
99
99
|
private authProvider: AuthProvider = new StubAuthProvider(),
|
|
100
100
|
private readonly serverUrl: string = "api.lightspark.com",
|
|
101
|
-
// TODO(Jeremy): Figure out a way to avoid needing this from the wallet client.
|
|
102
101
|
private readonly nodeKeyCache: NodeKeyCache = new NodeKeyCache()
|
|
103
102
|
) {
|
|
103
|
+
const sdkVersion = require("../package.json").version;
|
|
104
104
|
this.requester = new Requester(
|
|
105
105
|
this.nodeKeyCache,
|
|
106
|
-
|
|
106
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
107
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
107
108
|
authProvider,
|
|
108
109
|
serverUrl
|
|
109
110
|
);
|
|
@@ -118,9 +119,11 @@ class LightsparkClient {
|
|
|
118
119
|
* @param authProvider
|
|
119
120
|
*/
|
|
120
121
|
public async setAuthProvider(authProvider: AuthProvider) {
|
|
122
|
+
const sdkVersion = require("../package.json").version;
|
|
121
123
|
this.requester = new Requester(
|
|
122
124
|
this.nodeKeyCache,
|
|
123
|
-
|
|
125
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
126
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
124
127
|
authProvider,
|
|
125
128
|
this.serverUrl
|
|
126
129
|
);
|
|
@@ -754,6 +757,6 @@ class LightsparkClient {
|
|
|
754
757
|
}
|
|
755
758
|
}
|
|
756
759
|
|
|
757
|
-
const
|
|
760
|
+
const LIGHTSPARK_SDK_ENDPOINT = "graphql/server/2023-04-04";
|
|
758
761
|
|
|
759
762
|
export default LightsparkClient;
|
package/src/objects/Account.ts
CHANGED
|
@@ -754,6 +754,7 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
|
|
|
754
754
|
}
|
|
755
755
|
invoice_data_created_at: created_at
|
|
756
756
|
invoice_data_expires_at: expires_at
|
|
757
|
+
invoice_data_memo: memo
|
|
757
758
|
invoice_data_destination: destination {
|
|
758
759
|
__typename
|
|
759
760
|
... on GraphNode {
|
|
@@ -874,7 +875,6 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
|
|
|
874
875
|
lightspark_node_status: status
|
|
875
876
|
}
|
|
876
877
|
}
|
|
877
|
-
invoice_data_memo: memo
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
outgoing_payment_failure_reason: failure_reason
|
|
@@ -1021,6 +1021,7 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
|
|
|
1021
1021
|
}
|
|
1022
1022
|
invoice_data_created_at: created_at
|
|
1023
1023
|
invoice_data_expires_at: expires_at
|
|
1024
|
+
invoice_data_memo: memo
|
|
1024
1025
|
invoice_data_destination: destination {
|
|
1025
1026
|
__typename
|
|
1026
1027
|
... on GraphNode {
|
|
@@ -1141,7 +1142,6 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
|
|
|
1141
1142
|
lightspark_node_status: status
|
|
1142
1143
|
}
|
|
1143
1144
|
}
|
|
1144
|
-
invoice_data_memo: memo
|
|
1145
1145
|
}
|
|
1146
1146
|
invoice_status: status
|
|
1147
1147
|
invoice_amount_paid: amount_paid {
|
package/src/objects/Entity.ts
CHANGED
|
@@ -332,6 +332,7 @@ fragment EntityFragment on Entity {
|
|
|
332
332
|
}
|
|
333
333
|
invoice_data_created_at: created_at
|
|
334
334
|
invoice_data_expires_at: expires_at
|
|
335
|
+
invoice_data_memo: memo
|
|
335
336
|
invoice_data_destination: destination {
|
|
336
337
|
__typename
|
|
337
338
|
... on GraphNode {
|
|
@@ -452,7 +453,6 @@ fragment EntityFragment on Entity {
|
|
|
452
453
|
lightspark_node_status: status
|
|
453
454
|
}
|
|
454
455
|
}
|
|
455
|
-
invoice_data_memo: memo
|
|
456
456
|
}
|
|
457
457
|
invoice_status: status
|
|
458
458
|
invoice_amount_paid: amount_paid {
|
|
@@ -616,6 +616,7 @@ fragment EntityFragment on Entity {
|
|
|
616
616
|
}
|
|
617
617
|
invoice_data_created_at: created_at
|
|
618
618
|
invoice_data_expires_at: expires_at
|
|
619
|
+
invoice_data_memo: memo
|
|
619
620
|
invoice_data_destination: destination {
|
|
620
621
|
__typename
|
|
621
622
|
... on GraphNode {
|
|
@@ -736,7 +737,6 @@ fragment EntityFragment on Entity {
|
|
|
736
737
|
lightspark_node_status: status
|
|
737
738
|
}
|
|
738
739
|
}
|
|
739
|
-
invoice_data_memo: memo
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
742
|
outgoing_payment_failure_reason: failure_reason
|
|
@@ -855,6 +855,14 @@ fragment EntityFragment on Entity {
|
|
|
855
855
|
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
856
856
|
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
857
857
|
}
|
|
858
|
+
withdrawal_request_estimated_amount: estimated_amount {
|
|
859
|
+
__typename
|
|
860
|
+
currency_amount_original_value: original_value
|
|
861
|
+
currency_amount_original_unit: original_unit
|
|
862
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
863
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
864
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
865
|
+
}
|
|
858
866
|
withdrawal_request_bitcoin_address: bitcoin_address
|
|
859
867
|
withdrawal_request_withdrawal_mode: withdrawal_mode
|
|
860
868
|
withdrawal_request_status: status
|
package/src/objects/Invoice.ts
CHANGED
|
@@ -72,6 +72,7 @@ fragment InvoiceFragment on Invoice {
|
|
|
72
72
|
}
|
|
73
73
|
invoice_data_created_at: created_at
|
|
74
74
|
invoice_data_expires_at: expires_at
|
|
75
|
+
invoice_data_memo: memo
|
|
75
76
|
invoice_data_destination: destination {
|
|
76
77
|
__typename
|
|
77
78
|
... on GraphNode {
|
|
@@ -192,7 +193,6 @@ fragment InvoiceFragment on Invoice {
|
|
|
192
193
|
lightspark_node_status: status
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
|
-
invoice_data_memo: memo
|
|
196
196
|
}
|
|
197
197
|
invoice_status: status
|
|
198
198
|
invoice_amount_paid: amount_paid {
|
|
@@ -11,19 +11,28 @@ type InvoiceData = PaymentRequestData & {
|
|
|
11
11
|
|
|
12
12
|
bitcoinNetwork: BitcoinNetwork;
|
|
13
13
|
|
|
14
|
+
/** The payment hash of this invoice. **/
|
|
14
15
|
paymentHash: string;
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The requested amount in this invoice. If it is equal to 0, the sender should choose the amount to
|
|
19
|
+
* send.
|
|
20
|
+
**/
|
|
16
21
|
amount: CurrencyAmount;
|
|
17
22
|
|
|
23
|
+
/** The date and time when this invoice was created. **/
|
|
18
24
|
createdAt: string;
|
|
19
25
|
|
|
26
|
+
/** The date and time when this invoice will expire. **/
|
|
20
27
|
expiresAt: string;
|
|
21
28
|
|
|
29
|
+
/** The lightning node that will be paid when fulfilling this invoice. **/
|
|
22
30
|
destination: Node;
|
|
23
31
|
|
|
24
32
|
/** The typename of the object **/
|
|
25
33
|
typename: string;
|
|
26
34
|
|
|
35
|
+
/** A short, UTF-8 encoded, description of the purpose of this invoice. **/
|
|
27
36
|
memo?: string;
|
|
28
37
|
};
|
|
29
38
|
|
|
@@ -59,6 +68,7 @@ fragment InvoiceDataFragment on InvoiceData {
|
|
|
59
68
|
}
|
|
60
69
|
invoice_data_created_at: created_at
|
|
61
70
|
invoice_data_expires_at: expires_at
|
|
71
|
+
invoice_data_memo: memo
|
|
62
72
|
invoice_data_destination: destination {
|
|
63
73
|
__typename
|
|
64
74
|
... on GraphNode {
|
|
@@ -179,7 +189,6 @@ fragment InvoiceDataFragment on InvoiceData {
|
|
|
179
189
|
lightspark_node_status: status
|
|
180
190
|
}
|
|
181
191
|
}
|
|
182
|
-
invoice_data_memo: memo
|
|
183
192
|
}`;
|
|
184
193
|
|
|
185
194
|
export default InvoiceData;
|
|
@@ -203,6 +203,7 @@ fragment LightningTransactionFragment on LightningTransaction {
|
|
|
203
203
|
}
|
|
204
204
|
invoice_data_created_at: created_at
|
|
205
205
|
invoice_data_expires_at: expires_at
|
|
206
|
+
invoice_data_memo: memo
|
|
206
207
|
invoice_data_destination: destination {
|
|
207
208
|
__typename
|
|
208
209
|
... on GraphNode {
|
|
@@ -323,7 +324,6 @@ fragment LightningTransactionFragment on LightningTransaction {
|
|
|
323
324
|
lightspark_node_status: status
|
|
324
325
|
}
|
|
325
326
|
}
|
|
326
|
-
invoice_data_memo: memo
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
outgoing_payment_failure_reason: failure_reason
|
|
@@ -186,6 +186,7 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
|
|
|
186
186
|
}
|
|
187
187
|
invoice_data_created_at: created_at
|
|
188
188
|
invoice_data_expires_at: expires_at
|
|
189
|
+
invoice_data_memo: memo
|
|
189
190
|
invoice_data_destination: destination {
|
|
190
191
|
__typename
|
|
191
192
|
... on GraphNode {
|
|
@@ -306,7 +307,6 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
|
|
|
306
307
|
lightspark_node_status: status
|
|
307
308
|
}
|
|
308
309
|
}
|
|
309
|
-
invoice_data_memo: memo
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
outgoing_payment_failure_reason: failure_reason
|
|
@@ -76,6 +76,7 @@ fragment PaymentRequestFragment on PaymentRequest {
|
|
|
76
76
|
}
|
|
77
77
|
invoice_data_created_at: created_at
|
|
78
78
|
invoice_data_expires_at: expires_at
|
|
79
|
+
invoice_data_memo: memo
|
|
79
80
|
invoice_data_destination: destination {
|
|
80
81
|
__typename
|
|
81
82
|
... on GraphNode {
|
|
@@ -196,7 +197,6 @@ fragment PaymentRequestFragment on PaymentRequest {
|
|
|
196
197
|
lightspark_node_status: status
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
|
-
invoice_data_memo: memo
|
|
200
200
|
}
|
|
201
201
|
invoice_status: status
|
|
202
202
|
invoice_amount_paid: amount_paid {
|
|
@@ -56,6 +56,7 @@ fragment PaymentRequestDataFragment on PaymentRequestData {
|
|
|
56
56
|
}
|
|
57
57
|
invoice_data_created_at: created_at
|
|
58
58
|
invoice_data_expires_at: expires_at
|
|
59
|
+
invoice_data_memo: memo
|
|
59
60
|
invoice_data_destination: destination {
|
|
60
61
|
__typename
|
|
61
62
|
... on GraphNode {
|
|
@@ -176,7 +177,6 @@ fragment PaymentRequestDataFragment on PaymentRequestData {
|
|
|
176
177
|
lightspark_node_status: status
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
|
-
invoice_data_memo: memo
|
|
180
180
|
}
|
|
181
181
|
}`;
|
|
182
182
|
|
|
@@ -389,6 +389,7 @@ fragment TransactionFragment on Transaction {
|
|
|
389
389
|
}
|
|
390
390
|
invoice_data_created_at: created_at
|
|
391
391
|
invoice_data_expires_at: expires_at
|
|
392
|
+
invoice_data_memo: memo
|
|
392
393
|
invoice_data_destination: destination {
|
|
393
394
|
__typename
|
|
394
395
|
... on GraphNode {
|
|
@@ -509,7 +510,6 @@ fragment TransactionFragment on Transaction {
|
|
|
509
510
|
lightspark_node_status: status
|
|
510
511
|
}
|
|
511
512
|
}
|
|
512
|
-
invoice_data_memo: memo
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
outgoing_payment_failure_reason: failure_reason
|
|
@@ -10,6 +10,16 @@ export enum WebhookEventType {
|
|
|
10
10
|
PAYMENT_FINISHED = "PAYMENT_FINISHED",
|
|
11
11
|
|
|
12
12
|
NODE_STATUS = "NODE_STATUS",
|
|
13
|
+
|
|
14
|
+
WALLET_STATUS = "WALLET_STATUS",
|
|
15
|
+
|
|
16
|
+
WALLET_OUTGOING_PAYMENT_FINISHED = "WALLET_OUTGOING_PAYMENT_FINISHED",
|
|
17
|
+
|
|
18
|
+
WALLET_INCOMING_PAYMENT_FINISHED = "WALLET_INCOMING_PAYMENT_FINISHED",
|
|
19
|
+
|
|
20
|
+
WALLET_WITHDRAWAL_FINISHED = "WALLET_WITHDRAWAL_FINISHED",
|
|
21
|
+
|
|
22
|
+
WALLET_FUNDS_RECEIVED = "WALLET_FUNDS_RECEIVED",
|
|
13
23
|
}
|
|
14
24
|
|
|
15
25
|
export default WebhookEventType;
|
|
@@ -24,6 +24,7 @@ class WithdrawalRequest implements Entity {
|
|
|
24
24
|
public readonly withdrawalMode: WithdrawalMode,
|
|
25
25
|
public readonly status: WithdrawalRequestStatus,
|
|
26
26
|
public readonly typename: string,
|
|
27
|
+
public readonly estimatedAmount?: CurrencyAmount,
|
|
27
28
|
public readonly completedAt?: string,
|
|
28
29
|
public readonly withdrawalId?: string
|
|
29
30
|
) {
|
|
@@ -193,6 +194,9 @@ export const WithdrawalRequestFromJson = (obj: any): WithdrawalRequest => {
|
|
|
193
194
|
WithdrawalRequestStatus[obj["withdrawal_request_status"]] ??
|
|
194
195
|
WithdrawalRequestStatus.FUTURE_VALUE,
|
|
195
196
|
"WithdrawalRequest",
|
|
197
|
+
!!obj["withdrawal_request_estimated_amount"]
|
|
198
|
+
? CurrencyAmountFromJson(obj["withdrawal_request_estimated_amount"])
|
|
199
|
+
: undefined,
|
|
196
200
|
obj["withdrawal_request_completed_at"],
|
|
197
201
|
obj["withdrawal_request_withdrawal"]?.id ?? undefined
|
|
198
202
|
);
|
|
@@ -212,6 +216,14 @@ fragment WithdrawalRequestFragment on WithdrawalRequest {
|
|
|
212
216
|
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
213
217
|
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
214
218
|
}
|
|
219
|
+
withdrawal_request_estimated_amount: estimated_amount {
|
|
220
|
+
__typename
|
|
221
|
+
currency_amount_original_value: original_value
|
|
222
|
+
currency_amount_original_unit: original_unit
|
|
223
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
224
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
225
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
226
|
+
}
|
|
215
227
|
withdrawal_request_bitcoin_address: bitcoin_address
|
|
216
228
|
withdrawal_request_withdrawal_mode: withdrawal_mode
|
|
217
229
|
withdrawal_request_status: status
|