@lightsparkdev/lightspark-sdk 0.1.6
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/.fossa.yml +6 -0
- package/.prettierrc +1 -0
- package/.turbo/turbo-build.log +19 -0
- package/.turbo/turbo-lint.log +3 -0
- package/CHANGELOG.md +49 -0
- package/LICENSE +201 -0
- package/README.md +137 -0
- package/dist/Withdrawal-17e1c8af.d.ts +1672 -0
- package/dist/Withdrawal-27a4d10d.d.ts +1672 -0
- package/dist/chunk-3VRI7CHE.js +5508 -0
- package/dist/chunk-AGEUDR2V.js +4498 -0
- package/dist/chunk-N27QHRE4.js +5508 -0
- package/dist/client-3bba3f64.d.ts +1302 -0
- package/dist/index.cjs +6633 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +1177 -0
- package/dist/objects/index.cjs +5347 -0
- package/dist/objects/index.d.ts +3 -0
- package/dist/objects/index.js +88 -0
- package/examples/node-scripts/authHelpers.ts +20 -0
- package/examples/node-scripts/createInvoice.ts +64 -0
- package/examples/node-scripts/example.ts +288 -0
- package/examples/node-scripts/getAccountDashboard.ts +24 -0
- package/examples/node-scripts/getNodeChannels.ts +34 -0
- package/examples/node-scripts/internalAuthHelpers.ts +26 -0
- package/examples/node-scripts/internal_example.ts +296 -0
- package/examples/node-scripts/package-lock.json +887 -0
- package/examples/node-scripts/package.json +22 -0
- package/examples/node-scripts/prettyPrintJsonForDocs.ts +62 -0
- package/examples/node-scripts/tsconfig.json +27 -0
- package/examples/oauth-example/README.md +19 -0
- package/examples/oauth-example/package-lock.json +16071 -0
- package/examples/oauth-example/package.json +50 -0
- package/examples/oauth-example/public/favicon.ico +0 -0
- package/examples/oauth-example/public/index.html +43 -0
- package/examples/oauth-example/public/logo192.png +0 -0
- package/examples/oauth-example/public/logo512.png +0 -0
- package/examples/oauth-example/public/manifest.json +25 -0
- package/examples/oauth-example/public/robots.txt +3 -0
- package/examples/oauth-example/src/App.css +7 -0
- package/examples/oauth-example/src/App.test.tsx +12 -0
- package/examples/oauth-example/src/App.tsx +16 -0
- package/examples/oauth-example/src/auth/AuthContext.ts +8 -0
- package/examples/oauth-example/src/auth/AuthProvider.tsx +44 -0
- package/examples/oauth-example/src/auth/RequireAuth.tsx +19 -0
- package/examples/oauth-example/src/auth/oauthProvider.ts +35 -0
- package/examples/oauth-example/src/components/Button.tsx +39 -0
- package/examples/oauth-example/src/components/CurrencyAmount.tsx +117 -0
- package/examples/oauth-example/src/components/Dashboard.tsx +158 -0
- package/examples/oauth-example/src/components/Table.tsx +22 -0
- package/examples/oauth-example/src/hooks/useAccountInfo.tsx +31 -0
- package/examples/oauth-example/src/icons/BitcoinB.tsx +20 -0
- package/examples/oauth-example/src/icons/Icon.tsx +121 -0
- package/examples/oauth-example/src/icons/Satoshi.tsx +28 -0
- package/examples/oauth-example/src/index.css +13 -0
- package/examples/oauth-example/src/index.tsx +23 -0
- package/examples/oauth-example/src/lightsparkclient/LightsparkClientContext.ts +10 -0
- package/examples/oauth-example/src/lightsparkclient/LightsparkClientProvider.tsx +53 -0
- package/examples/oauth-example/src/logo.svg +1 -0
- package/examples/oauth-example/src/pages/DashboardPage.tsx +71 -0
- package/examples/oauth-example/src/pages/LoginPage.tsx +63 -0
- package/examples/oauth-example/src/react-app-env.d.ts +1 -0
- package/examples/oauth-example/src/reportWebVitals.ts +15 -0
- package/examples/oauth-example/src/routes/index.tsx +15 -0
- package/examples/oauth-example/src/setupTests.ts +5 -0
- package/examples/oauth-example/src/utils/currency.ts +483 -0
- package/examples/oauth-example/tsconfig.json +20 -0
- package/examples/streaming-wallet-extension/.fossa.yml +6 -0
- package/examples/streaming-wallet-extension/README.md +17 -0
- package/examples/streaming-wallet-extension/craco.config.js +58 -0
- package/examples/streaming-wallet-extension/package-lock.json +18260 -0
- package/examples/streaming-wallet-extension/package.json +77 -0
- package/examples/streaming-wallet-extension/public/index.html +24 -0
- package/examples/streaming-wallet-extension/public/lightspark_full.png +0 -0
- package/examples/streaming-wallet-extension/public/lightspark_icon_circle.png +0 -0
- package/examples/streaming-wallet-extension/public/manifest.json +43 -0
- package/examples/streaming-wallet-extension/public/robots.txt +3 -0
- package/examples/streaming-wallet-extension/src/App.css +53 -0
- package/examples/streaming-wallet-extension/src/App.tsx +425 -0
- package/examples/streaming-wallet-extension/src/auth/AccountStorage.ts +28 -0
- package/examples/streaming-wallet-extension/src/auth/DemoAccountProvider.ts +99 -0
- package/examples/streaming-wallet-extension/src/auth/StreamingDemoCredentials.ts +10 -0
- package/examples/streaming-wallet-extension/src/background/PaymentStrategy.ts +36 -0
- package/examples/streaming-wallet-extension/src/background/PlaybackRange.ts +31 -0
- package/examples/streaming-wallet-extension/src/background/StreamingInvoiceHolder.ts +33 -0
- package/examples/streaming-wallet-extension/src/background/TransactionObserver.ts +66 -0
- package/examples/streaming-wallet-extension/src/background/VideoPlaybackRanges.ts +38 -0
- package/examples/streaming-wallet-extension/src/background/VideoProgressCache.ts +87 -0
- package/examples/streaming-wallet-extension/src/background/background.ts +145 -0
- package/examples/streaming-wallet-extension/src/background/messageHandling.ts +185 -0
- package/examples/streaming-wallet-extension/src/common/datetimes.ts +28 -0
- package/examples/streaming-wallet-extension/src/common/settings.ts +12 -0
- package/examples/streaming-wallet-extension/src/common/storage.ts +8 -0
- package/examples/streaming-wallet-extension/src/common/streamingTabs.ts +27 -0
- package/examples/streaming-wallet-extension/src/common/types.tsx +23 -0
- package/examples/streaming-wallet-extension/src/components/CirclePlusIcon.tsx +19 -0
- package/examples/streaming-wallet-extension/src/components/CurrencyAmount.tsx +110 -0
- package/examples/streaming-wallet-extension/src/components/CurrencyAmountRaw.tsx +195 -0
- package/examples/streaming-wallet-extension/src/components/LeftArrow.tsx +21 -0
- package/examples/streaming-wallet-extension/src/components/Loading.tsx +151 -0
- package/examples/streaming-wallet-extension/src/components/StreamingTransactionChip.tsx +95 -0
- package/examples/streaming-wallet-extension/src/components/TransactionRow.tsx +93 -0
- package/examples/streaming-wallet-extension/src/contentscript/content.ts +123 -0
- package/examples/streaming-wallet-extension/src/contentscript/lightsparkDemoDom.tsx +113 -0
- package/examples/streaming-wallet-extension/src/contentscript/videoElementParsers.ts +92 -0
- package/examples/streaming-wallet-extension/src/index.css +16 -0
- package/examples/streaming-wallet-extension/src/index.tsx +11 -0
- package/examples/streaming-wallet-extension/src/lightsparkClientProvider.tsx +26 -0
- package/examples/streaming-wallet-extension/src/react-app-env.d.ts +1 -0
- package/examples/streaming-wallet-extension/src/types/Messages.ts +17 -0
- package/examples/streaming-wallet-extension/tsconfig.json +20 -0
- package/package.json +87 -0
- package/src/auth/AccountTokenAuthProvider.ts +37 -0
- package/src/auth/index.ts +3 -0
- package/src/client.ts +759 -0
- package/src/graphql/BitcoinFeeEstimate.ts +13 -0
- package/src/graphql/CreateApiToken.ts +22 -0
- package/src/graphql/CreateInvoice.ts +18 -0
- package/src/graphql/CreateNodeWalletAddress.ts +13 -0
- package/src/graphql/CurrentAccount.ts +13 -0
- package/src/graphql/DecodeInvoice.ts +16 -0
- package/src/graphql/DeleteApiToken.ts +13 -0
- package/src/graphql/FundNode.ts +18 -0
- package/src/graphql/LightningFeeEstimateForInvoice.ts +21 -0
- package/src/graphql/LightningFeeEstimateForNode.ts +21 -0
- package/src/graphql/MultiNodeDashboard.ts +118 -0
- package/src/graphql/PayInvoice.ts +29 -0
- package/src/graphql/RecoverNodeSigningKey.ts +15 -0
- package/src/graphql/RequestWithdrawal.ts +25 -0
- package/src/graphql/SendPayment.ts +29 -0
- package/src/graphql/SingleNodeDashboard.ts +116 -0
- package/src/graphql/TransactionSubscription.ts +16 -0
- package/src/graphql/TransactionsForNode.ts +42 -0
- package/src/index.ts +5 -0
- package/src/objects/Account.ts +1222 -0
- package/src/objects/AccountToApiTokensConnection.ts +50 -0
- package/src/objects/AccountToChannelsConnection.ts +35 -0
- package/src/objects/AccountToNodesConnection.ts +62 -0
- package/src/objects/AccountToPaymentRequestsConnection.ts +50 -0
- package/src/objects/AccountToTransactionsConnection.ts +112 -0
- package/src/objects/ApiToken.ts +80 -0
- package/src/objects/BitcoinNetwork.ts +19 -0
- package/src/objects/BlockchainBalance.ts +102 -0
- package/src/objects/Channel.ts +283 -0
- package/src/objects/ChannelClosingTransaction.ts +150 -0
- package/src/objects/ChannelFees.ts +34 -0
- package/src/objects/ChannelOpeningTransaction.ts +150 -0
- package/src/objects/ChannelStatus.ts +25 -0
- package/src/objects/ChannelToTransactionsConnection.ts +86 -0
- package/src/objects/CreateApiTokenInput.ts +22 -0
- package/src/objects/CreateApiTokenOutput.ts +41 -0
- package/src/objects/CreateInvoiceInput.ts +27 -0
- package/src/objects/CreateInvoiceOutput.ts +21 -0
- package/src/objects/CreateNodeWalletAddressInput.ts +15 -0
- package/src/objects/CreateNodeWalletAddressOutput.ts +27 -0
- package/src/objects/CurrencyAmount.ts +55 -0
- package/src/objects/CurrencyUnit.ts +25 -0
- package/src/objects/DeleteApiTokenInput.ts +13 -0
- package/src/objects/DeleteApiTokenOutput.ts +23 -0
- package/src/objects/Deposit.ts +144 -0
- package/src/objects/Entity.ts +868 -0
- package/src/objects/FeeEstimate.ts +39 -0
- package/src/objects/FundNodeInput.ts +16 -0
- package/src/objects/FundNodeOutput.ts +28 -0
- package/src/objects/GraphNode.ts +110 -0
- package/src/objects/Hop.ts +108 -0
- package/src/objects/HtlcAttemptFailureCode.ts +65 -0
- package/src/objects/IncomingPayment.ts +141 -0
- package/src/objects/IncomingPaymentAttempt.ts +96 -0
- package/src/objects/IncomingPaymentAttemptStatus.ts +20 -0
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +39 -0
- package/src/objects/Invoice.ts +226 -0
- package/src/objects/InvoiceData.ts +185 -0
- package/src/objects/InvoiceType.ts +15 -0
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +28 -0
- package/src/objects/LightningFeeEstimateForNodeInput.ts +25 -0
- package/src/objects/LightningFeeEstimateOutput.ts +33 -0
- package/src/objects/LightningTransaction.ts +393 -0
- package/src/objects/LightsparkNode.ts +377 -0
- package/src/objects/LightsparkNodePurpose.ts +17 -0
- package/src/objects/LightsparkNodeStatus.ts +29 -0
- package/src/objects/LightsparkNodeToChannelsConnection.ts +50 -0
- package/src/objects/Node.ts +273 -0
- package/src/objects/NodeAddress.ts +29 -0
- package/src/objects/NodeAddressType.ts +18 -0
- package/src/objects/NodeToAddressesConnection.ts +39 -0
- package/src/objects/OnChainTransaction.ts +318 -0
- package/src/objects/OutgoingPayment.ts +319 -0
- package/src/objects/OutgoingPaymentAttempt.ts +164 -0
- package/src/objects/OutgoingPaymentAttemptStatus.ts +18 -0
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +37 -0
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +39 -0
- package/src/objects/PageInfo.ts +31 -0
- package/src/objects/PayInvoiceInput.ts +33 -0
- package/src/objects/PayInvoiceOutput.ts +22 -0
- package/src/objects/PaymentFailureReason.ts +29 -0
- package/src/objects/PaymentRequest.ts +231 -0
- package/src/objects/PaymentRequestData.ts +183 -0
- package/src/objects/PaymentRequestStatus.ts +15 -0
- package/src/objects/Permission.ts +39 -0
- package/src/objects/RequestWithdrawalInput.ts +35 -0
- package/src/objects/RequestWithdrawalOutput.ts +24 -0
- package/src/objects/RichText.ts +19 -0
- package/src/objects/RoutingTransaction.ts +150 -0
- package/src/objects/RoutingTransactionFailureReason.ts +17 -0
- package/src/objects/Secret.ts +23 -0
- package/src/objects/SendPaymentInput.ts +30 -0
- package/src/objects/SendPaymentOutput.ts +22 -0
- package/src/objects/Transaction.ts +609 -0
- package/src/objects/TransactionFailures.ts +23 -0
- package/src/objects/TransactionStatus.ts +23 -0
- package/src/objects/TransactionType.ts +31 -0
- package/src/objects/TransactionUpdate.ts +67 -0
- package/src/objects/WalletDashboard.ts +32 -0
- package/src/objects/WebhookEventType.ts +15 -0
- package/src/objects/Withdrawal.ts +144 -0
- package/src/objects/WithdrawalMode.ts +15 -0
- package/src/objects/WithdrawalRequest.ts +224 -0
- package/src/objects/WithdrawalRequestStatus.ts +17 -0
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +57 -0
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +57 -0
- package/src/objects/index.ts +108 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import ApiToken, { ApiTokenFromJson } from "./ApiToken.js";
|
|
4
|
+
import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
|
|
5
|
+
|
|
6
|
+
type AccountToApiTokensConnection = {
|
|
7
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
8
|
+
pageInfo: PageInfo;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
12
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
13
|
+
**/
|
|
14
|
+
count: number;
|
|
15
|
+
|
|
16
|
+
/** The API tokens for the current page of this connection. **/
|
|
17
|
+
entities: ApiToken[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const AccountToApiTokensConnectionFromJson = (
|
|
21
|
+
obj: any
|
|
22
|
+
): AccountToApiTokensConnection => {
|
|
23
|
+
return {
|
|
24
|
+
pageInfo: PageInfoFromJson(
|
|
25
|
+
obj["account_to_api_tokens_connection_page_info"]
|
|
26
|
+
),
|
|
27
|
+
count: obj["account_to_api_tokens_connection_count"],
|
|
28
|
+
entities: obj["account_to_api_tokens_connection_entities"].map((e) =>
|
|
29
|
+
ApiTokenFromJson(e)
|
|
30
|
+
),
|
|
31
|
+
} as AccountToApiTokensConnection;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const FRAGMENT = `
|
|
35
|
+
fragment AccountToApiTokensConnectionFragment on AccountToApiTokensConnection {
|
|
36
|
+
__typename
|
|
37
|
+
account_to_api_tokens_connection_page_info: page_info {
|
|
38
|
+
__typename
|
|
39
|
+
page_info_has_next_page: has_next_page
|
|
40
|
+
page_info_has_previous_page: has_previous_page
|
|
41
|
+
page_info_start_cursor: start_cursor
|
|
42
|
+
page_info_end_cursor: end_cursor
|
|
43
|
+
}
|
|
44
|
+
account_to_api_tokens_connection_count: count
|
|
45
|
+
account_to_api_tokens_connection_entities: entities {
|
|
46
|
+
id
|
|
47
|
+
}
|
|
48
|
+
}`;
|
|
49
|
+
|
|
50
|
+
export default AccountToApiTokensConnection;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import autoBind from "auto-bind";
|
|
4
|
+
import Channel, { ChannelFromJson } from "./Channel.js";
|
|
5
|
+
|
|
6
|
+
class AccountToChannelsConnection {
|
|
7
|
+
constructor(
|
|
8
|
+
public readonly count: number,
|
|
9
|
+
public readonly entities: Channel[]
|
|
10
|
+
) {
|
|
11
|
+
autoBind(this);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const AccountToChannelsConnectionFromJson = (
|
|
16
|
+
obj: any
|
|
17
|
+
): AccountToChannelsConnection => {
|
|
18
|
+
return new AccountToChannelsConnection(
|
|
19
|
+
obj["account_to_channels_connection_count"],
|
|
20
|
+
obj["account_to_channels_connection_entities"].map((e) =>
|
|
21
|
+
ChannelFromJson(e)
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const FRAGMENT = `
|
|
27
|
+
fragment AccountToChannelsConnectionFragment on AccountToChannelsConnection {
|
|
28
|
+
__typename
|
|
29
|
+
account_to_channels_connection_count: count
|
|
30
|
+
account_to_channels_connection_entities: entities {
|
|
31
|
+
id
|
|
32
|
+
}
|
|
33
|
+
}`;
|
|
34
|
+
|
|
35
|
+
export default AccountToChannelsConnection;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import LightsparkNode, { LightsparkNodeFromJson } from "./LightsparkNode.js";
|
|
4
|
+
import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
|
|
5
|
+
import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
|
|
6
|
+
|
|
7
|
+
/** A connection between an account and the nodes it manages. **/
|
|
8
|
+
type AccountToNodesConnection = {
|
|
9
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
10
|
+
pageInfo: PageInfo;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
14
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
15
|
+
**/
|
|
16
|
+
count: number;
|
|
17
|
+
|
|
18
|
+
/** The nodes for the current page of this connection. **/
|
|
19
|
+
entities: LightsparkNode[];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The main purpose for the selected set of nodes. It is automatically determined from the nodes that
|
|
23
|
+
* are selected in this connection and is used for optimization purposes, as well as to determine the
|
|
24
|
+
* variation of the UI that should be presented to the user.
|
|
25
|
+
**/
|
|
26
|
+
purpose?: LightsparkNodePurpose;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const AccountToNodesConnectionFromJson = (
|
|
30
|
+
obj: any
|
|
31
|
+
): AccountToNodesConnection => {
|
|
32
|
+
return {
|
|
33
|
+
pageInfo: PageInfoFromJson(obj["account_to_nodes_connection_page_info"]),
|
|
34
|
+
count: obj["account_to_nodes_connection_count"],
|
|
35
|
+
entities: obj["account_to_nodes_connection_entities"].map((e) =>
|
|
36
|
+
LightsparkNodeFromJson(e)
|
|
37
|
+
),
|
|
38
|
+
purpose: !!obj["account_to_nodes_connection_purpose"]
|
|
39
|
+
? LightsparkNodePurpose[obj["account_to_nodes_connection_purpose"]] ??
|
|
40
|
+
LightsparkNodePurpose.FUTURE_VALUE
|
|
41
|
+
: null,
|
|
42
|
+
} as AccountToNodesConnection;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const FRAGMENT = `
|
|
46
|
+
fragment AccountToNodesConnectionFragment on AccountToNodesConnection {
|
|
47
|
+
__typename
|
|
48
|
+
account_to_nodes_connection_page_info: page_info {
|
|
49
|
+
__typename
|
|
50
|
+
page_info_has_next_page: has_next_page
|
|
51
|
+
page_info_has_previous_page: has_previous_page
|
|
52
|
+
page_info_start_cursor: start_cursor
|
|
53
|
+
page_info_end_cursor: end_cursor
|
|
54
|
+
}
|
|
55
|
+
account_to_nodes_connection_count: count
|
|
56
|
+
account_to_nodes_connection_purpose: purpose
|
|
57
|
+
account_to_nodes_connection_entities: entities {
|
|
58
|
+
id
|
|
59
|
+
}
|
|
60
|
+
}`;
|
|
61
|
+
|
|
62
|
+
export default AccountToNodesConnection;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
|
|
4
|
+
import PaymentRequest, { PaymentRequestFromJson } from "./PaymentRequest.js";
|
|
5
|
+
|
|
6
|
+
type AccountToPaymentRequestsConnection = {
|
|
7
|
+
/** The payment requests for the current page of this connection. **/
|
|
8
|
+
entities: PaymentRequest[];
|
|
9
|
+
|
|
10
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
11
|
+
pageInfo: PageInfo;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
15
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
16
|
+
**/
|
|
17
|
+
count?: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const AccountToPaymentRequestsConnectionFromJson = (
|
|
21
|
+
obj: any
|
|
22
|
+
): AccountToPaymentRequestsConnection => {
|
|
23
|
+
return {
|
|
24
|
+
entities: obj["account_to_payment_requests_connection_entities"].map((e) =>
|
|
25
|
+
PaymentRequestFromJson(e)
|
|
26
|
+
),
|
|
27
|
+
pageInfo: PageInfoFromJson(
|
|
28
|
+
obj["account_to_payment_requests_connection_page_info"]
|
|
29
|
+
),
|
|
30
|
+
count: obj["account_to_payment_requests_connection_count"],
|
|
31
|
+
} as AccountToPaymentRequestsConnection;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const FRAGMENT = `
|
|
35
|
+
fragment AccountToPaymentRequestsConnectionFragment on AccountToPaymentRequestsConnection {
|
|
36
|
+
__typename
|
|
37
|
+
account_to_payment_requests_connection_count: count
|
|
38
|
+
account_to_payment_requests_connection_entities: entities {
|
|
39
|
+
id
|
|
40
|
+
}
|
|
41
|
+
account_to_payment_requests_connection_page_info: page_info {
|
|
42
|
+
__typename
|
|
43
|
+
page_info_has_next_page: has_next_page
|
|
44
|
+
page_info_has_previous_page: has_previous_page
|
|
45
|
+
page_info_start_cursor: start_cursor
|
|
46
|
+
page_info_end_cursor: end_cursor
|
|
47
|
+
}
|
|
48
|
+
}`;
|
|
49
|
+
|
|
50
|
+
export default AccountToPaymentRequestsConnection;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
4
|
+
import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
|
|
5
|
+
import Transaction, { TransactionFromJson } from "./Transaction.js";
|
|
6
|
+
|
|
7
|
+
type AccountToTransactionsConnection = {
|
|
8
|
+
/**
|
|
9
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
10
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
11
|
+
**/
|
|
12
|
+
count: number;
|
|
13
|
+
|
|
14
|
+
/** The transactions for the current page of this connection. **/
|
|
15
|
+
entities: Transaction[];
|
|
16
|
+
|
|
17
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
18
|
+
pageInfo: PageInfo;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Profit (or loss) generated by the transactions in this connection, with the set of filters and
|
|
22
|
+
* constraints provided.
|
|
23
|
+
**/
|
|
24
|
+
profitLoss?: CurrencyAmount;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Average fee earned for the transactions in this connection, with the set of filters and constraints
|
|
28
|
+
* provided.
|
|
29
|
+
**/
|
|
30
|
+
averageFeeEarned?: CurrencyAmount;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Total amount transacted by the transactions in this connection, with the set of filters and
|
|
34
|
+
* constraints provided.
|
|
35
|
+
**/
|
|
36
|
+
totalAmountTransacted?: CurrencyAmount;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const AccountToTransactionsConnectionFromJson = (
|
|
40
|
+
obj: any
|
|
41
|
+
): AccountToTransactionsConnection => {
|
|
42
|
+
return {
|
|
43
|
+
count: obj["account_to_transactions_connection_count"],
|
|
44
|
+
entities: obj["account_to_transactions_connection_entities"].map((e) =>
|
|
45
|
+
TransactionFromJson(e)
|
|
46
|
+
),
|
|
47
|
+
pageInfo: PageInfoFromJson(
|
|
48
|
+
obj["account_to_transactions_connection_page_info"]
|
|
49
|
+
),
|
|
50
|
+
profitLoss: !!obj["account_to_transactions_connection_profit_loss"]
|
|
51
|
+
? CurrencyAmountFromJson(
|
|
52
|
+
obj["account_to_transactions_connection_profit_loss"]
|
|
53
|
+
)
|
|
54
|
+
: undefined,
|
|
55
|
+
averageFeeEarned: !!obj[
|
|
56
|
+
"account_to_transactions_connection_average_fee_earned"
|
|
57
|
+
]
|
|
58
|
+
? CurrencyAmountFromJson(
|
|
59
|
+
obj["account_to_transactions_connection_average_fee_earned"]
|
|
60
|
+
)
|
|
61
|
+
: undefined,
|
|
62
|
+
totalAmountTransacted: !!obj[
|
|
63
|
+
"account_to_transactions_connection_total_amount_transacted"
|
|
64
|
+
]
|
|
65
|
+
? CurrencyAmountFromJson(
|
|
66
|
+
obj["account_to_transactions_connection_total_amount_transacted"]
|
|
67
|
+
)
|
|
68
|
+
: undefined,
|
|
69
|
+
} as AccountToTransactionsConnection;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const FRAGMENT = `
|
|
73
|
+
fragment AccountToTransactionsConnectionFragment on AccountToTransactionsConnection {
|
|
74
|
+
__typename
|
|
75
|
+
account_to_transactions_connection_profit_loss: profit_loss {
|
|
76
|
+
__typename
|
|
77
|
+
currency_amount_original_value: original_value
|
|
78
|
+
currency_amount_original_unit: original_unit
|
|
79
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
80
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
81
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
82
|
+
}
|
|
83
|
+
account_to_transactions_connection_average_fee_earned: average_fee_earned {
|
|
84
|
+
__typename
|
|
85
|
+
currency_amount_original_value: original_value
|
|
86
|
+
currency_amount_original_unit: original_unit
|
|
87
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
88
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
89
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
90
|
+
}
|
|
91
|
+
account_to_transactions_connection_count: count
|
|
92
|
+
account_to_transactions_connection_total_amount_transacted: total_amount_transacted {
|
|
93
|
+
__typename
|
|
94
|
+
currency_amount_original_value: original_value
|
|
95
|
+
currency_amount_original_unit: original_unit
|
|
96
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
97
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
98
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
99
|
+
}
|
|
100
|
+
account_to_transactions_connection_entities: entities {
|
|
101
|
+
id
|
|
102
|
+
}
|
|
103
|
+
account_to_transactions_connection_page_info: page_info {
|
|
104
|
+
__typename
|
|
105
|
+
page_info_has_next_page: has_next_page
|
|
106
|
+
page_info_has_previous_page: has_previous_page
|
|
107
|
+
page_info_start_cursor: start_cursor
|
|
108
|
+
page_info_end_cursor: end_cursor
|
|
109
|
+
}
|
|
110
|
+
}`;
|
|
111
|
+
|
|
112
|
+
export default AccountToTransactionsConnection;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { Query } from "@lightsparkdev/core";
|
|
4
|
+
import Entity from "./Entity.js";
|
|
5
|
+
import Permission from "./Permission.js";
|
|
6
|
+
|
|
7
|
+
type ApiToken = Entity & {
|
|
8
|
+
/**
|
|
9
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
10
|
+
* string.
|
|
11
|
+
**/
|
|
12
|
+
id: string;
|
|
13
|
+
|
|
14
|
+
/** The date and time when the entity was first created. **/
|
|
15
|
+
createdAt: string;
|
|
16
|
+
|
|
17
|
+
/** The date and time when the entity was last updated. **/
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An opaque identifier that should be used as a client_id (or username) in the HTTP Basic
|
|
22
|
+
* Authentication scheme when issuing requests against the Lightspark API.
|
|
23
|
+
**/
|
|
24
|
+
clientId: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An arbitrary name chosen by the creator of the token to help identify the token in the list of
|
|
28
|
+
* tokens that have been created for the account.
|
|
29
|
+
**/
|
|
30
|
+
name: string;
|
|
31
|
+
|
|
32
|
+
/** A list of permissions granted to the token. **/
|
|
33
|
+
permissions: Permission[];
|
|
34
|
+
|
|
35
|
+
/** The typename of the object **/
|
|
36
|
+
typename: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const ApiTokenFromJson = (obj: any): ApiToken => {
|
|
40
|
+
return {
|
|
41
|
+
id: obj["api_token_id"],
|
|
42
|
+
createdAt: obj["api_token_created_at"],
|
|
43
|
+
updatedAt: obj["api_token_updated_at"],
|
|
44
|
+
clientId: obj["api_token_client_id"],
|
|
45
|
+
name: obj["api_token_name"],
|
|
46
|
+
permissions: obj["api_token_permissions"].map((e) => Permission[e]),
|
|
47
|
+
typename: "ApiToken",
|
|
48
|
+
} as ApiToken;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const FRAGMENT = `
|
|
52
|
+
fragment ApiTokenFragment on ApiToken {
|
|
53
|
+
__typename
|
|
54
|
+
api_token_id: id
|
|
55
|
+
api_token_created_at: created_at
|
|
56
|
+
api_token_updated_at: updated_at
|
|
57
|
+
api_token_client_id: client_id
|
|
58
|
+
api_token_name: name
|
|
59
|
+
api_token_permissions: permissions
|
|
60
|
+
}`;
|
|
61
|
+
|
|
62
|
+
export const getApiTokenQuery = (id: string): Query<ApiToken> => {
|
|
63
|
+
return {
|
|
64
|
+
queryPayload: `
|
|
65
|
+
query GetApiToken($id: ID!) {
|
|
66
|
+
entity(id: $id) {
|
|
67
|
+
... on ApiToken {
|
|
68
|
+
...ApiTokenFragment
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
${FRAGMENT}
|
|
74
|
+
`,
|
|
75
|
+
variables: { id },
|
|
76
|
+
constructObject: (data: any) => ApiTokenFromJson(data.entity),
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default ApiToken;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
export enum BitcoinNetwork {
|
|
4
|
+
/**
|
|
5
|
+
* This is an enum value that represents values that could be added in the future.
|
|
6
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
7
|
+
*/
|
|
8
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
9
|
+
/** The production version of the Bitcoin Blockchain. **/
|
|
10
|
+
MAINNET = "MAINNET",
|
|
11
|
+
/** A test version of the Bitcoin Blockchain, maintained by Lightspark. **/
|
|
12
|
+
REGTEST = "REGTEST",
|
|
13
|
+
/** A test version of the Bitcoin Blockchain, maintained by a centralized organization. Not in use at Lightspark. **/
|
|
14
|
+
SIGNET = "SIGNET",
|
|
15
|
+
/** A test version of the Bitcoin Blockchain, publically available. **/
|
|
16
|
+
TESTNET = "TESTNET",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default BitcoinNetwork;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
4
|
+
|
|
5
|
+
/** This object provides a detailed breakdown of a `LightsparkNode`'s current balance on the Bitcoin Network. **/
|
|
6
|
+
type BlockchainBalance = {
|
|
7
|
+
/** The total wallet balance, including unconfirmed UTXOs. **/
|
|
8
|
+
totalBalance?: CurrencyAmount;
|
|
9
|
+
|
|
10
|
+
/** The balance of confirmed UTXOs in the wallet. **/
|
|
11
|
+
confirmedBalance?: CurrencyAmount;
|
|
12
|
+
|
|
13
|
+
/** The balance of unconfirmed UTXOs in the wallet. **/
|
|
14
|
+
unconfirmedBalance?: CurrencyAmount;
|
|
15
|
+
|
|
16
|
+
/** The balance that's locked by an on-chain transaction. **/
|
|
17
|
+
lockedBalance?: CurrencyAmount;
|
|
18
|
+
|
|
19
|
+
/** Funds required to be held in reserve for channel bumping. **/
|
|
20
|
+
requiredReserve?: CurrencyAmount;
|
|
21
|
+
|
|
22
|
+
/** Funds available for creating channels or withdrawing. **/
|
|
23
|
+
availableBalance?: CurrencyAmount;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const BlockchainBalanceFromJson = (obj: any): BlockchainBalance => {
|
|
27
|
+
return {
|
|
28
|
+
totalBalance: !!obj["blockchain_balance_total_balance"]
|
|
29
|
+
? CurrencyAmountFromJson(obj["blockchain_balance_total_balance"])
|
|
30
|
+
: undefined,
|
|
31
|
+
confirmedBalance: !!obj["blockchain_balance_confirmed_balance"]
|
|
32
|
+
? CurrencyAmountFromJson(obj["blockchain_balance_confirmed_balance"])
|
|
33
|
+
: undefined,
|
|
34
|
+
unconfirmedBalance: !!obj["blockchain_balance_unconfirmed_balance"]
|
|
35
|
+
? CurrencyAmountFromJson(obj["blockchain_balance_unconfirmed_balance"])
|
|
36
|
+
: undefined,
|
|
37
|
+
lockedBalance: !!obj["blockchain_balance_locked_balance"]
|
|
38
|
+
? CurrencyAmountFromJson(obj["blockchain_balance_locked_balance"])
|
|
39
|
+
: undefined,
|
|
40
|
+
requiredReserve: !!obj["blockchain_balance_required_reserve"]
|
|
41
|
+
? CurrencyAmountFromJson(obj["blockchain_balance_required_reserve"])
|
|
42
|
+
: undefined,
|
|
43
|
+
availableBalance: !!obj["blockchain_balance_available_balance"]
|
|
44
|
+
? CurrencyAmountFromJson(obj["blockchain_balance_available_balance"])
|
|
45
|
+
: undefined,
|
|
46
|
+
} as BlockchainBalance;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const FRAGMENT = `
|
|
50
|
+
fragment BlockchainBalanceFragment on BlockchainBalance {
|
|
51
|
+
__typename
|
|
52
|
+
blockchain_balance_total_balance: total_balance {
|
|
53
|
+
__typename
|
|
54
|
+
currency_amount_original_value: original_value
|
|
55
|
+
currency_amount_original_unit: original_unit
|
|
56
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
57
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
58
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
59
|
+
}
|
|
60
|
+
blockchain_balance_confirmed_balance: confirmed_balance {
|
|
61
|
+
__typename
|
|
62
|
+
currency_amount_original_value: original_value
|
|
63
|
+
currency_amount_original_unit: original_unit
|
|
64
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
65
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
66
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
67
|
+
}
|
|
68
|
+
blockchain_balance_unconfirmed_balance: unconfirmed_balance {
|
|
69
|
+
__typename
|
|
70
|
+
currency_amount_original_value: original_value
|
|
71
|
+
currency_amount_original_unit: original_unit
|
|
72
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
73
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
74
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
75
|
+
}
|
|
76
|
+
blockchain_balance_locked_balance: locked_balance {
|
|
77
|
+
__typename
|
|
78
|
+
currency_amount_original_value: original_value
|
|
79
|
+
currency_amount_original_unit: original_unit
|
|
80
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
81
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
82
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
83
|
+
}
|
|
84
|
+
blockchain_balance_required_reserve: required_reserve {
|
|
85
|
+
__typename
|
|
86
|
+
currency_amount_original_value: original_value
|
|
87
|
+
currency_amount_original_unit: original_unit
|
|
88
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
89
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
90
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
91
|
+
}
|
|
92
|
+
blockchain_balance_available_balance: available_balance {
|
|
93
|
+
__typename
|
|
94
|
+
currency_amount_original_value: original_value
|
|
95
|
+
currency_amount_original_unit: original_unit
|
|
96
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
97
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
98
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
99
|
+
}
|
|
100
|
+
}`;
|
|
101
|
+
|
|
102
|
+
export default BlockchainBalance;
|