@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
|
@@ -0,0 +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 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, W as WebhookEventType, 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';
|
|
2
|
+
export { B as BitcoinNetwork } from '../BitcoinNetwork-a816c0be.js';
|
|
3
|
+
import '@lightsparkdev/core';
|
|
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 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,
|
|
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 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, W as WebhookEventType, 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';
|
|
2
2
|
export { B as BitcoinNetwork } from '../BitcoinNetwork-a816c0be.js';
|
|
3
3
|
import '@lightsparkdev/core';
|
|
4
4
|
import 'zen-observable';
|
package/dist/objects/index.js
CHANGED
|
@@ -13,9 +13,7 @@ import {
|
|
|
13
13
|
LightsparkNodeStatus_default,
|
|
14
14
|
LightsparkNodeWithOSK_default,
|
|
15
15
|
LightsparkNodeWithRemoteSigning_default,
|
|
16
|
-
LightsparkNode_default,
|
|
17
16
|
NodeAddressType_default,
|
|
18
|
-
Node_default,
|
|
19
17
|
OutgoingPaymentAttemptStatus_default,
|
|
20
18
|
OutgoingPaymentAttempt_default,
|
|
21
19
|
OutgoingPayment_default,
|
|
@@ -44,6 +42,8 @@ import {
|
|
|
44
42
|
getInvoiceQuery,
|
|
45
43
|
getLightningTransactionQuery,
|
|
46
44
|
getLightsparkNodeOwnerQuery,
|
|
45
|
+
getLightsparkNodeQuery,
|
|
46
|
+
getNodeQuery,
|
|
47
47
|
getOnChainTransactionQuery,
|
|
48
48
|
getPaymentRequestQuery,
|
|
49
49
|
getRoutingTransactionQuery,
|
|
@@ -51,11 +51,11 @@ import {
|
|
|
51
51
|
getSignableQuery,
|
|
52
52
|
getTransactionQuery,
|
|
53
53
|
getWithdrawalQuery
|
|
54
|
-
} from "../chunk-
|
|
54
|
+
} from "../chunk-VTPDR6P4.js";
|
|
55
55
|
import {
|
|
56
56
|
BitcoinNetwork_default
|
|
57
57
|
} from "../chunk-K6SAUSAX.js";
|
|
58
|
-
import "../chunk-
|
|
58
|
+
import "../chunk-BMTV3EA2.js";
|
|
59
59
|
export {
|
|
60
60
|
Account_default as Account,
|
|
61
61
|
AccountToChannelsConnection_default as AccountToChannelsConnection,
|
|
@@ -69,11 +69,9 @@ export {
|
|
|
69
69
|
IncomingPayment_default as IncomingPayment,
|
|
70
70
|
IncomingPaymentAttemptStatus_default as IncomingPaymentAttemptStatus,
|
|
71
71
|
InvoiceType_default as InvoiceType,
|
|
72
|
-
LightsparkNode_default as LightsparkNode,
|
|
73
72
|
LightsparkNodeStatus_default as LightsparkNodeStatus,
|
|
74
73
|
LightsparkNodeWithOSK_default as LightsparkNodeWithOSK,
|
|
75
74
|
LightsparkNodeWithRemoteSigning_default as LightsparkNodeWithRemoteSigning,
|
|
76
|
-
Node_default as Node,
|
|
77
75
|
NodeAddressType_default as NodeAddressType,
|
|
78
76
|
OutgoingPayment_default as OutgoingPayment,
|
|
79
77
|
OutgoingPaymentAttempt_default as OutgoingPaymentAttempt,
|
|
@@ -103,6 +101,8 @@ export {
|
|
|
103
101
|
getInvoiceQuery,
|
|
104
102
|
getLightningTransactionQuery,
|
|
105
103
|
getLightsparkNodeOwnerQuery,
|
|
104
|
+
getLightsparkNodeQuery,
|
|
105
|
+
getNodeQuery,
|
|
106
106
|
getOnChainTransactionQuery,
|
|
107
107
|
getPaymentRequestQuery,
|
|
108
108
|
getRoutingTransactionQuery,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__commonJS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BMTV3EA2.js";
|
|
4
4
|
|
|
5
5
|
// ../../node_modules/text-encoding/lib/encoding-indexes.js
|
|
6
6
|
var require_encoding_indexes = __commonJS({
|
|
7
7
|
"../../node_modules/text-encoding/lib/encoding-indexes.js"(exports, module) {
|
|
8
|
+
"use strict";
|
|
8
9
|
(function(global) {
|
|
9
10
|
"use strict";
|
|
10
11
|
if (typeof module !== "undefined" && module.exports) {
|
|
@@ -52,6 +53,7 @@ var require_encoding_indexes = __commonJS({
|
|
|
52
53
|
// ../../node_modules/text-encoding/lib/encoding.js
|
|
53
54
|
var require_encoding = __commonJS({
|
|
54
55
|
"../../node_modules/text-encoding/lib/encoding.js"(exports, module) {
|
|
56
|
+
"use strict";
|
|
55
57
|
(function(global) {
|
|
56
58
|
"use strict";
|
|
57
59
|
if (typeof module !== "undefined" && module.exports && !global["encoding-indexes"]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
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.10",
|
|
92
92
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
93
93
|
"auto-bind": "^5.0.1",
|
|
94
94
|
"crypto-browserify": "^3.12.0",
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
"eslint": "^8.3.0",
|
|
110
110
|
"eslint-watch": "^8.0.0",
|
|
111
111
|
"jest": "^29.6.2",
|
|
112
|
-
"prettier": "3.0.
|
|
113
|
-
"prettier-plugin-organize-imports": "^3.2.
|
|
112
|
+
"prettier": "3.0.3",
|
|
113
|
+
"prettier-plugin-organize-imports": "^3.2.4",
|
|
114
114
|
"ts-jest": "^29.1.1",
|
|
115
115
|
"tsc-absolute": "^1.0.1",
|
|
116
|
-
"tsup": "^
|
|
116
|
+
"tsup": "^7.2.0",
|
|
117
117
|
"typedoc": "^0.24.7",
|
|
118
118
|
"typescript": "^4.9.5"
|
|
119
119
|
}
|
|
@@ -17,25 +17,29 @@ class AccountTokenAuthProvider implements AuthProvider {
|
|
|
17
17
|
autoBind(this);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
addWsConnectionParams(
|
|
21
21
|
params: Record<string, string>,
|
|
22
22
|
): Promise<Record<string, string>> {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
return Promise.resolve(
|
|
24
|
+
Object.assign({}, params, {
|
|
25
|
+
client_id: this.apiTokenClientId,
|
|
26
|
+
client_secret: this.apiTokenClientSecret,
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
addAuthHeaders(
|
|
30
32
|
headers: Record<string, string>,
|
|
31
33
|
): Promise<Record<string, string>> {
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
return Promise.resolve(
|
|
35
|
+
Object.assign({}, headers, {
|
|
36
|
+
authorization: `Basic ${b64encode(this.utf8AuthBytes)}`,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
return true;
|
|
41
|
+
isAuthorized(): Promise<boolean> {
|
|
42
|
+
return Promise.resolve(true);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
|
package/src/client.ts
CHANGED
|
@@ -116,7 +116,8 @@ class LightsparkClient {
|
|
|
116
116
|
/**
|
|
117
117
|
* Constructs a new LightsparkClient.
|
|
118
118
|
*
|
|
119
|
-
* @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider.
|
|
119
|
+
* @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider.
|
|
120
|
+
* For server-side
|
|
120
121
|
* use, you should use the `AccountTokenAuthProvider`.
|
|
121
122
|
* @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
|
|
122
123
|
* @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
|
|
@@ -179,7 +180,7 @@ class LightsparkClient {
|
|
|
179
180
|
*
|
|
180
181
|
* @param authProvider
|
|
181
182
|
*/
|
|
182
|
-
public
|
|
183
|
+
public setAuthProvider(authProvider: AuthProvider) {
|
|
183
184
|
this.requester = new Requester(
|
|
184
185
|
this.nodeKeyCache,
|
|
185
186
|
this.LIGHTSPARK_SDK_ENDPOINT,
|
|
@@ -797,7 +798,7 @@ class LightsparkClient {
|
|
|
797
798
|
* @param transactionId The ID of the transaction to wait for
|
|
798
799
|
* @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
|
|
799
800
|
*/
|
|
800
|
-
public async waitForTransactionComplete(
|
|
801
|
+
public async waitForTransactionComplete<T = Transaction>(
|
|
801
802
|
transactionId: string,
|
|
802
803
|
pollTimeoutSecs = 60,
|
|
803
804
|
) {
|
|
@@ -805,7 +806,7 @@ class LightsparkClient {
|
|
|
805
806
|
const pollMaxTimeouts = (pollTimeoutSecs * 1000) / pollIntervalMs;
|
|
806
807
|
const pollIgnoreErrors = false;
|
|
807
808
|
|
|
808
|
-
const transaction =
|
|
809
|
+
const transaction = await pollUntil(
|
|
809
810
|
() => {
|
|
810
811
|
return this.getTransaction(transactionId);
|
|
811
812
|
},
|
|
@@ -833,9 +834,9 @@ class LightsparkClient {
|
|
|
833
834
|
"Timeout",
|
|
834
835
|
"Timeout waiting for transaction to complete.",
|
|
835
836
|
),
|
|
836
|
-
)
|
|
837
|
+
);
|
|
837
838
|
|
|
838
|
-
return transaction;
|
|
839
|
+
return transaction as T;
|
|
839
840
|
}
|
|
840
841
|
|
|
841
842
|
/**
|
package/src/helpers.ts
CHANGED
|
@@ -18,7 +18,9 @@ export const assertValidBitcoinNetwork = (
|
|
|
18
18
|
): void => {
|
|
19
19
|
if (!isBitcoinNetwork(bitcoinNetwork)) {
|
|
20
20
|
throw new Error(
|
|
21
|
-
`Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS
|
|
21
|
+
`Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS.join(
|
|
22
|
+
", ",
|
|
23
|
+
)}`,
|
|
22
24
|
);
|
|
23
25
|
}
|
|
24
26
|
};
|
package/src/objects/Account.ts
CHANGED
|
@@ -20,19 +20,28 @@ import type BlockchainBalance from "./BlockchainBalance.js";
|
|
|
20
20
|
import { BlockchainBalanceFromJson } from "./BlockchainBalance.js";
|
|
21
21
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
22
22
|
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
23
|
+
import type Entity from "./Entity.js";
|
|
23
24
|
import type LightsparkNodeOwner from "./LightsparkNodeOwner.js";
|
|
24
25
|
import type TransactionFailures from "./TransactionFailures.js";
|
|
25
26
|
import type TransactionStatus from "./TransactionStatus.js";
|
|
26
27
|
import type TransactionType from "./TransactionType.js";
|
|
27
28
|
|
|
28
29
|
/** This is an object representing the connected Lightspark account. You can retrieve this object to see your account information and objects tied to your account. **/
|
|
29
|
-
class Account implements LightsparkNodeOwner {
|
|
30
|
+
class Account implements LightsparkNodeOwner, Entity {
|
|
30
31
|
constructor(
|
|
32
|
+
/**
|
|
33
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
34
|
+
* string.
|
|
35
|
+
**/
|
|
31
36
|
public readonly id: string,
|
|
37
|
+
/** The date and time when the entity was first created. **/
|
|
32
38
|
public readonly createdAt: string,
|
|
39
|
+
/** The date and time when the entity was last updated. **/
|
|
33
40
|
public readonly updatedAt: string,
|
|
41
|
+
/** The typename of the object **/
|
|
34
42
|
public readonly typename: string,
|
|
35
|
-
|
|
43
|
+
/** The name of this account. **/
|
|
44
|
+
public readonly name?: string | undefined,
|
|
36
45
|
) {
|
|
37
46
|
autoBind(this);
|
|
38
47
|
}
|
|
@@ -1758,6 +1767,16 @@ ${FRAGMENT}
|
|
|
1758
1767
|
constructObject: (data: any) => AccountFromJson(data.current_account),
|
|
1759
1768
|
};
|
|
1760
1769
|
}
|
|
1770
|
+
|
|
1771
|
+
public toJson() {
|
|
1772
|
+
return {
|
|
1773
|
+
__typename: "Account",
|
|
1774
|
+
account_id: this.id,
|
|
1775
|
+
account_created_at: this.createdAt,
|
|
1776
|
+
account_updated_at: this.updatedAt,
|
|
1777
|
+
account_name: this.name,
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1761
1780
|
}
|
|
1762
1781
|
|
|
1763
1782
|
export const AccountFromJson = (obj: any): Account => {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type ApiToken from "./ApiToken.js";
|
|
4
|
-
import { ApiTokenFromJson } from "./ApiToken.js";
|
|
5
|
-
import type Connection from "./Connection.js";
|
|
4
|
+
import { ApiTokenFromJson, ApiTokenToJson } from "./ApiToken.js";
|
|
6
5
|
import type PageInfo from "./PageInfo.js";
|
|
7
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
6
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
interface AccountToApiTokensConnection {
|
|
10
9
|
/**
|
|
11
10
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
12
11
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -21,7 +20,7 @@ type AccountToApiTokensConnection = Connection & {
|
|
|
21
20
|
|
|
22
21
|
/** The typename of the object **/
|
|
23
22
|
typename: string;
|
|
24
|
-
}
|
|
23
|
+
}
|
|
25
24
|
|
|
26
25
|
export const AccountToApiTokensConnectionFromJson = (
|
|
27
26
|
obj: any,
|
|
@@ -37,6 +36,18 @@ export const AccountToApiTokensConnectionFromJson = (
|
|
|
37
36
|
typename: "AccountToApiTokensConnection",
|
|
38
37
|
} as AccountToApiTokensConnection;
|
|
39
38
|
};
|
|
39
|
+
export const AccountToApiTokensConnectionToJson = (
|
|
40
|
+
obj: AccountToApiTokensConnection,
|
|
41
|
+
): any => {
|
|
42
|
+
return {
|
|
43
|
+
__typename: "AccountToApiTokensConnection",
|
|
44
|
+
account_to_api_tokens_connection_count: obj.count,
|
|
45
|
+
account_to_api_tokens_connection_page_info: PageInfoToJson(obj.pageInfo),
|
|
46
|
+
account_to_api_tokens_connection_entities: obj.entities.map((e) =>
|
|
47
|
+
ApiTokenToJson(e),
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
40
51
|
|
|
41
52
|
export const FRAGMENT = `
|
|
42
53
|
fragment AccountToApiTokensConnectionFragment on AccountToApiTokensConnection {
|
|
@@ -6,11 +6,25 @@ import { ChannelFromJson } from "./Channel.js";
|
|
|
6
6
|
|
|
7
7
|
class AccountToChannelsConnection {
|
|
8
8
|
constructor(
|
|
9
|
+
/**
|
|
10
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
11
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
12
|
+
**/
|
|
9
13
|
public readonly count: number,
|
|
14
|
+
/** The channels for the current page of this connection. **/
|
|
10
15
|
public readonly entities: Channel[],
|
|
11
16
|
) {
|
|
12
17
|
autoBind(this);
|
|
13
18
|
}
|
|
19
|
+
|
|
20
|
+
public toJson() {
|
|
21
|
+
return {
|
|
22
|
+
account_to_channels_connection_count: this.count,
|
|
23
|
+
account_to_channels_connection_entities: this.entities.map((e) =>
|
|
24
|
+
e.toJson(),
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
14
28
|
}
|
|
15
29
|
|
|
16
30
|
export const AccountToChannelsConnectionFromJson = (
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type Connection from "./Connection.js";
|
|
4
3
|
import type LightsparkNode from "./LightsparkNode.js";
|
|
5
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
LightsparkNodeFromJson,
|
|
6
|
+
LightsparkNodeToJson,
|
|
7
|
+
} from "./LightsparkNode.js";
|
|
6
8
|
import type PageInfo from "./PageInfo.js";
|
|
7
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
9
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
8
10
|
|
|
9
11
|
/** A connection between an account and the nodes it manages. **/
|
|
10
|
-
|
|
12
|
+
interface AccountToNodesConnection {
|
|
11
13
|
/**
|
|
12
14
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
13
15
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -22,7 +24,7 @@ type AccountToNodesConnection = Connection & {
|
|
|
22
24
|
|
|
23
25
|
/** The typename of the object **/
|
|
24
26
|
typename: string;
|
|
25
|
-
}
|
|
27
|
+
}
|
|
26
28
|
|
|
27
29
|
export const AccountToNodesConnectionFromJson = (
|
|
28
30
|
obj: any,
|
|
@@ -36,6 +38,18 @@ export const AccountToNodesConnectionFromJson = (
|
|
|
36
38
|
typename: "AccountToNodesConnection",
|
|
37
39
|
} as AccountToNodesConnection;
|
|
38
40
|
};
|
|
41
|
+
export const AccountToNodesConnectionToJson = (
|
|
42
|
+
obj: AccountToNodesConnection,
|
|
43
|
+
): any => {
|
|
44
|
+
return {
|
|
45
|
+
__typename: "AccountToNodesConnection",
|
|
46
|
+
account_to_nodes_connection_count: obj.count,
|
|
47
|
+
account_to_nodes_connection_page_info: PageInfoToJson(obj.pageInfo),
|
|
48
|
+
account_to_nodes_connection_entities: obj.entities.map((e) =>
|
|
49
|
+
LightsparkNodeToJson(e),
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
39
53
|
|
|
40
54
|
export const FRAGMENT = `
|
|
41
55
|
fragment AccountToNodesConnectionFragment on AccountToNodesConnection {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type Connection from "./Connection.js";
|
|
4
3
|
import type PageInfo from "./PageInfo.js";
|
|
5
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
4
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
6
5
|
import type PaymentRequest from "./PaymentRequest.js";
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
PaymentRequestFromJson,
|
|
8
|
+
PaymentRequestToJson,
|
|
9
|
+
} from "./PaymentRequest.js";
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
interface AccountToPaymentRequestsConnection {
|
|
10
12
|
/**
|
|
11
13
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
12
14
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -21,7 +23,7 @@ type AccountToPaymentRequestsConnection = Connection & {
|
|
|
21
23
|
|
|
22
24
|
/** The typename of the object **/
|
|
23
25
|
typename: string;
|
|
24
|
-
}
|
|
26
|
+
}
|
|
25
27
|
|
|
26
28
|
export const AccountToPaymentRequestsConnectionFromJson = (
|
|
27
29
|
obj: any,
|
|
@@ -37,6 +39,20 @@ export const AccountToPaymentRequestsConnectionFromJson = (
|
|
|
37
39
|
typename: "AccountToPaymentRequestsConnection",
|
|
38
40
|
} as AccountToPaymentRequestsConnection;
|
|
39
41
|
};
|
|
42
|
+
export const AccountToPaymentRequestsConnectionToJson = (
|
|
43
|
+
obj: AccountToPaymentRequestsConnection,
|
|
44
|
+
): any => {
|
|
45
|
+
return {
|
|
46
|
+
__typename: "AccountToPaymentRequestsConnection",
|
|
47
|
+
account_to_payment_requests_connection_count: obj.count,
|
|
48
|
+
account_to_payment_requests_connection_page_info: PageInfoToJson(
|
|
49
|
+
obj.pageInfo,
|
|
50
|
+
),
|
|
51
|
+
account_to_payment_requests_connection_entities: obj.entities.map((e) =>
|
|
52
|
+
PaymentRequestToJson(e),
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
};
|
|
40
56
|
|
|
41
57
|
export const FRAGMENT = `
|
|
42
58
|
fragment AccountToPaymentRequestsConnectionFragment on AccountToPaymentRequestsConnection {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type Connection from "./Connection.js";
|
|
4
3
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CurrencyAmountFromJson,
|
|
6
|
+
CurrencyAmountToJson,
|
|
7
|
+
} from "./CurrencyAmount.js";
|
|
6
8
|
import type PageInfo from "./PageInfo.js";
|
|
7
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
9
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
8
10
|
import type Transaction from "./Transaction.js";
|
|
9
|
-
import { TransactionFromJson } from "./Transaction.js";
|
|
11
|
+
import { TransactionFromJson, TransactionToJson } from "./Transaction.js";
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
interface AccountToTransactionsConnection {
|
|
12
14
|
/**
|
|
13
15
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
14
16
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -28,20 +30,20 @@ type AccountToTransactionsConnection = Connection & {
|
|
|
28
30
|
* Profit (or loss) generated by the transactions in this connection, with the set of filters and
|
|
29
31
|
* constraints provided.
|
|
30
32
|
**/
|
|
31
|
-
profitLoss?: CurrencyAmount;
|
|
33
|
+
profitLoss?: CurrencyAmount | undefined;
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* Average fee earned for the transactions in this connection, with the set of filters and constraints
|
|
35
37
|
* provided.
|
|
36
38
|
**/
|
|
37
|
-
averageFeeEarned?: CurrencyAmount;
|
|
39
|
+
averageFeeEarned?: CurrencyAmount | undefined;
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* Total amount transacted by the transactions in this connection, with the set of filters and
|
|
41
43
|
* constraints provided.
|
|
42
44
|
**/
|
|
43
|
-
totalAmountTransacted?: CurrencyAmount;
|
|
44
|
-
}
|
|
45
|
+
totalAmountTransacted?: CurrencyAmount | undefined;
|
|
46
|
+
}
|
|
45
47
|
|
|
46
48
|
export const AccountToTransactionsConnectionFromJson = (
|
|
47
49
|
obj: any,
|
|
@@ -76,6 +78,28 @@ export const AccountToTransactionsConnectionFromJson = (
|
|
|
76
78
|
: undefined,
|
|
77
79
|
} as AccountToTransactionsConnection;
|
|
78
80
|
};
|
|
81
|
+
export const AccountToTransactionsConnectionToJson = (
|
|
82
|
+
obj: AccountToTransactionsConnection,
|
|
83
|
+
): any => {
|
|
84
|
+
return {
|
|
85
|
+
__typename: "AccountToTransactionsConnection",
|
|
86
|
+
account_to_transactions_connection_count: obj.count,
|
|
87
|
+
account_to_transactions_connection_page_info: PageInfoToJson(obj.pageInfo),
|
|
88
|
+
account_to_transactions_connection_profit_loss: obj.profitLoss
|
|
89
|
+
? CurrencyAmountToJson(obj.profitLoss)
|
|
90
|
+
: undefined,
|
|
91
|
+
account_to_transactions_connection_average_fee_earned: obj.averageFeeEarned
|
|
92
|
+
? CurrencyAmountToJson(obj.averageFeeEarned)
|
|
93
|
+
: undefined,
|
|
94
|
+
account_to_transactions_connection_total_amount_transacted:
|
|
95
|
+
obj.totalAmountTransacted
|
|
96
|
+
? CurrencyAmountToJson(obj.totalAmountTransacted)
|
|
97
|
+
: undefined,
|
|
98
|
+
account_to_transactions_connection_entities: obj.entities.map((e) =>
|
|
99
|
+
TransactionToJson(e),
|
|
100
|
+
),
|
|
101
|
+
};
|
|
102
|
+
};
|
|
79
103
|
|
|
80
104
|
export const FRAGMENT = `
|
|
81
105
|
fragment AccountToTransactionsConnectionFragment on AccountToTransactionsConnection {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import type Connection from "./Connection.js";
|
|
4
3
|
import type PageInfo from "./PageInfo.js";
|
|
5
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
4
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
6
5
|
import type Wallet from "./Wallet.js";
|
|
7
6
|
import { WalletFromJson } from "./Wallet.js";
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
interface AccountToWalletsConnection {
|
|
10
9
|
/**
|
|
11
10
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
12
11
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -21,7 +20,7 @@ type AccountToWalletsConnection = Connection & {
|
|
|
21
20
|
|
|
22
21
|
/** The typename of the object **/
|
|
23
22
|
typename: string;
|
|
24
|
-
}
|
|
23
|
+
}
|
|
25
24
|
|
|
26
25
|
export const AccountToWalletsConnectionFromJson = (
|
|
27
26
|
obj: any,
|
|
@@ -35,6 +34,16 @@ export const AccountToWalletsConnectionFromJson = (
|
|
|
35
34
|
typename: "AccountToWalletsConnection",
|
|
36
35
|
} as AccountToWalletsConnection;
|
|
37
36
|
};
|
|
37
|
+
export const AccountToWalletsConnectionToJson = (
|
|
38
|
+
obj: AccountToWalletsConnection,
|
|
39
|
+
): any => {
|
|
40
|
+
return {
|
|
41
|
+
__typename: "AccountToWalletsConnection",
|
|
42
|
+
account_to_wallets_connection_count: obj.count,
|
|
43
|
+
account_to_wallets_connection_page_info: PageInfoToJson(obj.pageInfo),
|
|
44
|
+
account_to_wallets_connection_entities: obj.entities.map((e) => e.toJson()),
|
|
45
|
+
};
|
|
46
|
+
};
|
|
38
47
|
|
|
39
48
|
export const FRAGMENT = `
|
|
40
49
|
fragment AccountToWalletsConnectionFragment on AccountToWalletsConnection {
|
package/src/objects/ApiToken.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
|
-
import type Entity from "./Entity.js";
|
|
5
4
|
import Permission from "./Permission.js";
|
|
6
5
|
|
|
7
6
|
/** This is an object representing a Lightspark API token, that can be used to authenticate this account when making API calls or using our SDKs. See the “Authentication” section of our API docs for more details on its usage. **/
|
|
8
|
-
|
|
7
|
+
interface ApiToken {
|
|
9
8
|
/**
|
|
10
9
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
11
10
|
* string.
|
|
@@ -35,7 +34,7 @@ type ApiToken = Entity & {
|
|
|
35
34
|
|
|
36
35
|
/** The typename of the object **/
|
|
37
36
|
typename: string;
|
|
38
|
-
}
|
|
37
|
+
}
|
|
39
38
|
|
|
40
39
|
export const ApiTokenFromJson = (obj: any): ApiToken => {
|
|
41
40
|
return {
|
|
@@ -48,6 +47,17 @@ export const ApiTokenFromJson = (obj: any): ApiToken => {
|
|
|
48
47
|
typename: "ApiToken",
|
|
49
48
|
} as ApiToken;
|
|
50
49
|
};
|
|
50
|
+
export const ApiTokenToJson = (obj: ApiToken): any => {
|
|
51
|
+
return {
|
|
52
|
+
__typename: "ApiToken",
|
|
53
|
+
api_token_id: obj.id,
|
|
54
|
+
api_token_created_at: obj.createdAt,
|
|
55
|
+
api_token_updated_at: obj.updatedAt,
|
|
56
|
+
api_token_client_id: obj.clientId,
|
|
57
|
+
api_token_name: obj.name,
|
|
58
|
+
api_token_permissions: obj.permissions,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
51
61
|
|
|
52
62
|
export const FRAGMENT = `
|
|
53
63
|
fragment ApiTokenFragment on ApiToken {
|
package/src/objects/Balances.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CurrencyAmountFromJson,
|
|
6
|
+
CurrencyAmountToJson,
|
|
7
|
+
} from "./CurrencyAmount.js";
|
|
5
8
|
|
|
6
9
|
/** This is an object representing the balance associated with your Lightspark account. You can retrieve this object to see your balance, which can be broken down into several different categorizations. **/
|
|
7
|
-
|
|
10
|
+
interface Balances {
|
|
8
11
|
/**
|
|
9
12
|
* This represents the balance that should be displayed when asked "how much do I own right now?". It
|
|
10
13
|
* represents the amount currently owned, including things that may not be owned soon (e.g. in-flight
|
|
@@ -27,7 +30,7 @@ type Balances = {
|
|
|
27
30
|
* likely succeed and therefore likely make your withdrawal fail).
|
|
28
31
|
**/
|
|
29
32
|
availableToWithdrawBalance: CurrencyAmount;
|
|
30
|
-
}
|
|
33
|
+
}
|
|
31
34
|
|
|
32
35
|
export const BalancesFromJson = (obj: any): Balances => {
|
|
33
36
|
return {
|
|
@@ -40,6 +43,17 @@ export const BalancesFromJson = (obj: any): Balances => {
|
|
|
40
43
|
),
|
|
41
44
|
} as Balances;
|
|
42
45
|
};
|
|
46
|
+
export const BalancesToJson = (obj: Balances): any => {
|
|
47
|
+
return {
|
|
48
|
+
balances_owned_balance: CurrencyAmountToJson(obj.ownedBalance),
|
|
49
|
+
balances_available_to_send_balance: CurrencyAmountToJson(
|
|
50
|
+
obj.availableToSendBalance,
|
|
51
|
+
),
|
|
52
|
+
balances_available_to_withdraw_balance: CurrencyAmountToJson(
|
|
53
|
+
obj.availableToWithdrawBalance,
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
};
|
|
43
57
|
|
|
44
58
|
export const FRAGMENT = `
|
|
45
59
|
fragment BalancesFragment on Balances {
|