@lightsparkdev/lightspark-sdk 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/{chunk-5RDIWPBE.js → chunk-D32EWIPX.js} +3 -1
- package/dist/{chunk-7UT6YX37.js → chunk-VTPDR6P4.js} +393 -275
- package/dist/env.cjs +3 -1
- package/dist/env.d.cts +17 -0
- package/dist/env.js +2 -2
- package/dist/{index-d31f4469.d.ts → index-5acc6526.d.ts} +1403 -408
- package/dist/index.cjs +424 -296
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +32 -27
- package/dist/objects/index.cjs +395 -277
- package/dist/objects/index.d.cts +4 -0
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +6 -6
- package/dist/{text-encoding-MDIPJAHL.js → text-encoding-26SMKBAQ.js} +3 -1
- package/package.json +5 -5
- package/src/auth/AccountTokenAuthProvider.ts +15 -11
- package/src/client.ts +7 -6
- package/src/helpers.ts +3 -1
- package/src/objects/Account.ts +21 -2
- package/src/objects/AccountToApiTokensConnection.ts +16 -5
- package/src/objects/AccountToChannelsConnection.ts +14 -0
- package/src/objects/AccountToNodesConnection.ts +19 -5
- package/src/objects/AccountToPaymentRequestsConnection.ts +21 -5
- package/src/objects/AccountToTransactionsConnection.ts +33 -9
- package/src/objects/AccountToWalletsConnection.ts +13 -4
- package/src/objects/ApiToken.ts +13 -3
- package/src/objects/Balances.ts +17 -3
- package/src/objects/BlockchainBalance.ts +34 -9
- package/src/objects/Channel.ts +92 -16
- package/src/objects/ChannelClosingTransaction.ts +81 -61
- package/src/objects/ChannelFees.ts +16 -5
- package/src/objects/ChannelOpeningTransaction.ts +81 -61
- package/src/objects/ChannelSnapshot.ts +32 -8
- package/src/objects/ChannelToTransactionsConnection.ts +26 -6
- package/src/objects/Connection.ts +205 -10
- package/src/objects/CreateApiTokenInput.ts +8 -2
- package/src/objects/CreateApiTokenOutput.ts +9 -3
- package/src/objects/CreateInvoiceInput.ts +14 -5
- package/src/objects/CreateInvoiceOutput.ts +7 -2
- package/src/objects/CreateLnurlInvoiceInput.ts +13 -3
- package/src/objects/CreateNodeWalletAddressInput.ts +9 -2
- package/src/objects/CreateNodeWalletAddressOutput.ts +10 -2
- package/src/objects/CreateTestModeInvoiceInput.ts +14 -4
- package/src/objects/CreateTestModeInvoiceOutput.ts +10 -2
- package/src/objects/CreateTestModePaymentInput.ts +12 -3
- package/src/objects/CreateTestModePaymentoutput.ts +12 -2
- package/src/objects/CreateUmaInvoiceInput.ts +13 -3
- package/src/objects/CurrencyAmount.ts +13 -2
- package/src/objects/DeclineToSignMessagesInput.ts +9 -2
- package/src/objects/DeclineToSignMessagesOutput.ts +15 -3
- package/src/objects/DeleteApiTokenInput.ts +7 -2
- package/src/objects/DeleteApiTokenOutput.ts +7 -2
- package/src/objects/Deposit.ts +77 -61
- package/src/objects/Entity.ts +2 -2
- package/src/objects/FeeEstimate.ts +12 -3
- package/src/objects/FundNodeInput.ts +9 -3
- package/src/objects/FundNodeOutput.ts +11 -3
- package/src/objects/GraphNode.ts +49 -5
- package/src/objects/Hop.ts +27 -9
- package/src/objects/IdAndSignature.ts +8 -2
- package/src/objects/IncomingPayment.ts +50 -7
- package/src/objects/IncomingPaymentAttempt.ts +21 -5
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
- package/src/objects/Invoice.ts +37 -24
- package/src/objects/InvoiceData.ts +21 -6
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
- package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
- package/src/objects/LightningFeeEstimateOutput.ts +15 -3
- package/src/objects/LightningTransaction.ts +117 -28
- package/src/objects/LightsparkNode.ts +250 -210
- package/src/objects/LightsparkNodeOwner.ts +35 -4
- package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
- package/src/objects/LightsparkNodeWithOSK.ts +127 -17
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +122 -15
- package/src/objects/Node.ts +209 -68
- package/src/objects/NodeAddress.ts +8 -2
- package/src/objects/NodeToAddressesConnection.ts +13 -3
- package/src/objects/OnChainTransaction.ts +156 -44
- package/src/objects/OutgoingPayment.ts +72 -14
- package/src/objects/OutgoingPaymentAttempt.ts +63 -8
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
- package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
- package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
- package/src/objects/PageInfo.ts +14 -6
- package/src/objects/PayInvoiceInput.ts +12 -3
- package/src/objects/PayInvoiceOutput.ts +7 -2
- package/src/objects/PayUmaInvoiceInput.ts +12 -3
- package/src/objects/PaymentRequest.ts +27 -5
- package/src/objects/PaymentRequestData.ts +27 -4
- package/src/objects/PostTransactionData.ts +12 -3
- package/src/objects/RegisterPaymentInput.ts +10 -2
- package/src/objects/RegisterPaymentOutput.ts +9 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
- package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
- package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
- package/src/objects/RequestWithdrawalInput.ts +12 -2
- package/src/objects/RequestWithdrawalOutput.ts +9 -2
- package/src/objects/RichText.ts +7 -2
- package/src/objects/RoutingTransaction.ts +62 -41
- package/src/objects/ScreenNodeInput.ts +8 -2
- package/src/objects/ScreenNodeOutput.ts +7 -2
- package/src/objects/Secret.ts +8 -2
- package/src/objects/SendPaymentInput.ts +11 -2
- package/src/objects/SendPaymentOutput.ts +7 -2
- package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
- package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
- package/src/objects/SignInvoiceInput.ts +9 -2
- package/src/objects/SignInvoiceOutput.ts +7 -2
- package/src/objects/SignMessagesInput.ts +13 -3
- package/src/objects/SignMessagesOutput.ts +13 -3
- package/src/objects/Signable.ts +10 -3
- package/src/objects/SignablePayload.ts +18 -5
- package/src/objects/Transaction.ts +206 -9
- package/src/objects/TransactionFailures.ts +11 -4
- package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
- package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
- package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
- package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
- package/src/objects/Wallet.ts +34 -5
- package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
- package/src/objects/WalletToTransactionsConnection.ts +16 -5
- package/src/objects/Withdrawal.ts +77 -61
- package/src/objects/WithdrawalRequest.ts +42 -4
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
- package/src/objects/index.ts +5 -2
- package/src/tests/integration/constants.ts +13 -0
- package/src/tests/integration/general-regtest.test.ts +652 -0
- package/src/tests/serialization.test.ts +21 -0
- package/src/webhooks.ts +1 -1
- package/src/tests/integration/client.test.ts +0 -207
- /package/dist/{chunk-NIMBE7W3.js → chunk-BMTV3EA2.js} +0 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AuthProvider } from '@lightsparkdev/core';
|
|
2
|
+
import { W as WebhookEventType, L as LightsparkClient } from './index-5acc6526.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 ChannelSnapshot, p as ChannelStatus, q as ChannelToTransactionsConnection, r as ComplianceProvider, s as Connection, t as CreateApiTokenInput, u as CreateApiTokenOutput, v as CreateInvoiceInput, w as CreateInvoiceOutput, x as CreateLnurlInvoiceInput, y as CreateNodeWalletAddressInput, z as CreateNodeWalletAddressOutput, D as CreateTestModeInvoiceInput, E as CreateTestModeInvoiceOutput, F as CreateTestModePaymentInput, G as CreateTestModePaymentoutput, H as CreateUmaInvoiceInput, I as CurrencyAmount, J as CurrencyUnit, K as DeclineToSignMessagesInput, M as DeclineToSignMessagesOutput, N as DeleteApiTokenInput, O as DeleteApiTokenOutput, P as Deposit, R as Entity, S as FeeEstimate, T as FundNodeInput, U as FundNodeOutput, V as GraphNode, X as Hop, Z as HtlcAttemptFailureCode, _ as IdAndSignature, $ as IncomingPayment, a0 as IncomingPaymentAttempt, a2 as IncomingPaymentAttemptStatus, a3 as IncomingPaymentToAttemptsConnection, a4 as Invoice, a6 as InvoiceData, a7 as InvoiceType, a8 as LightningFeeEstimateForInvoiceInput, a9 as LightningFeeEstimateForNodeInput, aa as LightningFeeEstimateOutput, ab as LightningTransaction, ad as LightsparkNode, af as LightsparkNodeOwner, ah as LightsparkNodeStatus, ai as LightsparkNodeToChannelsConnection, aj as LightsparkNodeWithOSK, ak as LightsparkNodeWithRemoteSigning, al as Node, an as NodeAddress, ao as NodeAddressType, ap as NodeToAddressesConnection, aq as OnChainTransaction, as as OutgoingPayment, at as OutgoingPaymentAttempt, au as OutgoingPaymentAttemptStatus, av as OutgoingPaymentAttemptToHopsConnection, ay as OutgoingPaymentToAttemptsConnection, aw as OutgoingPaymentsForInvoiceQueryInput, ax as OutgoingPaymentsForInvoiceQueryOutput, az as PageInfo, aA as PayInvoiceInput, aB as PayInvoiceOutput, aI as PayUmaInvoiceInput, aC as PaymentDirection, aD as PaymentFailureReason, aE as PaymentRequest, aG as PaymentRequestData, aH as PaymentRequestStatus, aJ as Permission, aK as PostTransactionData, aL as RegisterPaymentInput, aM as RegisterPaymentOutput, aN as ReleaseChannelPerCommitmentSecretInput, aO as ReleaseChannelPerCommitmentSecretOutput, aP as ReleasePaymentPreimageInput, aQ as ReleasePaymentPreimageOutput, aR as RemoteSigningSubEventType, aS as RequestWithdrawalInput, aT as RequestWithdrawalOutput, aU as RichText, aV as RiskRating, aW as RoutingTransaction, aY as RoutingTransactionFailureReason, aZ as ScreenNodeInput, a_ as ScreenNodeOutput, a$ as Secret, b0 as SendPaymentInput, b1 as SendPaymentOutput, b2 as SetInvoicePaymentHashInput, b3 as SetInvoicePaymentHashOutput, b9 as SignInvoiceInput, ba as SignInvoiceOutput, bb as SignMessagesInput, bc as SignMessagesOutput, b4 as Signable, b6 as SignablePayload, b8 as SignablePayloadStatus, bd as SingleNodeDashboard, be as Transaction, bg as TransactionFailures, bh as TransactionStatus, bi as TransactionType, bj as TransactionUpdate, bk as UpdateChannelPerCommitmentPointInput, bl as UpdateChannelPerCommitmentPointOutput, bm as UpdateNodeSharedSecretInput, bn as UpdateNodeSharedSecretOutput, bo as Wallet, bp as WalletStatus, bq as WalletToPaymentRequestsConnection, br as WalletToTransactionsConnection, bs as Withdrawal, bu as WithdrawalMode, bv as WithdrawalRequest, bw as WithdrawalRequestStatus, bx as WithdrawalRequestToChannelClosingTransactionsConnection, by as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, Q as getDepositQuery, Y as getHopQuery, a1 as getIncomingPaymentAttemptQuery, a5 as getInvoiceQuery, ac as getLightningTransactionQuery, ag as getLightsparkNodeOwnerQuery, ae as getLightsparkNodeQuery, am as getNodeQuery, ar as getOnChainTransactionQuery, aF as getPaymentRequestQuery, aX as getRoutingTransactionQuery, b7 as getSignablePayloadQuery, b5 as getSignableQuery, bf as getTransactionQuery, bt as getWithdrawalQuery } from './index-5acc6526.js';
|
|
4
|
+
import { B as BitcoinNetwork } from './BitcoinNetwork-a816c0be.js';
|
|
5
|
+
import 'zen-observable';
|
|
6
|
+
|
|
7
|
+
declare class AccountTokenAuthProvider implements AuthProvider {
|
|
8
|
+
private readonly apiTokenClientId;
|
|
9
|
+
private readonly apiTokenClientSecret;
|
|
10
|
+
private readonly utf8AuthBytes;
|
|
11
|
+
constructor(apiTokenClientId: string, apiTokenClientSecret: string);
|
|
12
|
+
addWsConnectionParams(params: Record<string, string>): Promise<Record<string, string>>;
|
|
13
|
+
addAuthHeaders(headers: Record<string, string>): Promise<Record<string, string>>;
|
|
14
|
+
isAuthorized(): Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const isBitcoinNetwork: (bitcoinNetwork: BitcoinNetwork) => boolean;
|
|
18
|
+
declare const assertValidBitcoinNetwork: (bitcoinNetwork: BitcoinNetwork) => void;
|
|
19
|
+
declare const getBitcoinNetworkOrThrow: (bitcoinNetwork: BitcoinNetwork) => BitcoinNetwork;
|
|
20
|
+
|
|
21
|
+
declare const WEBHOOKS_SIGNATURE_HEADER = "lightspark-signature";
|
|
22
|
+
interface WebhookEvent {
|
|
23
|
+
event_type: WebhookEventType;
|
|
24
|
+
event_id: string;
|
|
25
|
+
timestamp: Date;
|
|
26
|
+
entity_id: string;
|
|
27
|
+
wallet_id?: string;
|
|
28
|
+
}
|
|
29
|
+
declare const verifyAndParseWebhook: (data: Uint8Array, hexdigest: string, webhook_secret: string) => Promise<WebhookEvent>;
|
|
30
|
+
type Validator = {
|
|
31
|
+
should_sign: (event: WebhookEvent) => boolean;
|
|
32
|
+
};
|
|
33
|
+
declare class RemoteSigningWebhookHandler {
|
|
34
|
+
#private;
|
|
35
|
+
client: LightsparkClient;
|
|
36
|
+
validator: Validator;
|
|
37
|
+
constructor(client: LightsparkClient, masterSeed: Uint8Array, validator: Validator);
|
|
38
|
+
handleWebhookRequest(data: Uint8Array, webhookSignature: string, webhookSecret: string): Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { AccountTokenAuthProvider, BitcoinNetwork, LightsparkClient, RemoteSigningWebhookHandler, WEBHOOKS_SIGNATURE_HEADER, WebhookEvent, WebhookEventType, assertValidBitcoinNetwork, getBitcoinNetworkOrThrow, isBitcoinNetwork, verifyAndParseWebhook };
|
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 ChannelSnapshot, p as ChannelStatus, q as ChannelToTransactionsConnection, r as ComplianceProvider, s as Connection, t as CreateApiTokenInput, u as CreateApiTokenOutput, v as CreateInvoiceInput, w as CreateInvoiceOutput, x as CreateLnurlInvoiceInput, y as CreateNodeWalletAddressInput, z as CreateNodeWalletAddressOutput, D as CreateTestModeInvoiceInput, E as CreateTestModeInvoiceOutput, F as CreateTestModePaymentInput, G as CreateTestModePaymentoutput, H as CreateUmaInvoiceInput, I as CurrencyAmount, J as CurrencyUnit, K as DeclineToSignMessagesInput, M as DeclineToSignMessagesOutput, N as DeleteApiTokenInput, O as DeleteApiTokenOutput, P as Deposit, R as Entity, S as FeeEstimate, T as FundNodeInput, U as FundNodeOutput, V as GraphNode, X as Hop, Z as HtlcAttemptFailureCode, _ as IdAndSignature, $ as IncomingPayment, a0 as IncomingPaymentAttempt, a2 as IncomingPaymentAttemptStatus, a3 as IncomingPaymentToAttemptsConnection, a4 as Invoice, a6 as InvoiceData, a7 as InvoiceType, a8 as LightningFeeEstimateForInvoiceInput, a9 as LightningFeeEstimateForNodeInput, aa as LightningFeeEstimateOutput, ab as LightningTransaction, ad as LightsparkNode,
|
|
2
|
+
import { W as WebhookEventType, L as LightsparkClient } from './index-5acc6526.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 ChannelSnapshot, p as ChannelStatus, q as ChannelToTransactionsConnection, r as ComplianceProvider, s as Connection, t as CreateApiTokenInput, u as CreateApiTokenOutput, v as CreateInvoiceInput, w as CreateInvoiceOutput, x as CreateLnurlInvoiceInput, y as CreateNodeWalletAddressInput, z as CreateNodeWalletAddressOutput, D as CreateTestModeInvoiceInput, E as CreateTestModeInvoiceOutput, F as CreateTestModePaymentInput, G as CreateTestModePaymentoutput, H as CreateUmaInvoiceInput, I as CurrencyAmount, J as CurrencyUnit, K as DeclineToSignMessagesInput, M as DeclineToSignMessagesOutput, N as DeleteApiTokenInput, O as DeleteApiTokenOutput, P as Deposit, R as Entity, S as FeeEstimate, T as FundNodeInput, U as FundNodeOutput, V as GraphNode, X as Hop, Z as HtlcAttemptFailureCode, _ as IdAndSignature, $ as IncomingPayment, a0 as IncomingPaymentAttempt, a2 as IncomingPaymentAttemptStatus, a3 as IncomingPaymentToAttemptsConnection, a4 as Invoice, a6 as InvoiceData, a7 as InvoiceType, a8 as LightningFeeEstimateForInvoiceInput, a9 as LightningFeeEstimateForNodeInput, aa as LightningFeeEstimateOutput, ab as LightningTransaction, ad as LightsparkNode, af as LightsparkNodeOwner, ah as LightsparkNodeStatus, ai as LightsparkNodeToChannelsConnection, aj as LightsparkNodeWithOSK, ak as LightsparkNodeWithRemoteSigning, al as Node, an as NodeAddress, ao as NodeAddressType, ap as NodeToAddressesConnection, aq as OnChainTransaction, as as OutgoingPayment, at as OutgoingPaymentAttempt, au as OutgoingPaymentAttemptStatus, av as OutgoingPaymentAttemptToHopsConnection, ay as OutgoingPaymentToAttemptsConnection, aw as OutgoingPaymentsForInvoiceQueryInput, ax as OutgoingPaymentsForInvoiceQueryOutput, az as PageInfo, aA as PayInvoiceInput, aB as PayInvoiceOutput, aI as PayUmaInvoiceInput, aC as PaymentDirection, aD as PaymentFailureReason, aE as PaymentRequest, aG as PaymentRequestData, aH as PaymentRequestStatus, aJ as Permission, aK as PostTransactionData, aL as RegisterPaymentInput, aM as RegisterPaymentOutput, aN as ReleaseChannelPerCommitmentSecretInput, aO as ReleaseChannelPerCommitmentSecretOutput, aP as ReleasePaymentPreimageInput, aQ as ReleasePaymentPreimageOutput, aR as RemoteSigningSubEventType, aS as RequestWithdrawalInput, aT as RequestWithdrawalOutput, aU as RichText, aV as RiskRating, aW as RoutingTransaction, aY as RoutingTransactionFailureReason, aZ as ScreenNodeInput, a_ as ScreenNodeOutput, a$ as Secret, b0 as SendPaymentInput, b1 as SendPaymentOutput, b2 as SetInvoicePaymentHashInput, b3 as SetInvoicePaymentHashOutput, b9 as SignInvoiceInput, ba as SignInvoiceOutput, bb as SignMessagesInput, bc as SignMessagesOutput, b4 as Signable, b6 as SignablePayload, b8 as SignablePayloadStatus, bd as SingleNodeDashboard, be as Transaction, bg as TransactionFailures, bh as TransactionStatus, bi as TransactionType, bj as TransactionUpdate, bk as UpdateChannelPerCommitmentPointInput, bl as UpdateChannelPerCommitmentPointOutput, bm as UpdateNodeSharedSecretInput, bn as UpdateNodeSharedSecretOutput, bo as Wallet, bp as WalletStatus, bq as WalletToPaymentRequestsConnection, br as WalletToTransactionsConnection, bs as Withdrawal, bu as WithdrawalMode, bv as WithdrawalRequest, bw as WithdrawalRequestStatus, bx as WithdrawalRequestToChannelClosingTransactionsConnection, by as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, Q as getDepositQuery, Y as getHopQuery, a1 as getIncomingPaymentAttemptQuery, a5 as getInvoiceQuery, ac as getLightningTransactionQuery, ag as getLightsparkNodeOwnerQuery, ae as getLightsparkNodeQuery, am as getNodeQuery, ar as getOnChainTransactionQuery, aF as getPaymentRequestQuery, aX as getRoutingTransactionQuery, b7 as getSignablePayloadQuery, b5 as getSignableQuery, bf as getTransactionQuery, bt as getWithdrawalQuery } from './index-5acc6526.js';
|
|
4
4
|
import { B as BitcoinNetwork } from './BitcoinNetwork-a816c0be.js';
|
|
5
5
|
import 'zen-observable';
|
|
6
6
|
|
|
@@ -35,7 +35,7 @@ declare class RemoteSigningWebhookHandler {
|
|
|
35
35
|
client: LightsparkClient;
|
|
36
36
|
validator: Validator;
|
|
37
37
|
constructor(client: LightsparkClient, masterSeed: Uint8Array, validator: Validator);
|
|
38
|
-
handleWebhookRequest(data: Uint8Array, webhookSignature: string, webhookSecret: string):
|
|
38
|
+
handleWebhookRequest(data: Uint8Array, webhookSignature: string, webhookSecret: string): Promise<unknown>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export { AccountTokenAuthProvider, BitcoinNetwork, LightsparkClient, RemoteSigningWebhookHandler, WEBHOOKS_SIGNATURE_HEADER, WebhookEvent, WebhookEventType, assertValidBitcoinNetwork, getBitcoinNetworkOrThrow, isBitcoinNetwork, verifyAndParseWebhook };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
assertValidBitcoinNetwork,
|
|
3
3
|
getBitcoinNetworkOrThrow,
|
|
4
4
|
isBitcoinNetwork
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D32EWIPX.js";
|
|
6
6
|
import {
|
|
7
7
|
AccountToChannelsConnection_default,
|
|
8
8
|
Account_default,
|
|
@@ -36,9 +36,7 @@ import {
|
|
|
36
36
|
LightsparkNodeStatus_default,
|
|
37
37
|
LightsparkNodeWithOSK_default,
|
|
38
38
|
LightsparkNodeWithRemoteSigning_default,
|
|
39
|
-
LightsparkNode_default,
|
|
40
39
|
NodeAddressType_default,
|
|
41
|
-
Node_default,
|
|
42
40
|
OutgoingPaymentAttemptStatus_default,
|
|
43
41
|
OutgoingPaymentAttempt_default,
|
|
44
42
|
OutgoingPaymentFromJson,
|
|
@@ -73,6 +71,8 @@ import {
|
|
|
73
71
|
getInvoiceQuery,
|
|
74
72
|
getLightningTransactionQuery,
|
|
75
73
|
getLightsparkNodeOwnerQuery,
|
|
74
|
+
getLightsparkNodeQuery,
|
|
75
|
+
getNodeQuery,
|
|
76
76
|
getOnChainTransactionQuery,
|
|
77
77
|
getPaymentRequestQuery,
|
|
78
78
|
getRoutingTransactionQuery,
|
|
@@ -80,11 +80,11 @@ import {
|
|
|
80
80
|
getSignableQuery,
|
|
81
81
|
getTransactionQuery,
|
|
82
82
|
getWithdrawalQuery
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-VTPDR6P4.js";
|
|
84
84
|
import {
|
|
85
85
|
BitcoinNetwork_default
|
|
86
86
|
} from "./chunk-K6SAUSAX.js";
|
|
87
|
-
import "./chunk-
|
|
87
|
+
import "./chunk-BMTV3EA2.js";
|
|
88
88
|
|
|
89
89
|
// src/auth/AccountTokenAuthProvider.ts
|
|
90
90
|
import { b64encode } from "@lightsparkdev/core";
|
|
@@ -99,19 +99,23 @@ var AccountTokenAuthProvider = class {
|
|
|
99
99
|
autoBind(this);
|
|
100
100
|
}
|
|
101
101
|
utf8AuthBytes;
|
|
102
|
-
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
addWsConnectionParams(params) {
|
|
103
|
+
return Promise.resolve(
|
|
104
|
+
Object.assign({}, params, {
|
|
105
|
+
client_id: this.apiTokenClientId,
|
|
106
|
+
client_secret: this.apiTokenClientSecret
|
|
107
|
+
})
|
|
108
|
+
);
|
|
107
109
|
}
|
|
108
|
-
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
addAuthHeaders(headers) {
|
|
111
|
+
return Promise.resolve(
|
|
112
|
+
Object.assign({}, headers, {
|
|
113
|
+
authorization: `Basic ${b64encode(this.utf8AuthBytes)}`
|
|
114
|
+
})
|
|
115
|
+
);
|
|
112
116
|
}
|
|
113
|
-
|
|
114
|
-
return true;
|
|
117
|
+
isAuthorized() {
|
|
118
|
+
return Promise.resolve(true);
|
|
115
119
|
}
|
|
116
120
|
};
|
|
117
121
|
var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
|
|
@@ -134,7 +138,7 @@ import {
|
|
|
134
138
|
// package.json
|
|
135
139
|
var package_default = {
|
|
136
140
|
name: "@lightsparkdev/lightspark-sdk",
|
|
137
|
-
version: "1.1
|
|
141
|
+
version: "1.2.1",
|
|
138
142
|
description: "Lightspark JS SDK",
|
|
139
143
|
author: "Lightspark Inc.",
|
|
140
144
|
keywords: [
|
|
@@ -222,7 +226,7 @@ var package_default = {
|
|
|
222
226
|
},
|
|
223
227
|
license: "Apache-2.0",
|
|
224
228
|
dependencies: {
|
|
225
|
-
"@lightsparkdev/core": "1.0.
|
|
229
|
+
"@lightsparkdev/core": "1.0.10",
|
|
226
230
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
227
231
|
"auto-bind": "^5.0.1",
|
|
228
232
|
"crypto-browserify": "^3.12.0",
|
|
@@ -243,11 +247,11 @@ var package_default = {
|
|
|
243
247
|
eslint: "^8.3.0",
|
|
244
248
|
"eslint-watch": "^8.0.0",
|
|
245
249
|
jest: "^29.6.2",
|
|
246
|
-
prettier: "3.0.
|
|
247
|
-
"prettier-plugin-organize-imports": "^3.2.
|
|
250
|
+
prettier: "3.0.3",
|
|
251
|
+
"prettier-plugin-organize-imports": "^3.2.4",
|
|
248
252
|
"ts-jest": "^29.1.1",
|
|
249
253
|
"tsc-absolute": "^1.0.1",
|
|
250
|
-
tsup: "^
|
|
254
|
+
tsup: "^7.2.0",
|
|
251
255
|
typedoc: "^0.24.7",
|
|
252
256
|
typescript: "^4.9.5"
|
|
253
257
|
}
|
|
@@ -1046,7 +1050,8 @@ var LightsparkClient = class {
|
|
|
1046
1050
|
/**
|
|
1047
1051
|
* Constructs a new LightsparkClient.
|
|
1048
1052
|
*
|
|
1049
|
-
* @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider.
|
|
1053
|
+
* @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider.
|
|
1054
|
+
* For server-side
|
|
1050
1055
|
* use, you should use the `AccountTokenAuthProvider`.
|
|
1051
1056
|
* @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
|
|
1052
1057
|
* @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
|
|
@@ -1103,7 +1108,7 @@ var LightsparkClient = class {
|
|
|
1103
1108
|
*
|
|
1104
1109
|
* @param authProvider
|
|
1105
1110
|
*/
|
|
1106
|
-
|
|
1111
|
+
setAuthProvider(authProvider) {
|
|
1107
1112
|
this.requester = new Requester(
|
|
1108
1113
|
this.nodeKeyCache,
|
|
1109
1114
|
this.LIGHTSPARK_SDK_ENDPOINT,
|
|
@@ -1842,7 +1847,7 @@ var verifyAndParseWebhook = async (data, hexdigest, webhook_secret) => {
|
|
|
1842
1847
|
var parseWebhook = async (data) => {
|
|
1843
1848
|
let td = TextDecoder;
|
|
1844
1849
|
if (typeof td === "undefined") {
|
|
1845
|
-
const tdModule = await import("./text-encoding-
|
|
1850
|
+
const tdModule = await import("./text-encoding-26SMKBAQ.js");
|
|
1846
1851
|
td = tdModule.TextDecoder;
|
|
1847
1852
|
}
|
|
1848
1853
|
const dataStr = new td().decode(data);
|
|
@@ -1873,7 +1878,7 @@ var RemoteSigningWebhookHandler = class {
|
|
|
1873
1878
|
this.validator
|
|
1874
1879
|
);
|
|
1875
1880
|
const variables = JSON.parse(response.variables);
|
|
1876
|
-
this.client.executeRawQuery({
|
|
1881
|
+
return this.client.executeRawQuery({
|
|
1877
1882
|
queryPayload: response.query,
|
|
1878
1883
|
variables,
|
|
1879
1884
|
constructObject: (rawData) => rawData
|
|
@@ -1895,11 +1900,9 @@ export {
|
|
|
1895
1900
|
IncomingPaymentAttemptStatus_default as IncomingPaymentAttemptStatus,
|
|
1896
1901
|
InvoiceType_default as InvoiceType,
|
|
1897
1902
|
client_default as LightsparkClient,
|
|
1898
|
-
LightsparkNode_default as LightsparkNode,
|
|
1899
1903
|
LightsparkNodeStatus_default as LightsparkNodeStatus,
|
|
1900
1904
|
LightsparkNodeWithOSK_default as LightsparkNodeWithOSK,
|
|
1901
1905
|
LightsparkNodeWithRemoteSigning_default as LightsparkNodeWithRemoteSigning,
|
|
1902
|
-
Node_default as Node,
|
|
1903
1906
|
NodeAddressType_default as NodeAddressType,
|
|
1904
1907
|
OutgoingPayment_default as OutgoingPayment,
|
|
1905
1908
|
OutgoingPaymentAttempt_default as OutgoingPaymentAttempt,
|
|
@@ -1933,6 +1936,8 @@ export {
|
|
|
1933
1936
|
getInvoiceQuery,
|
|
1934
1937
|
getLightningTransactionQuery,
|
|
1935
1938
|
getLightsparkNodeOwnerQuery,
|
|
1939
|
+
getLightsparkNodeQuery,
|
|
1940
|
+
getNodeQuery,
|
|
1936
1941
|
getOnChainTransactionQuery,
|
|
1937
1942
|
getPaymentRequestQuery,
|
|
1938
1943
|
getRoutingTransactionQuery,
|