@lightsparkdev/lightspark-sdk 0.4.9 → 0.4.11
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 +14 -0
- package/dist/{chunk-YTXDF6SQ.js → chunk-NXUFC5J7.js} +950 -246
- package/dist/{index-adeff42d.d.ts → index-3ffe9e7b.d.ts} +194 -56
- package/dist/index.cjs +963 -254
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -9
- package/dist/objects/index.cjs +952 -246
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +5 -1
- package/package.json +4 -4
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/auth/AccountTokenAuthProvider.ts +4 -4
- package/src/client.ts +62 -63
- package/src/objects/Account.ts +46 -40
- package/src/objects/AccountToApiTokensConnection.ts +14 -9
- package/src/objects/AccountToChannelsConnection.ts +4 -4
- package/src/objects/AccountToNodesConnection.ts +13 -8
- package/src/objects/AccountToPaymentRequestsConnection.ts +22 -17
- package/src/objects/AccountToTransactionsConnection.ts +24 -19
- package/src/objects/AccountToWalletsConnection.ts +13 -8
- package/src/objects/ApiToken.ts +2 -1
- package/src/objects/Balances.ts +3 -2
- package/src/objects/BitcoinNetwork.ts +2 -1
- package/src/objects/BlockchainBalance.ts +1 -1
- package/src/objects/Channel.ts +6 -6
- package/src/objects/ChannelClosingTransaction.ts +4 -4
- package/src/objects/ChannelFees.ts +1 -0
- package/src/objects/ChannelOpeningTransaction.ts +4 -4
- package/src/objects/ChannelStatus.ts +1 -0
- package/src/objects/ChannelToTransactionsConnection.ts +4 -4
- package/src/objects/Connection.ts +387 -0
- package/src/objects/CreateApiTokenInput.ts +1 -1
- package/src/objects/CreateApiTokenOutput.ts +1 -1
- package/src/objects/CreateInvoiceInput.ts +12 -0
- package/src/objects/CreateLnurlInvoiceInput.ts +11 -1
- package/src/objects/CreateNodeWalletAddressInput.ts +1 -1
- package/src/objects/CreateNodeWalletAddressOutput.ts +1 -1
- package/src/objects/CreateTestModeInvoiceInput.ts +1 -1
- package/src/objects/CreateTestModeInvoiceOutput.ts +1 -1
- package/src/objects/CreateTestModePaymentInput.ts +1 -1
- package/src/objects/CreateTestModePaymentoutput.ts +2 -1
- package/src/objects/CryptoSanctionsScreeningProvider.ts +14 -0
- package/src/objects/CurrencyAmount.ts +1 -1
- package/src/objects/CurrencyUnit.ts +1 -0
- package/src/objects/DeleteApiTokenOutput.ts +1 -1
- package/src/objects/Deposit.ts +2 -2
- package/src/objects/Entity.ts +1 -1
- package/src/objects/FeeEstimate.ts +1 -0
- package/src/objects/GraphNode.ts +5 -5
- package/src/objects/Hop.ts +2 -2
- package/src/objects/HtlcAttemptFailureCode.ts +1 -0
- package/src/objects/IncomingPayment.ts +21 -8
- package/src/objects/IncomingPaymentAttempt.ts +4 -4
- package/src/objects/IncomingPaymentAttemptStatus.ts +1 -1
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +23 -3
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/InvoiceData.ts +1 -1
- package/src/objects/InvoiceType.ts +1 -0
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +1 -1
- package/src/objects/LightningFeeEstimateForNodeInput.ts +1 -1
- package/src/objects/LightningFeeEstimateOutput.ts +2 -2
- package/src/objects/LightningTransaction.ts +8 -8
- package/src/objects/LightsparkNode.ts +15 -9
- package/src/objects/LightsparkNodeOwner.ts +6 -6
- package/src/objects/LightsparkNodePurpose.ts +1 -0
- package/src/objects/LightsparkNodeToChannelsConnection.ts +14 -9
- package/src/objects/Node.ts +7 -8
- package/src/objects/NodeAddress.ts +1 -1
- package/src/objects/NodeAddressType.ts +1 -1
- package/src/objects/NodeToAddressesConnection.ts +2 -2
- package/src/objects/OnChainTransaction.ts +4 -5
- package/src/objects/OutgoingPayment.ts +16 -8
- package/src/objects/OutgoingPaymentAttempt.ts +18 -10
- package/src/objects/OutgoingPaymentAttemptStatus.ts +1 -1
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +23 -3
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +23 -3
- package/src/objects/PageInfo.ts +1 -0
- package/src/objects/PaymentFailureReason.ts +1 -0
- package/src/objects/PaymentRequest.ts +3 -3
- package/src/objects/PaymentRequestData.ts +2 -2
- package/src/objects/PaymentRequestStatus.ts +1 -0
- package/src/objects/Permission.ts +1 -0
- package/src/objects/RequestWithdrawalInput.ts +1 -1
- package/src/objects/RequestWithdrawalOutput.ts +1 -1
- package/src/objects/RiskRating.ts +18 -0
- package/src/objects/RoutingTransaction.ts +3 -3
- package/src/objects/RoutingTransactionFailureReason.ts +1 -0
- package/src/objects/ScreenBitcoinAddressesInput.ts +23 -0
- package/src/objects/ScreenBitcoinAddressesOutput.ts +25 -0
- package/src/objects/Transaction.ts +6 -6
- package/src/objects/TransactionFailures.ts +2 -1
- package/src/objects/TransactionStatus.ts +1 -0
- package/src/objects/TransactionType.ts +1 -0
- package/src/objects/Wallet.ts +636 -11
- package/src/objects/WalletStatus.ts +1 -0
- package/src/objects/WalletToPaymentRequestsConnection.ts +57 -0
- package/src/objects/WalletToTransactionsConnection.ts +57 -0
- package/src/objects/WebhookEventType.ts +3 -0
- package/src/objects/Withdrawal.ts +2 -2
- package/src/objects/WithdrawalMode.ts +1 -0
- package/src/objects/WithdrawalRequest.ts +8 -7
- package/src/objects/WithdrawalRequestStatus.ts +1 -0
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +2 -2
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +2 -2
- package/src/objects/index.ts +7 -0
- package/src/webhooks.ts +1 -1
- package/src/objects/.eslintrc.cjs +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
5
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
6
6
|
import type Entity from "./Entity.js";
|
|
@@ -11,7 +11,7 @@ import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.j
|
|
|
11
11
|
import type Transaction from "./Transaction.js";
|
|
12
12
|
import TransactionStatus from "./TransactionStatus.js";
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/** This object represents a transaction that was forwarded through a Lightspark node on the Lightning Network, i.e., a routed transaction. You can retrieve this object to receive information about any transaction routed through your Lightspark Node. **/
|
|
15
15
|
type RoutingTransaction = LightningTransaction &
|
|
16
16
|
Transaction &
|
|
17
17
|
Entity & {
|
|
@@ -130,7 +130,7 @@ fragment RoutingTransactionFragment on RoutingTransaction {
|
|
|
130
130
|
}`;
|
|
131
131
|
|
|
132
132
|
export const getRoutingTransactionQuery = (
|
|
133
|
-
id: string
|
|
133
|
+
id: string,
|
|
134
134
|
): Query<RoutingTransaction> => {
|
|
135
135
|
return {
|
|
136
136
|
queryPayload: `
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum of the potential reasons that an attempted routed transaction through a Lightspark node may have failed. **/
|
|
3
4
|
export enum RoutingTransactionFailureReason {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import CryptoSanctionsScreeningProvider from "./CryptoSanctionsScreeningProvider.js";
|
|
4
|
+
|
|
5
|
+
type ScreenBitcoinAddressesInput = {
|
|
6
|
+
provider: CryptoSanctionsScreeningProvider;
|
|
7
|
+
|
|
8
|
+
addresses: string[];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const ScreenBitcoinAddressesInputFromJson = (
|
|
12
|
+
obj: any,
|
|
13
|
+
): ScreenBitcoinAddressesInput => {
|
|
14
|
+
return {
|
|
15
|
+
provider:
|
|
16
|
+
CryptoSanctionsScreeningProvider[
|
|
17
|
+
obj["screen_bitcoin_addresses_input_provider"]
|
|
18
|
+
] ?? CryptoSanctionsScreeningProvider.FUTURE_VALUE,
|
|
19
|
+
addresses: obj["screen_bitcoin_addresses_input_addresses"],
|
|
20
|
+
} as ScreenBitcoinAddressesInput;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default ScreenBitcoinAddressesInput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import RiskRating from "./RiskRating.js";
|
|
4
|
+
|
|
5
|
+
type ScreenBitcoinAddressesOutput = {
|
|
6
|
+
ratings: RiskRating[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const ScreenBitcoinAddressesOutputFromJson = (
|
|
10
|
+
obj: any,
|
|
11
|
+
): ScreenBitcoinAddressesOutput => {
|
|
12
|
+
return {
|
|
13
|
+
ratings: obj["screen_bitcoin_addresses_output_ratings"].map(
|
|
14
|
+
(e) => RiskRating[e],
|
|
15
|
+
),
|
|
16
|
+
} as ScreenBitcoinAddressesOutput;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const FRAGMENT = `
|
|
20
|
+
fragment ScreenBitcoinAddressesOutputFragment on ScreenBitcoinAddressesOutput {
|
|
21
|
+
__typename
|
|
22
|
+
screen_bitcoin_addresses_output_ratings: ratings
|
|
23
|
+
}`;
|
|
24
|
+
|
|
25
|
+
export default ScreenBitcoinAddressesOutput;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import { LightsparkException } from "@lightsparkdev/core";
|
|
3
|
+
import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
5
4
|
import type ChannelClosingTransaction from "./ChannelClosingTransaction.js";
|
|
6
5
|
import type ChannelOpeningTransaction from "./ChannelOpeningTransaction.js";
|
|
7
6
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
@@ -18,6 +17,7 @@ import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.j
|
|
|
18
17
|
import TransactionStatus from "./TransactionStatus.js";
|
|
19
18
|
import type Withdrawal from "./Withdrawal.js";
|
|
20
19
|
|
|
20
|
+
/** This object represents a payment transaction. The transaction can occur either on a Bitcoin Network, or over the Lightning Network. You can retrieve this object to receive specific information about a particular transaction tied to your Lightspark Node. **/
|
|
21
21
|
type Transaction = Entity & {
|
|
22
22
|
/**
|
|
23
23
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
@@ -129,7 +129,7 @@ export const TransactionFromJson = (obj: any): Transaction => {
|
|
|
129
129
|
obj["incoming_payment_resolved_at"],
|
|
130
130
|
obj["incoming_payment_transaction_hash"],
|
|
131
131
|
obj["incoming_payment_origin"]?.id ?? undefined,
|
|
132
|
-
obj["incoming_payment_payment_request"]?.id ?? undefined
|
|
132
|
+
obj["incoming_payment_payment_request"]?.id ?? undefined,
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
if (obj["__typename"] == "OutgoingPayment") {
|
|
@@ -150,7 +150,7 @@ export const TransactionFromJson = (obj: any): Transaction => {
|
|
|
150
150
|
: undefined,
|
|
151
151
|
!!obj["outgoing_payment_payment_request_data"]
|
|
152
152
|
? PaymentRequestDataFromJson(
|
|
153
|
-
obj["outgoing_payment_payment_request_data"]
|
|
153
|
+
obj["outgoing_payment_payment_request_data"],
|
|
154
154
|
)
|
|
155
155
|
: undefined,
|
|
156
156
|
!!obj["outgoing_payment_failure_reason"]
|
|
@@ -159,7 +159,7 @@ export const TransactionFromJson = (obj: any): Transaction => {
|
|
|
159
159
|
: null,
|
|
160
160
|
!!obj["outgoing_payment_failure_message"]
|
|
161
161
|
? RichTextFromJson(obj["outgoing_payment_failure_message"])
|
|
162
|
-
: undefined
|
|
162
|
+
: undefined,
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
165
|
if (obj["__typename"] == "RoutingTransaction") {
|
|
@@ -215,7 +215,7 @@ export const TransactionFromJson = (obj: any): Transaction => {
|
|
|
215
215
|
}
|
|
216
216
|
throw new LightsparkException(
|
|
217
217
|
"DeserializationError",
|
|
218
|
-
`Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}
|
|
218
|
+
`Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`,
|
|
219
219
|
);
|
|
220
220
|
};
|
|
221
221
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import PaymentFailureReason from "./PaymentFailureReason.js";
|
|
4
4
|
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
5
5
|
|
|
6
|
+
/** This object represents payment failures associated with your Lightspark Node. **/
|
|
6
7
|
type TransactionFailures = {
|
|
7
8
|
paymentFailures?: PaymentFailureReason[];
|
|
8
9
|
|
|
@@ -12,7 +13,7 @@ type TransactionFailures = {
|
|
|
12
13
|
export const TransactionFailuresFromJson = (obj: any): TransactionFailures => {
|
|
13
14
|
return {
|
|
14
15
|
paymentFailures: obj["transaction_failures_payment_failures"]?.map(
|
|
15
|
-
(e) => PaymentFailureReason[e]
|
|
16
|
+
(e) => PaymentFailureReason[e],
|
|
16
17
|
),
|
|
17
18
|
routingTransactionFailures: obj[
|
|
18
19
|
"transaction_failures_routing_transaction_failures"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum of the potential statuses a transaction associated with your Lightspark Node can take. **/
|
|
3
4
|
export enum TransactionStatus {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
+
/** This is an enum of the potential types of transactions that can be associated with your Lightspark Node. **/
|
|
3
4
|
export enum TransactionType {
|
|
4
5
|
/**
|
|
5
6
|
* This is an enum value that represents values that could be added in the future.
|