@lightsparkdev/lightspark-sdk 1.1.2 → 1.1.4
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 +18 -0
- package/dist/{index-95299cb4.d.ts → index-2ac27fbd.d.ts} +8 -0
- package/dist/index.cjs +46 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -4
- package/dist/objects/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/client.ts +59 -1
- package/src/graphql/FundNode.ts +2 -2
- package/src/logger.ts +3 -0
- package/src/tests/integration/client.test.ts +112 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @lightsparkdev/lightspark-sdk
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1372f3a: Move transaction polling into new client method
|
|
8
|
+
- Updated dependencies [24782f5]
|
|
9
|
+
- @lightsparkdev/core@1.0.7
|
|
10
|
+
|
|
11
|
+
## 1.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- baeb7a1: [lightspark-sdk] Fix improper fundNode var ref and add tests
|
|
16
|
+
- Updated dependencies [ffcedbe]
|
|
17
|
+
- Updated dependencies [d9f6d5b]
|
|
18
|
+
- Updated dependencies [baeb7a1]
|
|
19
|
+
- @lightsparkdev/core@1.0.6
|
|
20
|
+
|
|
3
21
|
## 1.1.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1420,6 +1420,7 @@ declare class LightsparkClient {
|
|
|
1420
1420
|
* @returns An array of transactions for the given node ID.
|
|
1421
1421
|
*/
|
|
1422
1422
|
getRecentTransactions(nodeId: string, numTransactions?: number, bitcoinNetwork?: BitcoinNetwork, afterDate?: Maybe<string>): Promise<Transaction[]>;
|
|
1423
|
+
getTransaction(transactionId: string): Promise<Maybe<Transaction>>;
|
|
1423
1424
|
/**
|
|
1424
1425
|
* Retrieves the most recent payment requests for a given node.
|
|
1425
1426
|
*
|
|
@@ -1577,6 +1578,13 @@ declare class LightsparkClient {
|
|
|
1577
1578
|
* @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
|
|
1578
1579
|
*/
|
|
1579
1580
|
payUmaInvoice(payerNodeId: string, encodedInvoice: string, maximumFeesMsats: number, timeoutSecs?: number, amountMsats?: number | undefined): Promise<OutgoingPayment | undefined>;
|
|
1581
|
+
/**
|
|
1582
|
+
* Waits for a transaction to have a completed status, and returns the transaction.
|
|
1583
|
+
*
|
|
1584
|
+
* @param transactionId The ID of the transaction to wait for
|
|
1585
|
+
* @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
|
|
1586
|
+
*/
|
|
1587
|
+
waitForTransactionComplete(transactionId: string, pollTimeoutSecs?: number): Promise<Transaction>;
|
|
1580
1588
|
/**
|
|
1581
1589
|
* Sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
|
|
1582
1590
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -1938,7 +1938,7 @@ var import_core9 = require("@lightsparkdev/core");
|
|
|
1938
1938
|
// package.json
|
|
1939
1939
|
var package_default = {
|
|
1940
1940
|
name: "@lightsparkdev/lightspark-sdk",
|
|
1941
|
-
version: "1.1.
|
|
1941
|
+
version: "1.1.4",
|
|
1942
1942
|
description: "Lightspark JS SDK",
|
|
1943
1943
|
author: "Lightspark Inc.",
|
|
1944
1944
|
keywords: [
|
|
@@ -2026,7 +2026,7 @@ var package_default = {
|
|
|
2026
2026
|
},
|
|
2027
2027
|
license: "Apache-2.0",
|
|
2028
2028
|
dependencies: {
|
|
2029
|
-
"@lightsparkdev/core": "1.0.
|
|
2029
|
+
"@lightsparkdev/core": "1.0.7",
|
|
2030
2030
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
2031
2031
|
"auto-bind": "^5.0.1",
|
|
2032
2032
|
crypto: "^1.0.1",
|
|
@@ -4650,9 +4650,9 @@ var DeleteApiToken = `
|
|
|
4650
4650
|
var FundNode = `
|
|
4651
4651
|
mutation FundNode(
|
|
4652
4652
|
$node_id: ID!,
|
|
4653
|
-
$
|
|
4653
|
+
$amount_sats: Long
|
|
4654
4654
|
) {
|
|
4655
|
-
fund_node(input: { node_id: $node_id, amount_sats: $
|
|
4655
|
+
fund_node(input: { node_id: $node_id, amount_sats: $amount_sats }) {
|
|
4656
4656
|
amount {
|
|
4657
4657
|
...CurrencyAmountFragment
|
|
4658
4658
|
}
|
|
@@ -10595,6 +10595,11 @@ var LightsparkClient = class {
|
|
|
10595
10595
|
(transaction) => TransactionFromJson(transaction)
|
|
10596
10596
|
) ?? [];
|
|
10597
10597
|
}
|
|
10598
|
+
getTransaction(transactionId) {
|
|
10599
|
+
return this.requester.executeQuery(
|
|
10600
|
+
getTransactionQuery(transactionId)
|
|
10601
|
+
);
|
|
10602
|
+
}
|
|
10598
10603
|
/**
|
|
10599
10604
|
* Retrieves the most recent payment requests for a given node.
|
|
10600
10605
|
*
|
|
@@ -11036,6 +11041,43 @@ var LightsparkClient = class {
|
|
|
11036
11041
|
}
|
|
11037
11042
|
return response.pay_uma_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
|
|
11038
11043
|
}
|
|
11044
|
+
/**
|
|
11045
|
+
* Waits for a transaction to have a completed status, and returns the transaction.
|
|
11046
|
+
*
|
|
11047
|
+
* @param transactionId The ID of the transaction to wait for
|
|
11048
|
+
* @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
|
|
11049
|
+
*/
|
|
11050
|
+
async waitForTransactionComplete(transactionId, pollTimeoutSecs = 60) {
|
|
11051
|
+
const pollIntervalMs = 250;
|
|
11052
|
+
const pollMaxTimeouts = pollTimeoutSecs * 1e3 / pollIntervalMs;
|
|
11053
|
+
const pollIgnoreErrors = false;
|
|
11054
|
+
const transaction = await (0, import_core9.pollUntil)(
|
|
11055
|
+
() => {
|
|
11056
|
+
return this.getTransaction(transactionId);
|
|
11057
|
+
},
|
|
11058
|
+
(current, response) => {
|
|
11059
|
+
if (current && [
|
|
11060
|
+
TransactionStatus_default.SUCCESS,
|
|
11061
|
+
TransactionStatus_default.CANCELLED,
|
|
11062
|
+
TransactionStatus_default.FAILED
|
|
11063
|
+
].includes(current.status)) {
|
|
11064
|
+
return {
|
|
11065
|
+
stopPolling: true,
|
|
11066
|
+
value: current
|
|
11067
|
+
};
|
|
11068
|
+
}
|
|
11069
|
+
return response;
|
|
11070
|
+
},
|
|
11071
|
+
pollIntervalMs,
|
|
11072
|
+
pollMaxTimeouts,
|
|
11073
|
+
pollIgnoreErrors,
|
|
11074
|
+
() => new import_core9.LightsparkException(
|
|
11075
|
+
"Timeout",
|
|
11076
|
+
"Timeout waiting for transaction to complete."
|
|
11077
|
+
)
|
|
11078
|
+
);
|
|
11079
|
+
return transaction;
|
|
11080
|
+
}
|
|
11039
11081
|
/**
|
|
11040
11082
|
* Sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
|
|
11041
11083
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthProvider } from '@lightsparkdev/core';
|
|
2
|
-
import { W as WebhookEventType, L as LightsparkClient } from './index-
|
|
3
|
-
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BlockchainBalance, C as Channel, j as ChannelClosingTransaction, l as ChannelFees, m as ChannelOpeningTransaction, o as ChannelStatus, p as ChannelToTransactionsConnection, q as ComplianceProvider, r as Connection, s as CreateApiTokenInput, t as CreateApiTokenOutput, u as CreateInvoiceInput, v as CreateInvoiceOutput, w as CreateLnurlInvoiceInput, x as CreateNodeWalletAddressInput, y as CreateNodeWalletAddressOutput, z as CreateTestModeInvoiceInput, D as CreateTestModeInvoiceOutput, E as CreateTestModePaymentInput, F as CreateTestModePaymentoutput, G as CreateUmaInvoiceInput, H as CurrencyAmount, I as CurrencyUnit, J as DeclineToSignMessagesInput, K as DeclineToSignMessagesOutput, M as DeleteApiTokenInput, N as DeleteApiTokenOutput, O as Deposit, Q as Entity, R as FeeEstimate, S as FundNodeInput, T as FundNodeOutput, U as GraphNode, V as Hop, Y as HtlcAttemptFailureCode, Z as IdAndSignature, _ as IncomingPayment, $ as IncomingPaymentAttempt, a1 as IncomingPaymentAttemptStatus, a2 as IncomingPaymentToAttemptsConnection, a3 as Invoice, a5 as InvoiceData, a6 as InvoiceType, a7 as LightningFeeEstimateForInvoiceInput, a8 as LightningFeeEstimateForNodeInput, a9 as LightningFeeEstimateOutput, aa as LightningTransaction, ac as LightsparkNode, ad as LightsparkNodeOwner, af as LightsparkNodeStatus, ag as LightsparkNodeToChannelsConnection, ah as LightsparkNodeWithOSK, ai as LightsparkNodeWithRemoteSigning, aj as Node, ak as NodeAddress, al as NodeAddressType, am as NodeToAddressesConnection, an as OnChainTransaction, ap as OutgoingPayment, aq as OutgoingPaymentAttempt, ar as OutgoingPaymentAttemptStatus, as as OutgoingPaymentAttemptToHopsConnection, av as OutgoingPaymentToAttemptsConnection, at as OutgoingPaymentsForInvoiceQueryInput, au as OutgoingPaymentsForInvoiceQueryOutput, aw as PageInfo, ax as PayInvoiceInput, ay as PayInvoiceOutput, aF as PayUmaInvoiceInput, az as PaymentDirection, aA as PaymentFailureReason, aB as PaymentRequest, aD as PaymentRequestData, aE as PaymentRequestStatus, aG as Permission, aH as PostTransactionData, aI as RegisterPaymentInput, aJ as RegisterPaymentOutput, aK as ReleaseChannelPerCommitmentSecretInput, aL as ReleaseChannelPerCommitmentSecretOutput, aM as ReleasePaymentPreimageInput, aN as ReleasePaymentPreimageOutput, aO as RemoteSigningSubEventType, aP as RequestWithdrawalInput, aQ as RequestWithdrawalOutput, aR as RichText, aS as RiskRating, aT as RoutingTransaction, aV as RoutingTransactionFailureReason, aW as ScreenNodeInput, aX as ScreenNodeOutput, aY as Secret, aZ as SendPaymentInput, a_ as SendPaymentOutput, a$ as SetInvoicePaymentHashInput, b0 as SetInvoicePaymentHashOutput, b6 as SignInvoiceInput, b7 as SignInvoiceOutput, b8 as SignMessagesInput, b9 as SignMessagesOutput, b1 as Signable, b3 as SignablePayload, b5 as SignablePayloadStatus, ba as SingleNodeDashboard, bb as Transaction, bd as TransactionFailures, be as TransactionStatus, bf as TransactionType, bg as TransactionUpdate, bh as UpdateChannelPerCommitmentPointInput, bi as UpdateChannelPerCommitmentPointOutput, bj as UpdateNodeSharedSecretInput, bk as UpdateNodeSharedSecretOutput, bl as Wallet, bm as WalletStatus, bn as WalletToPaymentRequestsConnection, bo as WalletToTransactionsConnection, bp as Withdrawal, br as WithdrawalMode, bs as WithdrawalRequest, bt as WithdrawalRequestStatus, bu as WithdrawalRequestToChannelClosingTransactionsConnection, bv as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, P as getDepositQuery, X as getHopQuery, a0 as getIncomingPaymentAttemptQuery, a4 as getInvoiceQuery, ab as getLightningTransactionQuery, ae as getLightsparkNodeOwnerQuery, ao as getOnChainTransactionQuery, aC as getPaymentRequestQuery, aU as getRoutingTransactionQuery, b4 as getSignablePayloadQuery, b2 as getSignableQuery, bc as getTransactionQuery, bq as getWithdrawalQuery } from './index-
|
|
2
|
+
import { W as WebhookEventType, L as LightsparkClient } from './index-2ac27fbd.js';
|
|
3
|
+
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BlockchainBalance, C as Channel, j as ChannelClosingTransaction, l as ChannelFees, m as ChannelOpeningTransaction, o as ChannelStatus, p as ChannelToTransactionsConnection, q as ComplianceProvider, r as Connection, s as CreateApiTokenInput, t as CreateApiTokenOutput, u as CreateInvoiceInput, v as CreateInvoiceOutput, w as CreateLnurlInvoiceInput, x as CreateNodeWalletAddressInput, y as CreateNodeWalletAddressOutput, z as CreateTestModeInvoiceInput, D as CreateTestModeInvoiceOutput, E as CreateTestModePaymentInput, F as CreateTestModePaymentoutput, G as CreateUmaInvoiceInput, H as CurrencyAmount, I as CurrencyUnit, J as DeclineToSignMessagesInput, K as DeclineToSignMessagesOutput, M as DeleteApiTokenInput, N as DeleteApiTokenOutput, O as Deposit, Q as Entity, R as FeeEstimate, S as FundNodeInput, T as FundNodeOutput, U as GraphNode, V as Hop, Y as HtlcAttemptFailureCode, Z as IdAndSignature, _ as IncomingPayment, $ as IncomingPaymentAttempt, a1 as IncomingPaymentAttemptStatus, a2 as IncomingPaymentToAttemptsConnection, a3 as Invoice, a5 as InvoiceData, a6 as InvoiceType, a7 as LightningFeeEstimateForInvoiceInput, a8 as LightningFeeEstimateForNodeInput, a9 as LightningFeeEstimateOutput, aa as LightningTransaction, ac as LightsparkNode, ad as LightsparkNodeOwner, af as LightsparkNodeStatus, ag as LightsparkNodeToChannelsConnection, ah as LightsparkNodeWithOSK, ai as LightsparkNodeWithRemoteSigning, aj as Node, ak as NodeAddress, al as NodeAddressType, am as NodeToAddressesConnection, an as OnChainTransaction, ap as OutgoingPayment, aq as OutgoingPaymentAttempt, ar as OutgoingPaymentAttemptStatus, as as OutgoingPaymentAttemptToHopsConnection, av as OutgoingPaymentToAttemptsConnection, at as OutgoingPaymentsForInvoiceQueryInput, au as OutgoingPaymentsForInvoiceQueryOutput, aw as PageInfo, ax as PayInvoiceInput, ay as PayInvoiceOutput, aF as PayUmaInvoiceInput, az as PaymentDirection, aA as PaymentFailureReason, aB as PaymentRequest, aD as PaymentRequestData, aE as PaymentRequestStatus, aG as Permission, aH as PostTransactionData, aI as RegisterPaymentInput, aJ as RegisterPaymentOutput, aK as ReleaseChannelPerCommitmentSecretInput, aL as ReleaseChannelPerCommitmentSecretOutput, aM as ReleasePaymentPreimageInput, aN as ReleasePaymentPreimageOutput, aO as RemoteSigningSubEventType, aP as RequestWithdrawalInput, aQ as RequestWithdrawalOutput, aR as RichText, aS as RiskRating, aT as RoutingTransaction, aV as RoutingTransactionFailureReason, aW as ScreenNodeInput, aX as ScreenNodeOutput, aY as Secret, aZ as SendPaymentInput, a_ as SendPaymentOutput, a$ as SetInvoicePaymentHashInput, b0 as SetInvoicePaymentHashOutput, b6 as SignInvoiceInput, b7 as SignInvoiceOutput, b8 as SignMessagesInput, b9 as SignMessagesOutput, b1 as Signable, b3 as SignablePayload, b5 as SignablePayloadStatus, ba as SingleNodeDashboard, bb as Transaction, bd as TransactionFailures, be as TransactionStatus, bf as TransactionType, bg as TransactionUpdate, bh as UpdateChannelPerCommitmentPointInput, bi as UpdateChannelPerCommitmentPointOutput, bj as UpdateNodeSharedSecretInput, bk as UpdateNodeSharedSecretOutput, bl as Wallet, bm as WalletStatus, bn as WalletToPaymentRequestsConnection, bo as WalletToTransactionsConnection, bp as Withdrawal, br as WithdrawalMode, bs as WithdrawalRequest, bt as WithdrawalRequestStatus, bu as WithdrawalRequestToChannelClosingTransactionsConnection, bv as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, P as getDepositQuery, X as getHopQuery, a0 as getIncomingPaymentAttemptQuery, a4 as getInvoiceQuery, ab as getLightningTransactionQuery, ae as getLightsparkNodeOwnerQuery, ao as getOnChainTransactionQuery, aC as getPaymentRequestQuery, aU as getRoutingTransactionQuery, b4 as getSignablePayloadQuery, b2 as getSignableQuery, bc as getTransactionQuery, bq as getWithdrawalQuery } from './index-2ac27fbd.js';
|
|
4
4
|
import { B as BitcoinNetwork } from './BitcoinNetwork-a816c0be.js';
|
|
5
5
|
import 'zen-observable';
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -125,6 +125,7 @@ import {
|
|
|
125
125
|
LightsparkException,
|
|
126
126
|
LightsparkSigningException as LightsparkSigningException3,
|
|
127
127
|
NodeKeyCache,
|
|
128
|
+
pollUntil,
|
|
128
129
|
Requester,
|
|
129
130
|
SigningKeyType as SigningKeyType2,
|
|
130
131
|
StubAuthProvider
|
|
@@ -133,7 +134,7 @@ import {
|
|
|
133
134
|
// package.json
|
|
134
135
|
var package_default = {
|
|
135
136
|
name: "@lightsparkdev/lightspark-sdk",
|
|
136
|
-
version: "1.1.
|
|
137
|
+
version: "1.1.4",
|
|
137
138
|
description: "Lightspark JS SDK",
|
|
138
139
|
author: "Lightspark Inc.",
|
|
139
140
|
keywords: [
|
|
@@ -221,7 +222,7 @@ var package_default = {
|
|
|
221
222
|
},
|
|
222
223
|
license: "Apache-2.0",
|
|
223
224
|
dependencies: {
|
|
224
|
-
"@lightsparkdev/core": "1.0.
|
|
225
|
+
"@lightsparkdev/core": "1.0.7",
|
|
225
226
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
226
227
|
"auto-bind": "^5.0.1",
|
|
227
228
|
crypto: "^1.0.1",
|
|
@@ -432,9 +433,9 @@ var DeleteApiToken = `
|
|
|
432
433
|
var FundNode = `
|
|
433
434
|
mutation FundNode(
|
|
434
435
|
$node_id: ID!,
|
|
435
|
-
$
|
|
436
|
+
$amount_sats: Long
|
|
436
437
|
) {
|
|
437
|
-
fund_node(input: { node_id: $node_id, amount_sats: $
|
|
438
|
+
fund_node(input: { node_id: $node_id, amount_sats: $amount_sats }) {
|
|
438
439
|
amount {
|
|
439
440
|
...CurrencyAmountFragment
|
|
440
441
|
}
|
|
@@ -1149,6 +1150,11 @@ var LightsparkClient = class {
|
|
|
1149
1150
|
(transaction) => TransactionFromJson(transaction)
|
|
1150
1151
|
) ?? [];
|
|
1151
1152
|
}
|
|
1153
|
+
getTransaction(transactionId) {
|
|
1154
|
+
return this.requester.executeQuery(
|
|
1155
|
+
getTransactionQuery(transactionId)
|
|
1156
|
+
);
|
|
1157
|
+
}
|
|
1152
1158
|
/**
|
|
1153
1159
|
* Retrieves the most recent payment requests for a given node.
|
|
1154
1160
|
*
|
|
@@ -1590,6 +1596,43 @@ var LightsparkClient = class {
|
|
|
1590
1596
|
}
|
|
1591
1597
|
return response.pay_uma_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
|
|
1592
1598
|
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Waits for a transaction to have a completed status, and returns the transaction.
|
|
1601
|
+
*
|
|
1602
|
+
* @param transactionId The ID of the transaction to wait for
|
|
1603
|
+
* @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
|
|
1604
|
+
*/
|
|
1605
|
+
async waitForTransactionComplete(transactionId, pollTimeoutSecs = 60) {
|
|
1606
|
+
const pollIntervalMs = 250;
|
|
1607
|
+
const pollMaxTimeouts = pollTimeoutSecs * 1e3 / pollIntervalMs;
|
|
1608
|
+
const pollIgnoreErrors = false;
|
|
1609
|
+
const transaction = await pollUntil(
|
|
1610
|
+
() => {
|
|
1611
|
+
return this.getTransaction(transactionId);
|
|
1612
|
+
},
|
|
1613
|
+
(current, response) => {
|
|
1614
|
+
if (current && [
|
|
1615
|
+
TransactionStatus_default.SUCCESS,
|
|
1616
|
+
TransactionStatus_default.CANCELLED,
|
|
1617
|
+
TransactionStatus_default.FAILED
|
|
1618
|
+
].includes(current.status)) {
|
|
1619
|
+
return {
|
|
1620
|
+
stopPolling: true,
|
|
1621
|
+
value: current
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
return response;
|
|
1625
|
+
},
|
|
1626
|
+
pollIntervalMs,
|
|
1627
|
+
pollMaxTimeouts,
|
|
1628
|
+
pollIgnoreErrors,
|
|
1629
|
+
() => new LightsparkException(
|
|
1630
|
+
"Timeout",
|
|
1631
|
+
"Timeout waiting for transaction to complete."
|
|
1632
|
+
)
|
|
1633
|
+
);
|
|
1634
|
+
return transaction;
|
|
1635
|
+
}
|
|
1593
1636
|
/**
|
|
1594
1637
|
* Sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
|
|
1595
1638
|
*
|
package/dist/objects/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BlockchainBalance, C as Channel, j as ChannelClosingTransaction, l as ChannelFees, m as ChannelOpeningTransaction, o as ChannelStatus, p as ChannelToTransactionsConnection, q as ComplianceProvider, r as Connection, s as CreateApiTokenInput, t as CreateApiTokenOutput, u as CreateInvoiceInput, v as CreateInvoiceOutput, w as CreateLnurlInvoiceInput, x as CreateNodeWalletAddressInput, y as CreateNodeWalletAddressOutput, z as CreateTestModeInvoiceInput, D as CreateTestModeInvoiceOutput, E as CreateTestModePaymentInput, F as CreateTestModePaymentoutput, G as CreateUmaInvoiceInput, H as CurrencyAmount, I as CurrencyUnit, J as DeclineToSignMessagesInput, K as DeclineToSignMessagesOutput, M as DeleteApiTokenInput, N as DeleteApiTokenOutput, O as Deposit, Q as Entity, R as FeeEstimate, S as FundNodeInput, T as FundNodeOutput, U as GraphNode, V as Hop, Y as HtlcAttemptFailureCode, Z as IdAndSignature, _ as IncomingPayment, $ as IncomingPaymentAttempt, a1 as IncomingPaymentAttemptStatus, a2 as IncomingPaymentToAttemptsConnection, a3 as Invoice, a5 as InvoiceData, a6 as InvoiceType, a7 as LightningFeeEstimateForInvoiceInput, a8 as LightningFeeEstimateForNodeInput, a9 as LightningFeeEstimateOutput, aa as LightningTransaction, ac as LightsparkNode, ad as LightsparkNodeOwner, af as LightsparkNodeStatus, ag as LightsparkNodeToChannelsConnection, ah as LightsparkNodeWithOSK, ai as LightsparkNodeWithRemoteSigning, aj as Node, ak as NodeAddress, al as NodeAddressType, am as NodeToAddressesConnection, an as OnChainTransaction, ap as OutgoingPayment, aq as OutgoingPaymentAttempt, ar as OutgoingPaymentAttemptStatus, as as OutgoingPaymentAttemptToHopsConnection, av as OutgoingPaymentToAttemptsConnection, at as OutgoingPaymentsForInvoiceQueryInput, au as OutgoingPaymentsForInvoiceQueryOutput, aw as PageInfo, ax as PayInvoiceInput, ay as PayInvoiceOutput, aF as PayUmaInvoiceInput, az as PaymentDirection, aA as PaymentFailureReason, aB as PaymentRequest, aD as PaymentRequestData, aE as PaymentRequestStatus, aG as Permission, aH as PostTransactionData, aI as RegisterPaymentInput, aJ as RegisterPaymentOutput, aK as ReleaseChannelPerCommitmentSecretInput, aL as ReleaseChannelPerCommitmentSecretOutput, aM as ReleasePaymentPreimageInput, aN as ReleasePaymentPreimageOutput, aO as RemoteSigningSubEventType, aP as RequestWithdrawalInput, aQ as RequestWithdrawalOutput, aR as RichText, aS as RiskRating, aT as RoutingTransaction, aV as RoutingTransactionFailureReason, aW as ScreenNodeInput, aX as ScreenNodeOutput, aY as Secret, aZ as SendPaymentInput, a_ as SendPaymentOutput, a$ as SetInvoicePaymentHashInput, b0 as SetInvoicePaymentHashOutput, b6 as SignInvoiceInput, b7 as SignInvoiceOutput, b8 as SignMessagesInput, b9 as SignMessagesOutput, b1 as Signable, b3 as SignablePayload, b5 as SignablePayloadStatus, ba as SingleNodeDashboard, bb as Transaction, bd as TransactionFailures, be as TransactionStatus, bf as TransactionType, bg as TransactionUpdate, bh as UpdateChannelPerCommitmentPointInput, bi as UpdateChannelPerCommitmentPointOutput, bj as UpdateNodeSharedSecretInput, bk as UpdateNodeSharedSecretOutput, bl as Wallet, bm as WalletStatus, bn as WalletToPaymentRequestsConnection, bo as WalletToTransactionsConnection, W as WebhookEventType, bp as Withdrawal, br as WithdrawalMode, bs as WithdrawalRequest, bt as WithdrawalRequestStatus, bu as WithdrawalRequestToChannelClosingTransactionsConnection, bv as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, P as getDepositQuery, X as getHopQuery, a0 as getIncomingPaymentAttemptQuery, a4 as getInvoiceQuery, ab as getLightningTransactionQuery, ae as getLightsparkNodeOwnerQuery, ao as getOnChainTransactionQuery, aC as getPaymentRequestQuery, aU as getRoutingTransactionQuery, b4 as getSignablePayloadQuery, b2 as getSignableQuery, bc as getTransactionQuery, bq as getWithdrawalQuery } from '../index-
|
|
1
|
+
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BlockchainBalance, C as Channel, j as ChannelClosingTransaction, l as ChannelFees, m as ChannelOpeningTransaction, o as ChannelStatus, p as ChannelToTransactionsConnection, q as ComplianceProvider, r as Connection, s as CreateApiTokenInput, t as CreateApiTokenOutput, u as CreateInvoiceInput, v as CreateInvoiceOutput, w as CreateLnurlInvoiceInput, x as CreateNodeWalletAddressInput, y as CreateNodeWalletAddressOutput, z as CreateTestModeInvoiceInput, D as CreateTestModeInvoiceOutput, E as CreateTestModePaymentInput, F as CreateTestModePaymentoutput, G as CreateUmaInvoiceInput, H as CurrencyAmount, I as CurrencyUnit, J as DeclineToSignMessagesInput, K as DeclineToSignMessagesOutput, M as DeleteApiTokenInput, N as DeleteApiTokenOutput, O as Deposit, Q as Entity, R as FeeEstimate, S as FundNodeInput, T as FundNodeOutput, U as GraphNode, V as Hop, Y as HtlcAttemptFailureCode, Z as IdAndSignature, _ as IncomingPayment, $ as IncomingPaymentAttempt, a1 as IncomingPaymentAttemptStatus, a2 as IncomingPaymentToAttemptsConnection, a3 as Invoice, a5 as InvoiceData, a6 as InvoiceType, a7 as LightningFeeEstimateForInvoiceInput, a8 as LightningFeeEstimateForNodeInput, a9 as LightningFeeEstimateOutput, aa as LightningTransaction, ac as LightsparkNode, ad as LightsparkNodeOwner, af as LightsparkNodeStatus, ag as LightsparkNodeToChannelsConnection, ah as LightsparkNodeWithOSK, ai as LightsparkNodeWithRemoteSigning, aj as Node, ak as NodeAddress, al as NodeAddressType, am as NodeToAddressesConnection, an as OnChainTransaction, ap as OutgoingPayment, aq as OutgoingPaymentAttempt, ar as OutgoingPaymentAttemptStatus, as as OutgoingPaymentAttemptToHopsConnection, av as OutgoingPaymentToAttemptsConnection, at as OutgoingPaymentsForInvoiceQueryInput, au as OutgoingPaymentsForInvoiceQueryOutput, aw as PageInfo, ax as PayInvoiceInput, ay as PayInvoiceOutput, aF as PayUmaInvoiceInput, az as PaymentDirection, aA as PaymentFailureReason, aB as PaymentRequest, aD as PaymentRequestData, aE as PaymentRequestStatus, aG as Permission, aH as PostTransactionData, aI as RegisterPaymentInput, aJ as RegisterPaymentOutput, aK as ReleaseChannelPerCommitmentSecretInput, aL as ReleaseChannelPerCommitmentSecretOutput, aM as ReleasePaymentPreimageInput, aN as ReleasePaymentPreimageOutput, aO as RemoteSigningSubEventType, aP as RequestWithdrawalInput, aQ as RequestWithdrawalOutput, aR as RichText, aS as RiskRating, aT as RoutingTransaction, aV as RoutingTransactionFailureReason, aW as ScreenNodeInput, aX as ScreenNodeOutput, aY as Secret, aZ as SendPaymentInput, a_ as SendPaymentOutput, a$ as SetInvoicePaymentHashInput, b0 as SetInvoicePaymentHashOutput, b6 as SignInvoiceInput, b7 as SignInvoiceOutput, b8 as SignMessagesInput, b9 as SignMessagesOutput, b1 as Signable, b3 as SignablePayload, b5 as SignablePayloadStatus, ba as SingleNodeDashboard, bb as Transaction, bd as TransactionFailures, be as TransactionStatus, bf as TransactionType, bg as TransactionUpdate, bh as UpdateChannelPerCommitmentPointInput, bi as UpdateChannelPerCommitmentPointOutput, bj as UpdateNodeSharedSecretInput, bk as UpdateNodeSharedSecretOutput, bl as Wallet, bm as WalletStatus, bn as WalletToPaymentRequestsConnection, bo as WalletToTransactionsConnection, W as WebhookEventType, bp as Withdrawal, br as WithdrawalMode, bs as WithdrawalRequest, bt as WithdrawalRequestStatus, bu as WithdrawalRequestToChannelClosingTransactionsConnection, bv as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, P as getDepositQuery, X as getHopQuery, a0 as getIncomingPaymentAttemptQuery, a4 as getInvoiceQuery, ab as getLightningTransactionQuery, ae as getLightsparkNodeOwnerQuery, ao as getOnChainTransactionQuery, aC as getPaymentRequestQuery, aU as getRoutingTransactionQuery, b4 as getSignablePayloadQuery, b2 as getSignableQuery, bc as getTransactionQuery, bq as getWithdrawalQuery } from '../index-2ac27fbd.js';
|
|
2
2
|
export { B as BitcoinNetwork } from '../BitcoinNetwork-a816c0be.js';
|
|
3
3
|
import '@lightsparkdev/core';
|
|
4
4
|
import 'zen-observable';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"license": "Apache-2.0",
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@lightsparkdev/core": "1.0.
|
|
91
|
+
"@lightsparkdev/core": "1.0.7",
|
|
92
92
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
93
93
|
"auto-bind": "^5.0.1",
|
|
94
94
|
"crypto": "^1.0.1",
|
package/src/client.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
LightsparkException,
|
|
19
19
|
LightsparkSigningException,
|
|
20
20
|
NodeKeyCache,
|
|
21
|
+
pollUntil,
|
|
21
22
|
Requester,
|
|
22
23
|
SigningKeyType,
|
|
23
24
|
StubAuthProvider,
|
|
@@ -46,6 +47,7 @@ import { SendPayment } from "./graphql/SendPayment.js";
|
|
|
46
47
|
import { SingleNodeDashboard as SingleNodeDashboardQuery } from "./graphql/SingleNodeDashboard.js";
|
|
47
48
|
import { TransactionsForNode } from "./graphql/TransactionsForNode.js";
|
|
48
49
|
import { TransactionSubscription } from "./graphql/TransactionSubscription.js";
|
|
50
|
+
import { TransactionStatus } from "./index.js";
|
|
49
51
|
import NodeKeyLoaderCache from "./NodeKeyLoaderCache.js";
|
|
50
52
|
import Account from "./objects/Account.js";
|
|
51
53
|
import { ApiTokenFromJson } from "./objects/ApiToken.js";
|
|
@@ -68,7 +70,10 @@ import { PaymentRequestFromJson } from "./objects/PaymentRequest.js";
|
|
|
68
70
|
import Permission from "./objects/Permission.js";
|
|
69
71
|
import type SingleNodeDashboard from "./objects/SingleNodeDashboard.js";
|
|
70
72
|
import type Transaction from "./objects/Transaction.js";
|
|
71
|
-
import {
|
|
73
|
+
import {
|
|
74
|
+
getTransactionQuery,
|
|
75
|
+
TransactionFromJson,
|
|
76
|
+
} from "./objects/Transaction.js";
|
|
72
77
|
import type TransactionUpdate from "./objects/TransactionUpdate.js";
|
|
73
78
|
import { TransactionUpdateFromJson } from "./objects/TransactionUpdate.js";
|
|
74
79
|
import type WithdrawalMode from "./objects/WithdrawalMode.js";
|
|
@@ -230,6 +235,12 @@ class LightsparkClient {
|
|
|
230
235
|
);
|
|
231
236
|
}
|
|
232
237
|
|
|
238
|
+
public getTransaction(transactionId: string): Promise<Maybe<Transaction>> {
|
|
239
|
+
return this.requester.executeQuery<Transaction>(
|
|
240
|
+
getTransactionQuery(transactionId),
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
233
244
|
/**
|
|
234
245
|
* Retrieves the most recent payment requests for a given node.
|
|
235
246
|
*
|
|
@@ -780,6 +791,53 @@ class LightsparkClient {
|
|
|
780
791
|
);
|
|
781
792
|
}
|
|
782
793
|
|
|
794
|
+
/**
|
|
795
|
+
* Waits for a transaction to have a completed status, and returns the transaction.
|
|
796
|
+
*
|
|
797
|
+
* @param transactionId The ID of the transaction to wait for
|
|
798
|
+
* @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
|
|
799
|
+
*/
|
|
800
|
+
public async waitForTransactionComplete(
|
|
801
|
+
transactionId: string,
|
|
802
|
+
pollTimeoutSecs = 60,
|
|
803
|
+
) {
|
|
804
|
+
const pollIntervalMs = 250;
|
|
805
|
+
const pollMaxTimeouts = (pollTimeoutSecs * 1000) / pollIntervalMs;
|
|
806
|
+
const pollIgnoreErrors = false;
|
|
807
|
+
|
|
808
|
+
const transaction = (await pollUntil(
|
|
809
|
+
() => {
|
|
810
|
+
return this.getTransaction(transactionId);
|
|
811
|
+
},
|
|
812
|
+
(current, response) => {
|
|
813
|
+
if (
|
|
814
|
+
current &&
|
|
815
|
+
[
|
|
816
|
+
TransactionStatus.SUCCESS,
|
|
817
|
+
TransactionStatus.CANCELLED,
|
|
818
|
+
TransactionStatus.FAILED,
|
|
819
|
+
].includes(current.status)
|
|
820
|
+
) {
|
|
821
|
+
return {
|
|
822
|
+
stopPolling: true,
|
|
823
|
+
value: current,
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
return response;
|
|
827
|
+
},
|
|
828
|
+
pollIntervalMs,
|
|
829
|
+
pollMaxTimeouts,
|
|
830
|
+
pollIgnoreErrors,
|
|
831
|
+
() =>
|
|
832
|
+
new LightsparkException(
|
|
833
|
+
"Timeout",
|
|
834
|
+
"Timeout waiting for transaction to complete.",
|
|
835
|
+
),
|
|
836
|
+
)) as Transaction;
|
|
837
|
+
|
|
838
|
+
return transaction;
|
|
839
|
+
}
|
|
840
|
+
|
|
783
841
|
/**
|
|
784
842
|
* Sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
|
|
785
843
|
*
|
package/src/graphql/FundNode.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js
|
|
|
5
5
|
export const FundNode = `
|
|
6
6
|
mutation FundNode(
|
|
7
7
|
$node_id: ID!,
|
|
8
|
-
$
|
|
8
|
+
$amount_sats: Long
|
|
9
9
|
) {
|
|
10
|
-
fund_node(input: { node_id: $node_id, amount_sats: $
|
|
10
|
+
fund_node(input: { node_id: $node_id, amount_sats: $amount_sats }) {
|
|
11
11
|
amount {
|
|
12
12
|
...CurrencyAmountFragment
|
|
13
13
|
}
|
package/src/logger.ts
ADDED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
import { pollUntil } from "@lightsparkdev/core";
|
|
1
2
|
import LightsparkClient from "../../client.js";
|
|
2
3
|
import { getCredentialsFromEnvOrThrow } from "../../env.js";
|
|
3
4
|
import {
|
|
4
5
|
AccountTokenAuthProvider,
|
|
5
6
|
BitcoinNetwork,
|
|
6
7
|
PaymentRequestStatus,
|
|
8
|
+
TransactionStatus,
|
|
7
9
|
} from "../../index.js";
|
|
10
|
+
import { logger } from "../../logger.js";
|
|
11
|
+
|
|
12
|
+
const REGTEST_SIGNING_KEY_PASSWORD = "1234!@#$";
|
|
13
|
+
const pollIntervalMs = 250;
|
|
14
|
+
const pollTimeoutSecs = 20;
|
|
15
|
+
const pollMaxTimeouts = (pollTimeoutSecs * 1000) / pollIntervalMs;
|
|
16
|
+
const pollIgnoreErrors = false;
|
|
17
|
+
|
|
18
|
+
const suiteName = "lightspark-sdk client";
|
|
19
|
+
|
|
20
|
+
function log(msg: string, ...args: unknown[]) {
|
|
21
|
+
logger.info(
|
|
22
|
+
`${expect
|
|
23
|
+
.getState()
|
|
24
|
+
.currentTestName?.replace(
|
|
25
|
+
new RegExp(`^(${suiteName})\\s`, "g"),
|
|
26
|
+
"",
|
|
27
|
+
)}: ${msg}`,
|
|
28
|
+
...args,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
8
31
|
|
|
9
32
|
describe("lightspark-sdk client", () => {
|
|
10
33
|
const { apiTokenClientId, apiTokenClientSecret, baseUrl } =
|
|
@@ -23,12 +46,12 @@ describe("lightspark-sdk client", () => {
|
|
|
23
46
|
return regtestNodeId as string;
|
|
24
47
|
}
|
|
25
48
|
|
|
26
|
-
it("
|
|
49
|
+
it("Should get env vars and construct the client successfully", async () => {
|
|
27
50
|
const lightsparkClient = new LightsparkClient(accountAuthProvider, baseUrl);
|
|
28
51
|
expect(lightsparkClient).toBeDefined();
|
|
29
52
|
});
|
|
30
53
|
|
|
31
|
-
it("
|
|
54
|
+
it("Should successfully get the current account regtest node", async () => {
|
|
32
55
|
const lightsparkClient = new LightsparkClient(accountAuthProvider, baseUrl);
|
|
33
56
|
|
|
34
57
|
const account = await lightsparkClient.getCurrentAccount();
|
|
@@ -38,10 +61,11 @@ describe("lightspark-sdk client", () => {
|
|
|
38
61
|
|
|
39
62
|
const regtestNode = nodesConnection?.entities[0];
|
|
40
63
|
expect(regtestNode).toBeDefined();
|
|
64
|
+
log("regtestNodeId", regtestNode?.id);
|
|
41
65
|
regtestNodeId = regtestNode?.id;
|
|
42
66
|
});
|
|
43
67
|
|
|
44
|
-
it("
|
|
68
|
+
it("Should successfully create an uma invoice", async () => {
|
|
45
69
|
const nodeId = getRegtestNodeId();
|
|
46
70
|
const lightsparkClient = new LightsparkClient(accountAuthProvider, baseUrl);
|
|
47
71
|
|
|
@@ -56,5 +80,89 @@ describe("lightspark-sdk client", () => {
|
|
|
56
80
|
metadata,
|
|
57
81
|
);
|
|
58
82
|
expect(umaInvoice?.status).toEqual(PaymentRequestStatus.OPEN);
|
|
59
|
-
});
|
|
83
|
+
}, 10000);
|
|
84
|
+
|
|
85
|
+
const satsToFund = 50_000;
|
|
86
|
+
test("Should deposit funds to wallet with a defined amount of sats", async () => {
|
|
87
|
+
const lightsparkClient = new LightsparkClient(accountAuthProvider, baseUrl);
|
|
88
|
+
const account = await lightsparkClient.getCurrentAccount();
|
|
89
|
+
|
|
90
|
+
if (!account) {
|
|
91
|
+
throw new Error("No account");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const nodesConnection = await account?.getNodes(lightsparkClient, 1, [
|
|
95
|
+
BitcoinNetwork.REGTEST,
|
|
96
|
+
]);
|
|
97
|
+
let regtestNode = nodesConnection?.entities[0];
|
|
98
|
+
const initialLocalBalance = regtestNode?.localBalance?.originalValue;
|
|
99
|
+
const nodeId = getRegtestNodeId();
|
|
100
|
+
|
|
101
|
+
await lightsparkClient.fundNode(nodeId, satsToFund);
|
|
102
|
+
|
|
103
|
+
regtestNode = await pollUntil(
|
|
104
|
+
() => {
|
|
105
|
+
return account?.getNodes(lightsparkClient, 1, [BitcoinNetwork.REGTEST]);
|
|
106
|
+
},
|
|
107
|
+
(current, response) => {
|
|
108
|
+
if (
|
|
109
|
+
current &&
|
|
110
|
+
current.entities[0]?.localBalance?.originalValue !==
|
|
111
|
+
initialLocalBalance
|
|
112
|
+
) {
|
|
113
|
+
return {
|
|
114
|
+
stopPolling: true,
|
|
115
|
+
value: current.entities[0],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return response;
|
|
119
|
+
},
|
|
120
|
+
pollIntervalMs,
|
|
121
|
+
pollMaxTimeouts,
|
|
122
|
+
pollIgnoreErrors,
|
|
123
|
+
() => new Error("Timeout waiting for payment to be received"),
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
expect(
|
|
127
|
+
regtestNode.localBalance?.originalValue !== initialLocalBalance,
|
|
128
|
+
).toBe(true);
|
|
129
|
+
}, 120_000);
|
|
130
|
+
|
|
131
|
+
test("Should send test mode payment", async () => {
|
|
132
|
+
const lightsparkClient = new LightsparkClient(accountAuthProvider, baseUrl);
|
|
133
|
+
const account = await lightsparkClient.getCurrentAccount();
|
|
134
|
+
|
|
135
|
+
if (!account) {
|
|
136
|
+
throw new Error("No account");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const nodeId = getRegtestNodeId();
|
|
140
|
+
|
|
141
|
+
const invoice = await lightsparkClient.createTestModeInvoice(
|
|
142
|
+
nodeId,
|
|
143
|
+
satsToFund * 1000, // convert to msats
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
await lightsparkClient.loadNodeSigningKey(nodeId, {
|
|
147
|
+
password: REGTEST_SIGNING_KEY_PASSWORD,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
if (!invoice) {
|
|
151
|
+
throw new Error("No invoice");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const payment = await lightsparkClient.payInvoice(nodeId, invoice, 60);
|
|
155
|
+
log("payment.id", payment?.id);
|
|
156
|
+
|
|
157
|
+
if (!payment) {
|
|
158
|
+
throw new Error("No payment");
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const transaction = await lightsparkClient.waitForTransactionComplete(
|
|
162
|
+
payment.id,
|
|
163
|
+
pollTimeoutSecs,
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
expect(transaction.status).toEqual(TransactionStatus.SUCCESS);
|
|
167
|
+
}, 30_000);
|
|
60
168
|
});
|