@lightsparkdev/lightspark-sdk 1.2.2 → 1.3.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 +21 -0
- package/dist/{BitcoinNetwork-a816c0be.d.ts → BitcoinNetwork-972b1d01.d.ts} +4 -1
- package/dist/{chunk-GLL4KTUT.js → chunk-Y55D3PD4.js} +11 -11
- package/dist/env.d.cts +1 -1
- package/dist/env.d.ts +1 -1
- package/dist/{index-eb604025.d.ts → index-a5028d74.d.ts} +866 -451
- package/dist/index.cjs +622 -557
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +363 -298
- package/dist/objects/index.d.cts +2 -2
- package/dist/objects/index.d.ts +2 -2
- package/dist/objects/index.js +1 -1
- package/package.json +4 -4
- package/src/NodeKeyLoaderCache.ts +4 -3
- package/src/SigningKeyLoader.ts +12 -7
- package/src/client.ts +117 -65
- package/src/env.ts +3 -1
- package/src/graphql/CancelInvoice.ts +17 -0
- package/src/objects/Account.ts +7 -3
- package/src/objects/AccountToApiTokensConnection.ts +3 -2
- package/src/objects/AccountToChannelsConnection.ts +3 -2
- package/src/objects/AccountToNodesConnection.ts +3 -2
- package/src/objects/AccountToPaymentRequestsConnection.ts +3 -2
- package/src/objects/AccountToTransactionsConnection.ts +7 -6
- package/src/objects/AccountToWalletsConnection.ts +3 -2
- package/src/objects/ApiToken.ts +10 -5
- package/src/objects/Balances.ts +20 -12
- package/src/objects/BitcoinNetwork.ts +4 -1
- package/src/objects/CancelInvoiceInput.ts +18 -0
- package/src/objects/CancelInvoiceOutput.ts +26 -0
- package/src/objects/Channel.ts +26 -12
- package/src/objects/ChannelClosingTransaction.ts +7 -3
- package/src/objects/ChannelOpeningTransaction.ts +7 -3
- package/src/objects/ChannelStatus.ts +24 -5
- package/src/objects/ChannelToTransactionsConnection.ts +9 -8
- package/src/objects/Connection.ts +3 -2
- package/src/objects/CreateApiTokenOutput.ts +3 -3
- package/src/objects/CreateLnurlInvoiceInput.ts +3 -2
- package/src/objects/CreateTestModePaymentInput.ts +2 -2
- package/src/objects/CreateTestModePaymentoutput.ts +5 -1
- package/src/objects/CurrencyAmount.ts +2 -2
- package/src/objects/CurrencyUnit.ts +29 -6
- package/src/objects/Deposit.ts +8 -3
- package/src/objects/Entity.ts +8 -3
- package/src/objects/FeeEstimate.ts +5 -1
- package/src/objects/GraphNode.ts +20 -11
- package/src/objects/Hop.ts +8 -3
- package/src/objects/HtlcAttemptFailureCode.ts +4 -1
- package/src/objects/IncentivesIneligibilityReason.ts +16 -4
- package/src/objects/IncentivesStatus.ts +9 -2
- package/src/objects/IncomingPayment.ts +9 -5
- package/src/objects/IncomingPaymentAttempt.ts +7 -3
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -2
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/InvoiceData.ts +7 -3
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
- package/src/objects/LightningTransaction.ts +7 -3
- package/src/objects/LightsparkNode.ts +21 -12
- package/src/objects/LightsparkNodeOwner.ts +2 -2
- package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -2
- package/src/objects/LightsparkNodeWithOSK.ts +20 -12
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +16 -11
- package/src/objects/Node.ts +19 -11
- package/src/objects/NodeAddressType.ts +4 -1
- package/src/objects/NodeToAddressesConnection.ts +7 -3
- package/src/objects/OnChainTransaction.ts +8 -3
- package/src/objects/OutgoingPayment.ts +8 -3
- package/src/objects/OutgoingPaymentAttempt.ts +16 -9
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +7 -3
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -2
- package/src/objects/PageInfo.ts +5 -1
- package/src/objects/PayInvoiceInput.ts +4 -1
- package/src/objects/PaymentFailureReason.ts +4 -1
- package/src/objects/PaymentRequest.ts +7 -3
- package/src/objects/PaymentRequestData.ts +5 -1
- package/src/objects/PaymentRequestStatus.ts +4 -1
- package/src/objects/Permission.ts +4 -1
- package/src/objects/RegisterPaymentInput.ts +8 -7
- package/src/objects/RequestWithdrawalInput.ts +2 -2
- package/src/objects/RiskRating.ts +5 -1
- package/src/objects/RoutingTransaction.ts +11 -5
- package/src/objects/RoutingTransactionFailureReason.ts +4 -1
- package/src/objects/ScreenNodeInput.ts +3 -2
- package/src/objects/SendPaymentInput.ts +4 -1
- package/src/objects/SetInvoicePaymentHashInput.ts +3 -2
- package/src/objects/Signable.ts +2 -2
- package/src/objects/SignablePayload.ts +6 -3
- package/src/objects/Transaction.ts +8 -3
- package/src/objects/TransactionStatus.ts +8 -2
- package/src/objects/TransactionType.ts +16 -4
- package/src/objects/TransactionUpdate.ts +6 -3
- package/src/objects/UmaInvitation.ts +2 -2
- package/src/objects/Wallet.ts +12 -4
- package/src/objects/WalletStatus.ts +18 -4
- package/src/objects/WalletToPaymentRequestsConnection.ts +3 -2
- package/src/objects/WalletToTransactionsConnection.ts +3 -2
- package/src/objects/WebhookEventType.ts +4 -1
- package/src/objects/Withdrawal.ts +7 -3
- package/src/objects/WithdrawalRequest.ts +10 -5
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +3 -2
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +3 -2
- package/src/objects/index.ts +8 -6
- package/src/tests/integration/general-regtest.test.ts +15 -1
package/dist/objects/index.d.cts
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
|
|
2
|
-
export { B as BitcoinNetwork } from '../BitcoinNetwork-
|
|
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 CancelInvoiceInput, j as CancelInvoiceOutput, k as Channel, l as ChannelClosingTransaction, n as ChannelFees, o as ChannelOpeningTransaction, q as ChannelSnapshot, r as ChannelStatus, s as ChannelToTransactionsConnection, t as ClaimUmaInvitationInput, u as ClaimUmaInvitationOutput, v as ClaimUmaInvitationWithIncentivesInput, w as ClaimUmaInvitationWithIncentivesOutput, x as ComplianceProvider, y as Connection, z as CreateApiTokenInput, D as CreateApiTokenOutput, E as CreateInvitationWithIncentivesInput, F as CreateInvitationWithIncentivesOutput, G as CreateInvoiceInput, H as CreateInvoiceOutput, I as CreateLnurlInvoiceInput, J as CreateNodeWalletAddressInput, K as CreateNodeWalletAddressOutput, M as CreateTestModeInvoiceInput, N as CreateTestModeInvoiceOutput, O as CreateTestModePaymentInput, P as CreateTestModePaymentoutput, Q as CreateUmaInvitationInput, R as CreateUmaInvitationOutput, S as CreateUmaInvoiceInput, T as CurrencyAmount, U as CurrencyUnit, V as DeclineToSignMessagesInput, X as DeclineToSignMessagesOutput, Y as DeleteApiTokenInput, Z as DeleteApiTokenOutput, _ as Deposit, a0 as Entity, a1 as FeeEstimate, a2 as FundNodeInput, a3 as FundNodeOutput, a4 as GraphNode, a5 as Hop, a7 as HtlcAttemptFailureCode, a8 as IdAndSignature, a9 as IncentivesIneligibilityReason, aa as IncentivesStatus, ab as IncomingPayment, ac as IncomingPaymentAttempt, ae as IncomingPaymentAttemptStatus, af as IncomingPaymentToAttemptsConnection, ag as Invoice, ai as InvoiceData, aj as InvoiceType, ak as LightningFeeEstimateForInvoiceInput, al as LightningFeeEstimateForNodeInput, am as LightningFeeEstimateOutput, an as LightningTransaction, ap as LightsparkNode, ar as LightsparkNodeOwner, at as LightsparkNodeStatus, au as LightsparkNodeToChannelsConnection, av as LightsparkNodeWithOSK, aw as LightsparkNodeWithRemoteSigning, ax as Node, az as NodeAddress, aA as NodeAddressType, aB as NodeToAddressesConnection, aC as OnChainTransaction, aE as OutgoingPayment, aF as OutgoingPaymentAttempt, aG as OutgoingPaymentAttemptStatus, aH as OutgoingPaymentAttemptToHopsConnection, aI as OutgoingPaymentToAttemptsConnection, aJ as OutgoingPaymentsForInvoiceQueryInput, aK as OutgoingPaymentsForInvoiceQueryOutput, aL as PageInfo, aM as PayInvoiceInput, aN as PayInvoiceOutput, aO as PayUmaInvoiceInput, aP as PaymentDirection, aQ as PaymentFailureReason, aR as PaymentRequest, aT as PaymentRequestData, aU as PaymentRequestStatus, aV as Permission, aW as PostTransactionData, aX as RegionCode, aY as RegisterPaymentInput, aZ as RegisterPaymentOutput, a_ as ReleaseChannelPerCommitmentSecretInput, a$ as ReleaseChannelPerCommitmentSecretOutput, b0 as ReleasePaymentPreimageInput, b1 as ReleasePaymentPreimageOutput, b2 as RemoteSigningSubEventType, b3 as RequestWithdrawalInput, b4 as RequestWithdrawalOutput, b5 as RichText, b6 as RiskRating, b7 as RoutingTransaction, b9 as RoutingTransactionFailureReason, ba as ScreenNodeInput, bb as ScreenNodeOutput, bc as Secret, bd as SendPaymentInput, be as SendPaymentOutput, bf as SetInvoicePaymentHashInput, bg as SetInvoicePaymentHashOutput, bh as SignInvoiceInput, bi as SignInvoiceOutput, bj as SignMessagesInput, bk as SignMessagesOutput, bl as Signable, bn as SignablePayload, bp as SignablePayloadStatus, bq as SingleNodeDashboard, br as Transaction, bt as TransactionFailures, bu as TransactionStatus, bv as TransactionType, bw as TransactionUpdate, bx as UmaInvitation, bz as UpdateChannelPerCommitmentPointInput, bA as UpdateChannelPerCommitmentPointOutput, bB as UpdateNodeSharedSecretInput, bC as UpdateNodeSharedSecretOutput, bD as Wallet, bE as WalletStatus, bF as WalletToPaymentRequestsConnection, bG as WalletToTransactionsConnection, W as WebhookEventType, bH as Withdrawal, bJ as WithdrawalMode, bK as WithdrawalRequest, bL as WithdrawalRequestStatus, bM as WithdrawalRequestToChannelClosingTransactionsConnection, bN as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, m as getChannelClosingTransactionQuery, p as getChannelOpeningTransactionQuery, $ as getDepositQuery, a6 as getHopQuery, ad as getIncomingPaymentAttemptQuery, ah as getInvoiceQuery, ao as getLightningTransactionQuery, as as getLightsparkNodeOwnerQuery, aq as getLightsparkNodeQuery, ay as getNodeQuery, aD as getOnChainTransactionQuery, aS as getPaymentRequestQuery, b8 as getRoutingTransactionQuery, bo as getSignablePayloadQuery, bm as getSignableQuery, bs as getTransactionQuery, by as getUmaInvitationQuery, bI as getWithdrawalQuery } from '../index-a5028d74.js';
|
|
2
|
+
export { B as BitcoinNetwork } from '../BitcoinNetwork-972b1d01.js';
|
|
3
3
|
import '@lightsparkdev/core';
|
|
4
4
|
import 'zen-observable';
|
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
|
|
2
|
-
export { B as BitcoinNetwork } from '../BitcoinNetwork-
|
|
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 CancelInvoiceInput, j as CancelInvoiceOutput, k as Channel, l as ChannelClosingTransaction, n as ChannelFees, o as ChannelOpeningTransaction, q as ChannelSnapshot, r as ChannelStatus, s as ChannelToTransactionsConnection, t as ClaimUmaInvitationInput, u as ClaimUmaInvitationOutput, v as ClaimUmaInvitationWithIncentivesInput, w as ClaimUmaInvitationWithIncentivesOutput, x as ComplianceProvider, y as Connection, z as CreateApiTokenInput, D as CreateApiTokenOutput, E as CreateInvitationWithIncentivesInput, F as CreateInvitationWithIncentivesOutput, G as CreateInvoiceInput, H as CreateInvoiceOutput, I as CreateLnurlInvoiceInput, J as CreateNodeWalletAddressInput, K as CreateNodeWalletAddressOutput, M as CreateTestModeInvoiceInput, N as CreateTestModeInvoiceOutput, O as CreateTestModePaymentInput, P as CreateTestModePaymentoutput, Q as CreateUmaInvitationInput, R as CreateUmaInvitationOutput, S as CreateUmaInvoiceInput, T as CurrencyAmount, U as CurrencyUnit, V as DeclineToSignMessagesInput, X as DeclineToSignMessagesOutput, Y as DeleteApiTokenInput, Z as DeleteApiTokenOutput, _ as Deposit, a0 as Entity, a1 as FeeEstimate, a2 as FundNodeInput, a3 as FundNodeOutput, a4 as GraphNode, a5 as Hop, a7 as HtlcAttemptFailureCode, a8 as IdAndSignature, a9 as IncentivesIneligibilityReason, aa as IncentivesStatus, ab as IncomingPayment, ac as IncomingPaymentAttempt, ae as IncomingPaymentAttemptStatus, af as IncomingPaymentToAttemptsConnection, ag as Invoice, ai as InvoiceData, aj as InvoiceType, ak as LightningFeeEstimateForInvoiceInput, al as LightningFeeEstimateForNodeInput, am as LightningFeeEstimateOutput, an as LightningTransaction, ap as LightsparkNode, ar as LightsparkNodeOwner, at as LightsparkNodeStatus, au as LightsparkNodeToChannelsConnection, av as LightsparkNodeWithOSK, aw as LightsparkNodeWithRemoteSigning, ax as Node, az as NodeAddress, aA as NodeAddressType, aB as NodeToAddressesConnection, aC as OnChainTransaction, aE as OutgoingPayment, aF as OutgoingPaymentAttempt, aG as OutgoingPaymentAttemptStatus, aH as OutgoingPaymentAttemptToHopsConnection, aI as OutgoingPaymentToAttemptsConnection, aJ as OutgoingPaymentsForInvoiceQueryInput, aK as OutgoingPaymentsForInvoiceQueryOutput, aL as PageInfo, aM as PayInvoiceInput, aN as PayInvoiceOutput, aO as PayUmaInvoiceInput, aP as PaymentDirection, aQ as PaymentFailureReason, aR as PaymentRequest, aT as PaymentRequestData, aU as PaymentRequestStatus, aV as Permission, aW as PostTransactionData, aX as RegionCode, aY as RegisterPaymentInput, aZ as RegisterPaymentOutput, a_ as ReleaseChannelPerCommitmentSecretInput, a$ as ReleaseChannelPerCommitmentSecretOutput, b0 as ReleasePaymentPreimageInput, b1 as ReleasePaymentPreimageOutput, b2 as RemoteSigningSubEventType, b3 as RequestWithdrawalInput, b4 as RequestWithdrawalOutput, b5 as RichText, b6 as RiskRating, b7 as RoutingTransaction, b9 as RoutingTransactionFailureReason, ba as ScreenNodeInput, bb as ScreenNodeOutput, bc as Secret, bd as SendPaymentInput, be as SendPaymentOutput, bf as SetInvoicePaymentHashInput, bg as SetInvoicePaymentHashOutput, bh as SignInvoiceInput, bi as SignInvoiceOutput, bj as SignMessagesInput, bk as SignMessagesOutput, bl as Signable, bn as SignablePayload, bp as SignablePayloadStatus, bq as SingleNodeDashboard, br as Transaction, bt as TransactionFailures, bu as TransactionStatus, bv as TransactionType, bw as TransactionUpdate, bx as UmaInvitation, bz as UpdateChannelPerCommitmentPointInput, bA as UpdateChannelPerCommitmentPointOutput, bB as UpdateNodeSharedSecretInput, bC as UpdateNodeSharedSecretOutput, bD as Wallet, bE as WalletStatus, bF as WalletToPaymentRequestsConnection, bG as WalletToTransactionsConnection, W as WebhookEventType, bH as Withdrawal, bJ as WithdrawalMode, bK as WithdrawalRequest, bL as WithdrawalRequestStatus, bM as WithdrawalRequestToChannelClosingTransactionsConnection, bN as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, m as getChannelClosingTransactionQuery, p as getChannelOpeningTransactionQuery, $ as getDepositQuery, a6 as getHopQuery, ad as getIncomingPaymentAttemptQuery, ah as getInvoiceQuery, ao as getLightningTransactionQuery, as as getLightsparkNodeOwnerQuery, aq as getLightsparkNodeQuery, ay as getNodeQuery, aD as getOnChainTransactionQuery, aS as getPaymentRequestQuery, b8 as getRoutingTransactionQuery, bo as getSignablePayloadQuery, bm as getSignableQuery, bs as getTransactionQuery, by as getUmaInvitationQuery, bI as getWithdrawalQuery } from '../index-a5028d74.js';
|
|
2
|
+
export { B as BitcoinNetwork } from '../BitcoinNetwork-972b1d01.js';
|
|
3
3
|
import '@lightsparkdev/core';
|
|
4
4
|
import 'zen-observable';
|
package/dist/objects/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
],
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "yarn tsc && tsup",
|
|
72
|
-
"build:watch": "yarn build --watch",
|
|
72
|
+
"build:watch": "yarn build --watch --clean=false",
|
|
73
73
|
"clean": "rm -rf .turbo && rm -rf dist",
|
|
74
74
|
"dev": "yarn build -- --watch",
|
|
75
75
|
"docs": "typedoc src",
|
|
@@ -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.12",
|
|
92
92
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
93
93
|
"auto-bind": "^5.0.1",
|
|
94
94
|
"crypto-browserify": "^3.12.0",
|
|
@@ -115,6 +115,6 @@
|
|
|
115
115
|
"tsc-absolute": "^1.0.1",
|
|
116
116
|
"tsup": "^7.2.0",
|
|
117
117
|
"typedoc": "^0.24.7",
|
|
118
|
-
"typescript": "^
|
|
118
|
+
"typescript": "^5.0.0"
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
type SigningKey,
|
|
8
8
|
} from "@lightsparkdev/core";
|
|
9
9
|
import {
|
|
10
|
-
isMasterSeedSigningKeyLoaderArgs,
|
|
11
|
-
isNodeIdAndPasswordSigningKeyLoaderArgs,
|
|
12
10
|
MasterSeedSigningKeyLoader,
|
|
13
11
|
NodeIdAndPasswordSigningKeyLoader,
|
|
12
|
+
isMasterSeedSigningKeyLoaderArgs,
|
|
13
|
+
isNodeIdAndPasswordSigningKeyLoaderArgs,
|
|
14
14
|
type SigningKeyLoader,
|
|
15
15
|
type SigningKeyLoaderArgs,
|
|
16
16
|
} from "./SigningKeyLoader.js";
|
|
@@ -30,7 +30,8 @@ export default class NodeKeyLoaderCache {
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Sets the signing key loader for a node.
|
|
33
|
-
* Instantiates a signing key loader based on the type of args passed in by
|
|
33
|
+
* Instantiates a signing key loader based on the type of args passed in by
|
|
34
|
+
* the user.
|
|
34
35
|
*
|
|
35
36
|
* @param nodeId The ID of the node to get the key for
|
|
36
37
|
* @param loaderArgs Loader arguments for loading the key
|
package/src/SigningKeyLoader.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
b64encode,
|
|
3
|
-
isBrowser,
|
|
4
2
|
LightsparkSigningException,
|
|
5
3
|
SigningKeyType,
|
|
4
|
+
b64encode,
|
|
5
|
+
isBrowser,
|
|
6
6
|
type CryptoInterface,
|
|
7
7
|
type Maybe,
|
|
8
8
|
type Requester,
|
|
@@ -21,15 +21,18 @@ export type SigningKeyLoaderArgs =
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Args for creating a new SigningKeyLoader from a node ID and password.
|
|
24
|
-
* This cannot be used if you are using remote signing.
|
|
25
|
-
*
|
|
24
|
+
* This cannot be used if you are using remote signing.
|
|
25
|
+
* It is used to recover an RSA operation signing key using the password you
|
|
26
|
+
* chose when setting up your node. For REGTEST nodes, the password is
|
|
27
|
+
* "1234!@#$".
|
|
26
28
|
*/
|
|
27
29
|
export interface NodeIdAndPasswordSigningKeyLoaderArgs {
|
|
28
30
|
password: string;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
|
-
* Internal version of NodeIdAndPasswordSigningKeyLoaderArgs that includes the
|
|
34
|
+
* Internal version of NodeIdAndPasswordSigningKeyLoaderArgs that includes the
|
|
35
|
+
* node ID.
|
|
33
36
|
*/
|
|
34
37
|
interface NodeIdAndPasswordSigningKeyLoaderArgsInternal
|
|
35
38
|
extends NodeIdAndPasswordSigningKeyLoaderArgs {
|
|
@@ -38,7 +41,8 @@ interface NodeIdAndPasswordSigningKeyLoaderArgsInternal
|
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
43
|
* Args for creating a new SigningKeyLoader from a master seed and network.
|
|
41
|
-
* This should be used if you are using remote signing,
|
|
44
|
+
* This should be used if you are using remote signing,
|
|
45
|
+
* rather than an RSA operation signing key.
|
|
42
46
|
*/
|
|
43
47
|
export interface MasterSeedSigningKeyLoaderArgs {
|
|
44
48
|
masterSeed: Uint8Array;
|
|
@@ -70,7 +74,8 @@ export function isMasterSeedSigningKeyLoaderArgs(
|
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
/**
|
|
73
|
-
* Key loader that loads an RSA signing key by providing a node ID and password
|
|
77
|
+
* Key loader that loads an RSA signing key by providing a node ID and password
|
|
78
|
+
* to recover the key from Lightspark.
|
|
74
79
|
*/
|
|
75
80
|
export class NodeIdAndPasswordSigningKeyLoader implements SigningKeyLoader {
|
|
76
81
|
private readonly nodeId: string;
|
package/src/client.ts
CHANGED
|
@@ -12,19 +12,22 @@ import type {
|
|
|
12
12
|
SigningKey,
|
|
13
13
|
} from "@lightsparkdev/core";
|
|
14
14
|
import {
|
|
15
|
-
createSha256Hash,
|
|
16
15
|
DefaultCrypto,
|
|
17
16
|
LightsparkAuthException,
|
|
18
17
|
LightsparkException,
|
|
19
18
|
LightsparkSigningException,
|
|
20
19
|
NodeKeyCache,
|
|
21
|
-
pollUntil,
|
|
22
20
|
Requester,
|
|
23
21
|
SigningKeyType,
|
|
24
22
|
StubAuthProvider,
|
|
23
|
+
createSha256Hash,
|
|
24
|
+
pollUntil,
|
|
25
25
|
} from "@lightsparkdev/core";
|
|
26
26
|
import packageJson from "../package.json";
|
|
27
|
+
import NodeKeyLoaderCache from "./NodeKeyLoaderCache.js";
|
|
28
|
+
import { type SigningKeyLoaderArgs } from "./SigningKeyLoader.js";
|
|
27
29
|
import { BitcoinFeeEstimate as BitcoinFeeEstimateQuery } from "./graphql/BitcoinFeeEstimate.js";
|
|
30
|
+
import { CancelInvoice } from "./graphql/CancelInvoice.js";
|
|
28
31
|
import { ClaimUmaInvitation } from "./graphql/ClaimUmaInvitation.js";
|
|
29
32
|
import { ClaimUmaInvitationWithIncentives } from "./graphql/ClaimUmaInvitationWithIncentives.js";
|
|
30
33
|
import { CreateApiToken } from "./graphql/CreateApiToken.js";
|
|
@@ -45,14 +48,14 @@ import { LightningFeeEstimateForNode } from "./graphql/LightningFeeEstimateForNo
|
|
|
45
48
|
import type { AccountDashboard } from "./graphql/MultiNodeDashboard.js";
|
|
46
49
|
import { MultiNodeDashboard } from "./graphql/MultiNodeDashboard.js";
|
|
47
50
|
import { PayInvoice } from "./graphql/PayInvoice.js";
|
|
48
|
-
import { PaymentRequestsForNode } from "./graphql/PaymentRequestsForNode.js";
|
|
49
51
|
import { PayUmaInvoice } from "./graphql/PayUmaInvoice.js";
|
|
52
|
+
import { PaymentRequestsForNode } from "./graphql/PaymentRequestsForNode.js";
|
|
50
53
|
import { RequestWithdrawal } from "./graphql/RequestWithdrawal.js";
|
|
51
54
|
import { SendPayment } from "./graphql/SendPayment.js";
|
|
52
55
|
import { SingleNodeDashboard as SingleNodeDashboardQuery } from "./graphql/SingleNodeDashboard.js";
|
|
53
|
-
import { TransactionsForNode } from "./graphql/TransactionsForNode.js";
|
|
54
56
|
import { TransactionSubscription } from "./graphql/TransactionSubscription.js";
|
|
55
|
-
import
|
|
57
|
+
import { TransactionsForNode } from "./graphql/TransactionsForNode.js";
|
|
58
|
+
import { TransactionStatus } from "./index.js";
|
|
56
59
|
import Account from "./objects/Account.js";
|
|
57
60
|
import { ApiTokenFromJson } from "./objects/ApiToken.js";
|
|
58
61
|
import BitcoinNetwork from "./objects/BitcoinNetwork.js";
|
|
@@ -76,10 +79,9 @@ import type RegionCode from "./objects/RegionCode.js";
|
|
|
76
79
|
import type SingleNodeDashboard from "./objects/SingleNodeDashboard.js";
|
|
77
80
|
import type Transaction from "./objects/Transaction.js";
|
|
78
81
|
import {
|
|
79
|
-
getTransactionQuery,
|
|
80
82
|
TransactionFromJson,
|
|
83
|
+
getTransactionQuery,
|
|
81
84
|
} from "./objects/Transaction.js";
|
|
82
|
-
import TransactionStatus from "./objects/TransactionStatus.js";
|
|
83
85
|
import type TransactionUpdate from "./objects/TransactionUpdate.js";
|
|
84
86
|
import { TransactionUpdateFromJson } from "./objects/TransactionUpdate.js";
|
|
85
87
|
import type UmaInvitation from "./objects/UmaInvitation.js";
|
|
@@ -87,12 +89,12 @@ import { UmaInvitationFromJson } from "./objects/UmaInvitation.js";
|
|
|
87
89
|
import type WithdrawalMode from "./objects/WithdrawalMode.js";
|
|
88
90
|
import type WithdrawalRequest from "./objects/WithdrawalRequest.js";
|
|
89
91
|
import { WithdrawalRequestFromJson } from "./objects/WithdrawalRequest.js";
|
|
90
|
-
import { type SigningKeyLoaderArgs } from "./SigningKeyLoader.js";
|
|
91
92
|
|
|
92
93
|
const sdkVersion = packageJson.version;
|
|
93
94
|
|
|
94
95
|
/**
|
|
95
|
-
* The LightsparkClient is the main entrypoint for interacting with the
|
|
96
|
+
* The LightsparkClient is the main entrypoint for interacting with the
|
|
97
|
+
* Lightspark API.
|
|
96
98
|
*
|
|
97
99
|
* ```ts
|
|
98
100
|
* const lightsparkClient = new LightsparkClient(
|
|
@@ -129,7 +131,8 @@ class LightsparkClient {
|
|
|
129
131
|
* use, you should use the `AccountTokenAuthProvider`.
|
|
130
132
|
* @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
|
|
131
133
|
* @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
|
|
132
|
-
* For React Native, you should use the `ReactNativeCrypto`
|
|
134
|
+
* For React Native, you should use the `ReactNativeCrypto`
|
|
135
|
+
* implementation from `@lightsparkdev/react-native`.
|
|
133
136
|
*/
|
|
134
137
|
constructor(
|
|
135
138
|
private authProvider: AuthProvider = new StubAuthProvider(),
|
|
@@ -154,9 +157,11 @@ class LightsparkClient {
|
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
/**
|
|
157
|
-
* Sets the key loader for a node. This unlocks client operations that
|
|
158
|
-
* Passing in [NodeIdAndPasswordSigningKeyLoaderArgs]
|
|
159
|
-
*
|
|
160
|
+
* Sets the key loader for a node. This unlocks client operations that
|
|
161
|
+
* require a private key. Passing in [NodeIdAndPasswordSigningKeyLoaderArgs]
|
|
162
|
+
* loads the RSA key for an OSK node.
|
|
163
|
+
* Passing in [MasterSeedSigningKeyLoaderArgs] loads the Secp256k1 key for a
|
|
164
|
+
* remote signing node.
|
|
160
165
|
*
|
|
161
166
|
* @param nodeId The ID of the node the key is for
|
|
162
167
|
* @param loader The loader for the key
|
|
@@ -171,7 +176,8 @@ class LightsparkClient {
|
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
/**
|
|
174
|
-
* Gets the signing key for a node. Must have previously called
|
|
179
|
+
* Gets the signing key for a node. Must have previously called
|
|
180
|
+
* [loadNodeSigningKey].
|
|
175
181
|
*
|
|
176
182
|
* @param nodeId The ID of the node the key is for
|
|
177
183
|
* @returns The signing key for the node
|
|
@@ -183,7 +189,8 @@ class LightsparkClient {
|
|
|
183
189
|
}
|
|
184
190
|
|
|
185
191
|
/**
|
|
186
|
-
* Sets the auth provider for the client.
|
|
192
|
+
* Sets the auth provider for the client.
|
|
193
|
+
* This is useful for switching between auth providers if you are using
|
|
187
194
|
* multiple accounts or waiting for the user to log in.
|
|
188
195
|
*
|
|
189
196
|
* @param authProvider
|
|
@@ -282,7 +289,8 @@ class LightsparkClient {
|
|
|
282
289
|
}
|
|
283
290
|
|
|
284
291
|
/**
|
|
285
|
-
* Starts listening for new transactions or updates to existing transactions
|
|
292
|
+
* Starts listening for new transactions or updates to existing transactions
|
|
293
|
+
* for a list of nodes.
|
|
286
294
|
*
|
|
287
295
|
* @param nodeIds The node IDs for which to listen to transactions.
|
|
288
296
|
* @returns A zen-observable that emits transaction updates for the given node IDs.
|
|
@@ -305,8 +313,8 @@ class LightsparkClient {
|
|
|
305
313
|
}
|
|
306
314
|
|
|
307
315
|
/**
|
|
308
|
-
* Retrieves a dashboard of basic info for the authenticated account.
|
|
309
|
-
* included.
|
|
316
|
+
* Retrieves a dashboard of basic info for the authenticated account.
|
|
317
|
+
* See `AccountDashboard` for which info is included.
|
|
310
318
|
*
|
|
311
319
|
* @param nodeIds The node IDs to include in the dashboard. Defaults to undefined (all nodes).
|
|
312
320
|
* @param bitcoinNetwork The bitcoin network to include in the dashboard. Defaults to MAINNET.
|
|
@@ -397,8 +405,8 @@ class LightsparkClient {
|
|
|
397
405
|
}
|
|
398
406
|
|
|
399
407
|
/**
|
|
400
|
-
* Gets a basic dashboard for a single node, including recent transactions.
|
|
401
|
-
* included.
|
|
408
|
+
* Gets a basic dashboard for a single node, including recent transactions.
|
|
409
|
+
* See `SingleNodeDashboard` for which info is included.
|
|
402
410
|
*
|
|
403
411
|
* @param nodeId The node ID for which to get a dashboard.
|
|
404
412
|
* @param bitcoinNetwork The bitcoin network for which to get a dashboard. Defaults to MAINNET.
|
|
@@ -479,7 +487,8 @@ class LightsparkClient {
|
|
|
479
487
|
/**
|
|
480
488
|
* Creates an invoice for the given node.
|
|
481
489
|
*
|
|
482
|
-
* Test mode note: You can simulate a payment of this invoice in test move
|
|
490
|
+
* Test mode note: You can simulate a payment of this invoice in test move
|
|
491
|
+
* using [createTestModePayment].
|
|
483
492
|
*
|
|
484
493
|
* @param nodeId The node ID for which to create an invoice.
|
|
485
494
|
* @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
|
|
@@ -514,11 +523,13 @@ class LightsparkClient {
|
|
|
514
523
|
}
|
|
515
524
|
|
|
516
525
|
/**
|
|
517
|
-
* Generates a Lightning Invoice (follows the Bolt 11 specification) to
|
|
518
|
-
* from another Lightning Node.
|
|
526
|
+
* Generates a Lightning Invoice (follows the Bolt 11 specification) to
|
|
527
|
+
* request a payment from another Lightning Node.
|
|
528
|
+
* This should only be used for generating invoices for LNURLs,
|
|
519
529
|
* with [createInvoice] preferred in the general case.
|
|
520
530
|
*
|
|
521
|
-
* Test mode note: You can simulate a payment of this invoice in test move
|
|
531
|
+
* Test mode note: You can simulate a payment of this invoice in test move
|
|
532
|
+
* using [createTestModePayment].
|
|
522
533
|
*
|
|
523
534
|
* @param nodeId The node ID for which to create an invoice.
|
|
524
535
|
* @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
|
|
@@ -555,10 +566,12 @@ class LightsparkClient {
|
|
|
555
566
|
}
|
|
556
567
|
|
|
557
568
|
/**
|
|
558
|
-
* Creates a new invoice for the UMA protocol.
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
569
|
+
* Creates a new invoice for the UMA protocol.
|
|
570
|
+
* The metadata is hashed and included in the invoice.
|
|
571
|
+
* This API generates a Lightning Invoice (follows the Bolt 11 specification)
|
|
572
|
+
* to request a payment from another Lightning Node.
|
|
573
|
+
* This should only be used for generating invoices for UMA,
|
|
574
|
+
* with `createInvoice` preferred in the general case.
|
|
562
575
|
*
|
|
563
576
|
* @param nodeId The node ID for which to create an invoice.
|
|
564
577
|
* @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
|
|
@@ -592,6 +605,23 @@ class LightsparkClient {
|
|
|
592
605
|
return InvoiceFromJson(invoiceJson);
|
|
593
606
|
}
|
|
594
607
|
|
|
608
|
+
/**
|
|
609
|
+
* Cancels an existing unpaid invoice and returns that invoice. Cancelled invoices cannot be paid.
|
|
610
|
+
*
|
|
611
|
+
* @param invoiceId The ID of the invoice to cancel.
|
|
612
|
+
* @returns The cancelled invoice, or undefined if the invoice could not be cancelled.
|
|
613
|
+
*/
|
|
614
|
+
public async cancelInvoice(invoiceId: string): Promise<Invoice | undefined> {
|
|
615
|
+
const response = await this.requester.makeRawRequest(CancelInvoice, {
|
|
616
|
+
invoice_id: invoiceId,
|
|
617
|
+
});
|
|
618
|
+
const invoiceJson = response.cancel_invoice?.invoice;
|
|
619
|
+
if (!invoiceJson) {
|
|
620
|
+
return undefined;
|
|
621
|
+
}
|
|
622
|
+
return InvoiceFromJson(invoiceJson);
|
|
623
|
+
}
|
|
624
|
+
|
|
595
625
|
/**
|
|
596
626
|
* Decodes an encoded lightning invoice string.
|
|
597
627
|
*
|
|
@@ -606,7 +636,8 @@ class LightsparkClient {
|
|
|
606
636
|
}
|
|
607
637
|
|
|
608
638
|
/**
|
|
609
|
-
* Gets an estimate of the fee for sending a payment over the given bitcoin
|
|
639
|
+
* Gets an estimate of the fee for sending a payment over the given bitcoin
|
|
640
|
+
* network.
|
|
610
641
|
*
|
|
611
642
|
* @param bitcoinNetwork The bitcoin network for which to get a fee estimate. Defaults to MAINNET.
|
|
612
643
|
* @returns A fee estimate for the given bitcoin network including a minimum fee rate, and a max-speed fee rate.
|
|
@@ -652,7 +683,8 @@ class LightsparkClient {
|
|
|
652
683
|
}
|
|
653
684
|
|
|
654
685
|
/**
|
|
655
|
-
* Returns an estimate of the fees that will be paid to send a payment to
|
|
686
|
+
* Returns an estimate of the fees that will be paid to send a payment to
|
|
687
|
+
* another Lightning node.
|
|
656
688
|
*
|
|
657
689
|
* @param nodeId The node from where you want to send the payment.
|
|
658
690
|
* @param destinationNodePublicKey The public key of the node that you want to pay.
|
|
@@ -698,17 +730,20 @@ class LightsparkClient {
|
|
|
698
730
|
/**
|
|
699
731
|
* Sends a lightning payment for a given invoice.
|
|
700
732
|
*
|
|
701
|
-
* Test mode note: For test mode, you can use the [createTestModeInvoice]
|
|
702
|
-
* pay in test mode.
|
|
733
|
+
* Test mode note: For test mode, you can use the [createTestModeInvoice]
|
|
734
|
+
* function to create an invoice you can pay in test mode.
|
|
703
735
|
*
|
|
704
736
|
* @param payerNodeId The ID of the node that will pay the invoice.
|
|
705
737
|
* @param encodedInvoice The encoded invoice to pay.
|
|
706
738
|
* @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
|
|
707
|
-
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
708
|
-
*
|
|
739
|
+
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
740
|
+
* transactions succeed. For example,
|
|
741
|
+
* for a transaction between 10k sats and 100k sats,
|
|
742
|
+
* this would mean a fee limit of 16 to 160 sats.
|
|
709
743
|
* @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
|
|
710
744
|
* @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
|
|
711
|
-
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
745
|
+
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
746
|
+
* invoice. Otherwise, the call will fail.
|
|
712
747
|
* @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
|
|
713
748
|
*/
|
|
714
749
|
public async payInvoice(
|
|
@@ -749,18 +784,23 @@ class LightsparkClient {
|
|
|
749
784
|
}
|
|
750
785
|
|
|
751
786
|
/**
|
|
752
|
-
* sends an UMA payment to a node on the Lightning Network,
|
|
753
|
-
* (as defined by the BOLT11 specification) that you
|
|
754
|
-
*
|
|
787
|
+
* sends an UMA payment to a node on the Lightning Network,
|
|
788
|
+
* based on the invoice (as defined by the BOLT11 specification) that you
|
|
789
|
+
* provide.
|
|
790
|
+
* This should only be used for paying UMA invoices,
|
|
791
|
+
* with `payInvoice` preferred in the general case.
|
|
755
792
|
*
|
|
756
793
|
* @param payerNodeId The ID of the node that will pay the invoice.
|
|
757
794
|
* @param encodedInvoice The encoded invoice to pay.
|
|
758
795
|
* @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
|
|
759
|
-
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
760
|
-
*
|
|
796
|
+
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
797
|
+
* transactions succeed. For example,
|
|
798
|
+
* for a transaction between 10k sats and 100k sats,
|
|
799
|
+
* this would mean a fee limit of 16 to 160 sats.
|
|
761
800
|
* @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
|
|
762
801
|
* @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
|
|
763
|
-
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
802
|
+
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
803
|
+
* invoice. Otherwise, the call will fail.
|
|
764
804
|
* @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
|
|
765
805
|
*/
|
|
766
806
|
public async payUmaInvoice(
|
|
@@ -801,7 +841,8 @@ class LightsparkClient {
|
|
|
801
841
|
}
|
|
802
842
|
|
|
803
843
|
/**
|
|
804
|
-
* Waits for a transaction to have a completed status, and returns the
|
|
844
|
+
* Waits for a transaction to have a completed status, and returns the
|
|
845
|
+
* transaction.
|
|
805
846
|
*
|
|
806
847
|
* @param transactionId The ID of the transaction to wait for
|
|
807
848
|
* @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
|
|
@@ -848,15 +889,18 @@ class LightsparkClient {
|
|
|
848
889
|
}
|
|
849
890
|
|
|
850
891
|
/**
|
|
851
|
-
* Sends a payment directly to a node on the Lightning Network through the
|
|
892
|
+
* Sends a payment directly to a node on the Lightning Network through the
|
|
893
|
+
* public key of the node without an invoice.
|
|
852
894
|
*
|
|
853
895
|
* @param payerNodeId The ID of the node that will send the payment.
|
|
854
896
|
* @param destinationPublicKey The public key of the destination node.
|
|
855
897
|
* @param timeoutSecs The timeout in seconds that we will try to make the payment.
|
|
856
898
|
* @param amountMsats The amount to pay in msats.
|
|
857
899
|
* @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
|
|
858
|
-
* As guidance, a maximum fee of 15 basis points should make almost all
|
|
859
|
-
*
|
|
900
|
+
* As guidance, a maximum fee of 15 basis points should make almost all
|
|
901
|
+
* transactions succeed. For example,
|
|
902
|
+
* for a transaction between 10k sats and 100k sats,
|
|
903
|
+
* this would mean a fee limit of 15 to 150 sats.
|
|
860
904
|
* @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
|
|
861
905
|
*/
|
|
862
906
|
public async sendPayment(
|
|
@@ -894,7 +938,8 @@ class LightsparkClient {
|
|
|
894
938
|
}
|
|
895
939
|
|
|
896
940
|
/**
|
|
897
|
-
* Creates an L1 Bitcoin wallet address for a given node which can be used to
|
|
941
|
+
* Creates an L1 Bitcoin wallet address for a given node which can be used to
|
|
942
|
+
* deposit or withdraw funds.
|
|
898
943
|
*
|
|
899
944
|
* @param nodeId The ID of the node to create a wallet address for.
|
|
900
945
|
* @returns A string containing the wallet address for the given node.
|
|
@@ -908,12 +953,15 @@ class LightsparkClient {
|
|
|
908
953
|
}
|
|
909
954
|
|
|
910
955
|
/**
|
|
911
|
-
* Withdraws funds from the account and sends it to the requested bitcoin
|
|
956
|
+
* Withdraws funds from the account and sends it to the requested bitcoin
|
|
957
|
+
* address.
|
|
912
958
|
*
|
|
913
|
-
* Depending on the chosen mode, it will first take the funds from the
|
|
914
|
-
*
|
|
915
|
-
*
|
|
916
|
-
*
|
|
959
|
+
* Depending on the chosen mode, it will first take the funds from the
|
|
960
|
+
* wallet, and if applicable, close channels appropriately to recover enough
|
|
961
|
+
* funds and reopen channels with the remaining funds.
|
|
962
|
+
* The process is asynchronous and may take up to a few minutes.
|
|
963
|
+
* You can check the progress by polling the `WithdrawalRequest` that is
|
|
964
|
+
* created, or by subscribing to a webhook.
|
|
917
965
|
*
|
|
918
966
|
* @param nodeId The ID of the node from which to withdraw funds.
|
|
919
967
|
* @param amountSats The amount of funds to withdraw in satoshis.
|
|
@@ -940,9 +988,10 @@ class LightsparkClient {
|
|
|
940
988
|
}
|
|
941
989
|
|
|
942
990
|
/**
|
|
943
|
-
* Adds funds to a Lightspark node on the REGTEST network.
|
|
944
|
-
*
|
|
945
|
-
*
|
|
991
|
+
* Adds funds to a Lightspark node on the REGTEST network.
|
|
992
|
+
* If the amount is not specified, 10,000,000 SATOSHI will be added.
|
|
993
|
+
* This API only functions for nodes created on the REGTEST network and will
|
|
994
|
+
* return an error when called for any non-REGTEST node.
|
|
946
995
|
*
|
|
947
996
|
* @param nodeId The ID of the node to fund. Must be a REGTEST node.
|
|
948
997
|
* @param amountSats The amount of funds to add to the node in satoshis. Defaults to 10,000,000 SATOSHI.
|
|
@@ -960,8 +1009,8 @@ class LightsparkClient {
|
|
|
960
1009
|
}
|
|
961
1010
|
|
|
962
1011
|
/**
|
|
963
|
-
* Creates a new API token that can be used to authenticate requests for this
|
|
964
|
-
* and SDKs.
|
|
1012
|
+
* Creates a new API token that can be used to authenticate requests for this
|
|
1013
|
+
* account when using the Lightspark APIs and SDKs.
|
|
965
1014
|
*
|
|
966
1015
|
* @param name Creates a new API token that can be used to authenticate requests for this account when using the
|
|
967
1016
|
* Lightspark APIs and SDKs.
|
|
@@ -1005,8 +1054,9 @@ class LightsparkClient {
|
|
|
1005
1054
|
}
|
|
1006
1055
|
|
|
1007
1056
|
/**
|
|
1008
|
-
* In test mode, generates a Lightning Invoice which can be paid by a local
|
|
1009
|
-
* This call is only valid in test mode.
|
|
1057
|
+
* In test mode, generates a Lightning Invoice which can be paid by a local
|
|
1058
|
+
* node. This call is only valid in test mode.
|
|
1059
|
+
* You can then pay the invoice using [payInvoice].
|
|
1010
1060
|
*
|
|
1011
1061
|
* @param localNodeId The ID of the node that will pay the invoice.
|
|
1012
1062
|
* @param amountMsats The amount to pay in milli-satoshis.
|
|
@@ -1046,8 +1096,9 @@ class LightsparkClient {
|
|
|
1046
1096
|
}
|
|
1047
1097
|
|
|
1048
1098
|
/**
|
|
1049
|
-
* In test mode, simulates a payment of a Lightning Invoice from another
|
|
1050
|
-
* This can only be used in test mode and should be used with invoices
|
|
1099
|
+
* In test mode, simulates a payment of a Lightning Invoice from another
|
|
1100
|
+
* node. This can only be used in test mode and should be used with invoices
|
|
1101
|
+
* generated by [createInvoice].
|
|
1051
1102
|
*
|
|
1052
1103
|
* @param localNodeId The ID of the node that will receive the payment.
|
|
1053
1104
|
* @param encodedInvoice The encoded invoice to pay.
|
|
@@ -1079,8 +1130,8 @@ class LightsparkClient {
|
|
|
1079
1130
|
}
|
|
1080
1131
|
|
|
1081
1132
|
/**
|
|
1082
|
-
* Creates an UMA invitation. If you are part of the incentive program,
|
|
1083
|
-
* [createUmaInvitationWithIncentives].
|
|
1133
|
+
* Creates an UMA invitation. If you are part of the incentive program,
|
|
1134
|
+
* you should use [createUmaInvitationWithIncentives].
|
|
1084
1135
|
*
|
|
1085
1136
|
* @param inviterUma The UMA of the inviter.
|
|
1086
1137
|
* @returns The invitation that was created.
|
|
@@ -1150,8 +1201,8 @@ class LightsparkClient {
|
|
|
1150
1201
|
}
|
|
1151
1202
|
|
|
1152
1203
|
/**
|
|
1153
|
-
* Claims an UMA invitation. If you are part of the incentive program,
|
|
1154
|
-
* [claimUmaInvitationWithIncentives].
|
|
1204
|
+
* Claims an UMA invitation. If you are part of the incentive program,
|
|
1205
|
+
* you should use [claimUmaInvitationWithIncentives].
|
|
1155
1206
|
*
|
|
1156
1207
|
* @param invitationCode The invitation code to claim.
|
|
1157
1208
|
* @param inviteeUma The UMA of the invitee.
|
|
@@ -1266,7 +1317,8 @@ class LightsparkClient {
|
|
|
1266
1317
|
/**
|
|
1267
1318
|
* Executes a raw `Query` against the Lightspark API.
|
|
1268
1319
|
*
|
|
1269
|
-
* This generally should not be used directly,
|
|
1320
|
+
* This generally should not be used directly,
|
|
1321
|
+
* but is exposed for advanced use cases and for internal use to retrieve
|
|
1270
1322
|
* complex fields from objects.
|
|
1271
1323
|
*
|
|
1272
1324
|
* @param query The `Query` to execute.
|
package/src/env.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
/*
|
|
3
|
+
/*
|
|
4
|
+
* These utils are only needed in NodeJS contexts and so the file is exported
|
|
5
|
+
* separately
|
|
4
6
|
in the package to avoid eg unnecessary browser bundling */
|
|
5
7
|
import dotenv from "dotenv";
|
|
6
8
|
import { getBitcoinNetworkOrThrow } from "./helpers.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { FRAGMENT as InvoiceFragment } from "../objects/Invoice.js";
|
|
4
|
+
|
|
5
|
+
export const CancelInvoice = `
|
|
6
|
+
mutation CancelInvoice(
|
|
7
|
+
$invoice_id: ID!
|
|
8
|
+
) {
|
|
9
|
+
cancel_invoice(input: { invoice_id: $invoice_id }) {
|
|
10
|
+
invoice {
|
|
11
|
+
...InvoiceFragment
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
${InvoiceFragment}
|
|
17
|
+
`;
|