@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,273 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { LightsparkException, Query } from "@lightsparkdev/core";
|
|
4
|
+
import autoBind from "auto-bind";
|
|
5
|
+
import LightsparkClient from "../client.js";
|
|
6
|
+
import BitcoinNetwork from "./BitcoinNetwork.js";
|
|
7
|
+
import { BlockchainBalanceFromJson } from "./BlockchainBalance.js";
|
|
8
|
+
import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
9
|
+
import Entity from "./Entity.js";
|
|
10
|
+
import GraphNode from "./GraphNode.js";
|
|
11
|
+
import LightsparkNode from "./LightsparkNode.js";
|
|
12
|
+
import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
|
|
13
|
+
import LightsparkNodeStatus from "./LightsparkNodeStatus.js";
|
|
14
|
+
import NodeAddressType from "./NodeAddressType.js";
|
|
15
|
+
import NodeToAddressesConnection, {
|
|
16
|
+
NodeToAddressesConnectionFromJson,
|
|
17
|
+
} from "./NodeToAddressesConnection.js";
|
|
18
|
+
import { SecretFromJson } from "./Secret.js";
|
|
19
|
+
|
|
20
|
+
/** This interface represents a lightning node that can be connected to the Lightning Network to send and receive transactions. **/
|
|
21
|
+
class Node implements Entity {
|
|
22
|
+
constructor(
|
|
23
|
+
public readonly id: string,
|
|
24
|
+
public readonly createdAt: string,
|
|
25
|
+
public readonly updatedAt: string,
|
|
26
|
+
public readonly bitcoinNetwork: BitcoinNetwork,
|
|
27
|
+
public readonly displayName: string,
|
|
28
|
+
public readonly typename: string,
|
|
29
|
+
public readonly alias?: string,
|
|
30
|
+
public readonly color?: string,
|
|
31
|
+
public readonly conductivity?: number,
|
|
32
|
+
public readonly publicKey?: string
|
|
33
|
+
) {
|
|
34
|
+
autoBind(this);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async getAddresses(
|
|
38
|
+
client: LightsparkClient,
|
|
39
|
+
first: number | undefined = undefined,
|
|
40
|
+
types: NodeAddressType[] | undefined = undefined
|
|
41
|
+
): Promise<NodeToAddressesConnection> {
|
|
42
|
+
return (await client.executeRawQuery({
|
|
43
|
+
queryPayload: `
|
|
44
|
+
query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
|
|
45
|
+
entity(id: $entity_id) {
|
|
46
|
+
... on Node {
|
|
47
|
+
addresses(, first: $first, types: $types) {
|
|
48
|
+
__typename
|
|
49
|
+
node_to_addresses_connection_count: count
|
|
50
|
+
node_to_addresses_connection_entities: entities {
|
|
51
|
+
__typename
|
|
52
|
+
node_address_address: address
|
|
53
|
+
node_address_type: type
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
variables: { entity_id: this.id, first: first, types: types },
|
|
61
|
+
constructObject: (json) => {
|
|
62
|
+
const connection = json["entity"]["addresses"];
|
|
63
|
+
return NodeToAddressesConnectionFromJson(connection);
|
|
64
|
+
},
|
|
65
|
+
}))!;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static getNodeQuery(id: string): Query<Node> {
|
|
69
|
+
return {
|
|
70
|
+
queryPayload: `
|
|
71
|
+
query GetNode($id: ID!) {
|
|
72
|
+
entity(id: $id) {
|
|
73
|
+
... on Node {
|
|
74
|
+
...NodeFragment
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
${FRAGMENT}
|
|
80
|
+
`,
|
|
81
|
+
variables: { id },
|
|
82
|
+
constructObject: (data: any) => NodeFromJson(data.entity),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const NodeFromJson = (obj: any): Node => {
|
|
88
|
+
if (obj["__typename"] == "GraphNode") {
|
|
89
|
+
return new GraphNode(
|
|
90
|
+
obj["graph_node_id"],
|
|
91
|
+
obj["graph_node_created_at"],
|
|
92
|
+
obj["graph_node_updated_at"],
|
|
93
|
+
BitcoinNetwork[obj["graph_node_bitcoin_network"]] ??
|
|
94
|
+
BitcoinNetwork.FUTURE_VALUE,
|
|
95
|
+
obj["graph_node_display_name"],
|
|
96
|
+
"GraphNode",
|
|
97
|
+
obj["graph_node_alias"],
|
|
98
|
+
obj["graph_node_color"],
|
|
99
|
+
obj["graph_node_conductivity"],
|
|
100
|
+
obj["graph_node_public_key"]
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (obj["__typename"] == "LightsparkNode") {
|
|
104
|
+
return new LightsparkNode(
|
|
105
|
+
obj["lightspark_node_id"],
|
|
106
|
+
obj["lightspark_node_created_at"],
|
|
107
|
+
obj["lightspark_node_updated_at"],
|
|
108
|
+
BitcoinNetwork[obj["lightspark_node_bitcoin_network"]] ??
|
|
109
|
+
BitcoinNetwork.FUTURE_VALUE,
|
|
110
|
+
obj["lightspark_node_display_name"],
|
|
111
|
+
obj["lightspark_node_account"].id,
|
|
112
|
+
"LightsparkNode",
|
|
113
|
+
obj["lightspark_node_alias"],
|
|
114
|
+
obj["lightspark_node_color"],
|
|
115
|
+
obj["lightspark_node_conductivity"],
|
|
116
|
+
obj["lightspark_node_public_key"],
|
|
117
|
+
!!obj["lightspark_node_blockchain_balance"]
|
|
118
|
+
? BlockchainBalanceFromJson(obj["lightspark_node_blockchain_balance"])
|
|
119
|
+
: undefined,
|
|
120
|
+
!!obj["lightspark_node_encrypted_signing_private_key"]
|
|
121
|
+
? SecretFromJson(obj["lightspark_node_encrypted_signing_private_key"])
|
|
122
|
+
: undefined,
|
|
123
|
+
!!obj["lightspark_node_total_balance"]
|
|
124
|
+
? CurrencyAmountFromJson(obj["lightspark_node_total_balance"])
|
|
125
|
+
: undefined,
|
|
126
|
+
!!obj["lightspark_node_total_local_balance"]
|
|
127
|
+
? CurrencyAmountFromJson(obj["lightspark_node_total_local_balance"])
|
|
128
|
+
: undefined,
|
|
129
|
+
!!obj["lightspark_node_local_balance"]
|
|
130
|
+
? CurrencyAmountFromJson(obj["lightspark_node_local_balance"])
|
|
131
|
+
: undefined,
|
|
132
|
+
!!obj["lightspark_node_purpose"]
|
|
133
|
+
? LightsparkNodePurpose[obj["lightspark_node_purpose"]] ??
|
|
134
|
+
LightsparkNodePurpose.FUTURE_VALUE
|
|
135
|
+
: null,
|
|
136
|
+
!!obj["lightspark_node_remote_balance"]
|
|
137
|
+
? CurrencyAmountFromJson(obj["lightspark_node_remote_balance"])
|
|
138
|
+
: undefined,
|
|
139
|
+
!!obj["lightspark_node_status"]
|
|
140
|
+
? LightsparkNodeStatus[obj["lightspark_node_status"]] ??
|
|
141
|
+
LightsparkNodeStatus.FUTURE_VALUE
|
|
142
|
+
: null
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
throw new LightsparkException(
|
|
146
|
+
"DeserializationError",
|
|
147
|
+
`Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const FRAGMENT = `
|
|
152
|
+
fragment NodeFragment on Node {
|
|
153
|
+
__typename
|
|
154
|
+
... on GraphNode {
|
|
155
|
+
__typename
|
|
156
|
+
graph_node_id: id
|
|
157
|
+
graph_node_created_at: created_at
|
|
158
|
+
graph_node_updated_at: updated_at
|
|
159
|
+
graph_node_alias: alias
|
|
160
|
+
graph_node_bitcoin_network: bitcoin_network
|
|
161
|
+
graph_node_color: color
|
|
162
|
+
graph_node_conductivity: conductivity
|
|
163
|
+
graph_node_display_name: display_name
|
|
164
|
+
graph_node_public_key: public_key
|
|
165
|
+
}
|
|
166
|
+
... on LightsparkNode {
|
|
167
|
+
__typename
|
|
168
|
+
lightspark_node_id: id
|
|
169
|
+
lightspark_node_created_at: created_at
|
|
170
|
+
lightspark_node_updated_at: updated_at
|
|
171
|
+
lightspark_node_alias: alias
|
|
172
|
+
lightspark_node_bitcoin_network: bitcoin_network
|
|
173
|
+
lightspark_node_color: color
|
|
174
|
+
lightspark_node_conductivity: conductivity
|
|
175
|
+
lightspark_node_display_name: display_name
|
|
176
|
+
lightspark_node_public_key: public_key
|
|
177
|
+
lightspark_node_account: account {
|
|
178
|
+
id
|
|
179
|
+
}
|
|
180
|
+
lightspark_node_blockchain_balance: blockchain_balance {
|
|
181
|
+
__typename
|
|
182
|
+
blockchain_balance_total_balance: total_balance {
|
|
183
|
+
__typename
|
|
184
|
+
currency_amount_original_value: original_value
|
|
185
|
+
currency_amount_original_unit: original_unit
|
|
186
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
187
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
188
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
189
|
+
}
|
|
190
|
+
blockchain_balance_confirmed_balance: confirmed_balance {
|
|
191
|
+
__typename
|
|
192
|
+
currency_amount_original_value: original_value
|
|
193
|
+
currency_amount_original_unit: original_unit
|
|
194
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
195
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
196
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
197
|
+
}
|
|
198
|
+
blockchain_balance_unconfirmed_balance: unconfirmed_balance {
|
|
199
|
+
__typename
|
|
200
|
+
currency_amount_original_value: original_value
|
|
201
|
+
currency_amount_original_unit: original_unit
|
|
202
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
203
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
204
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
205
|
+
}
|
|
206
|
+
blockchain_balance_locked_balance: locked_balance {
|
|
207
|
+
__typename
|
|
208
|
+
currency_amount_original_value: original_value
|
|
209
|
+
currency_amount_original_unit: original_unit
|
|
210
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
211
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
212
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
213
|
+
}
|
|
214
|
+
blockchain_balance_required_reserve: required_reserve {
|
|
215
|
+
__typename
|
|
216
|
+
currency_amount_original_value: original_value
|
|
217
|
+
currency_amount_original_unit: original_unit
|
|
218
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
219
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
220
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
221
|
+
}
|
|
222
|
+
blockchain_balance_available_balance: available_balance {
|
|
223
|
+
__typename
|
|
224
|
+
currency_amount_original_value: original_value
|
|
225
|
+
currency_amount_original_unit: original_unit
|
|
226
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
227
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
228
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
|
|
232
|
+
__typename
|
|
233
|
+
secret_encrypted_value: encrypted_value
|
|
234
|
+
secret_cipher: cipher
|
|
235
|
+
}
|
|
236
|
+
lightspark_node_total_balance: total_balance {
|
|
237
|
+
__typename
|
|
238
|
+
currency_amount_original_value: original_value
|
|
239
|
+
currency_amount_original_unit: original_unit
|
|
240
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
241
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
242
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
243
|
+
}
|
|
244
|
+
lightspark_node_total_local_balance: total_local_balance {
|
|
245
|
+
__typename
|
|
246
|
+
currency_amount_original_value: original_value
|
|
247
|
+
currency_amount_original_unit: original_unit
|
|
248
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
249
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
250
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
251
|
+
}
|
|
252
|
+
lightspark_node_local_balance: local_balance {
|
|
253
|
+
__typename
|
|
254
|
+
currency_amount_original_value: original_value
|
|
255
|
+
currency_amount_original_unit: original_unit
|
|
256
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
257
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
258
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
259
|
+
}
|
|
260
|
+
lightspark_node_purpose: purpose
|
|
261
|
+
lightspark_node_remote_balance: remote_balance {
|
|
262
|
+
__typename
|
|
263
|
+
currency_amount_original_value: original_value
|
|
264
|
+
currency_amount_original_unit: original_unit
|
|
265
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
266
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
267
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
268
|
+
}
|
|
269
|
+
lightspark_node_status: status
|
|
270
|
+
}
|
|
271
|
+
}`;
|
|
272
|
+
|
|
273
|
+
export default Node;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import NodeAddressType from "./NodeAddressType.js";
|
|
4
|
+
|
|
5
|
+
/** An object that represents the address of a node on the Lightning Network. **/
|
|
6
|
+
type NodeAddress = {
|
|
7
|
+
/** The string representation of the address. **/
|
|
8
|
+
address: string;
|
|
9
|
+
|
|
10
|
+
/** The type, or protocol, of this address. **/
|
|
11
|
+
type: NodeAddressType;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const NodeAddressFromJson = (obj: any): NodeAddress => {
|
|
15
|
+
return {
|
|
16
|
+
address: obj["node_address_address"],
|
|
17
|
+
type:
|
|
18
|
+
NodeAddressType[obj["node_address_type"]] ?? NodeAddressType.FUTURE_VALUE,
|
|
19
|
+
} as NodeAddress;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const FRAGMENT = `
|
|
23
|
+
fragment NodeAddressFragment on NodeAddress {
|
|
24
|
+
__typename
|
|
25
|
+
node_address_address: address
|
|
26
|
+
node_address_type: type
|
|
27
|
+
}`;
|
|
28
|
+
|
|
29
|
+
export default NodeAddress;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
/** An enum that enumerates all possible types of addresses of a node on the Lightning Network. **/
|
|
4
|
+
export enum NodeAddressType {
|
|
5
|
+
/**
|
|
6
|
+
* This is an enum value that represents values that could be added in the future.
|
|
7
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
8
|
+
*/
|
|
9
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
10
|
+
|
|
11
|
+
IPV4 = "IPV4",
|
|
12
|
+
|
|
13
|
+
IPV6 = "IPV6",
|
|
14
|
+
|
|
15
|
+
TOR = "TOR",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default NodeAddressType;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import NodeAddress, { NodeAddressFromJson } from "./NodeAddress.js";
|
|
4
|
+
|
|
5
|
+
/** A connection between a node and the addresses it has announced for itself on Lightning Network. **/
|
|
6
|
+
type NodeToAddressesConnection = {
|
|
7
|
+
/**
|
|
8
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
9
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
10
|
+
**/
|
|
11
|
+
count: number;
|
|
12
|
+
|
|
13
|
+
/** The addresses for the current page of this connection. **/
|
|
14
|
+
entities: NodeAddress[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const NodeToAddressesConnectionFromJson = (
|
|
18
|
+
obj: any
|
|
19
|
+
): NodeToAddressesConnection => {
|
|
20
|
+
return {
|
|
21
|
+
count: obj["node_to_addresses_connection_count"],
|
|
22
|
+
entities: obj["node_to_addresses_connection_entities"].map((e) =>
|
|
23
|
+
NodeAddressFromJson(e)
|
|
24
|
+
),
|
|
25
|
+
} as NodeToAddressesConnection;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const FRAGMENT = `
|
|
29
|
+
fragment NodeToAddressesConnectionFragment on NodeToAddressesConnection {
|
|
30
|
+
__typename
|
|
31
|
+
node_to_addresses_connection_count: count
|
|
32
|
+
node_to_addresses_connection_entities: entities {
|
|
33
|
+
__typename
|
|
34
|
+
node_address_address: address
|
|
35
|
+
node_address_type: type
|
|
36
|
+
}
|
|
37
|
+
}`;
|
|
38
|
+
|
|
39
|
+
export default NodeToAddressesConnection;
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { LightsparkException, Query } from "@lightsparkdev/core";
|
|
4
|
+
import ChannelClosingTransaction from "./ChannelClosingTransaction.js";
|
|
5
|
+
import ChannelOpeningTransaction from "./ChannelOpeningTransaction.js";
|
|
6
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
7
|
+
import Deposit from "./Deposit.js";
|
|
8
|
+
import Entity from "./Entity.js";
|
|
9
|
+
import Transaction from "./Transaction.js";
|
|
10
|
+
import TransactionStatus from "./TransactionStatus.js";
|
|
11
|
+
import Withdrawal from "./Withdrawal.js";
|
|
12
|
+
|
|
13
|
+
/** Transaction happened on Bitcoin blockchain. **/
|
|
14
|
+
type OnChainTransaction = Transaction &
|
|
15
|
+
Entity & {
|
|
16
|
+
/**
|
|
17
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
18
|
+
* string.
|
|
19
|
+
**/
|
|
20
|
+
id: string;
|
|
21
|
+
|
|
22
|
+
/** The date and time when this transaction was initiated. **/
|
|
23
|
+
createdAt: string;
|
|
24
|
+
|
|
25
|
+
/** The date and time when the entity was last updated. **/
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
|
|
28
|
+
/** The current status of this transaction. **/
|
|
29
|
+
status: TransactionStatus;
|
|
30
|
+
|
|
31
|
+
/** The amount of money involved in this transaction. **/
|
|
32
|
+
amount: CurrencyAmount;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The height of the block that included this transaction. This will be zero for unconfirmed
|
|
36
|
+
* transactions.
|
|
37
|
+
**/
|
|
38
|
+
blockHeight: number;
|
|
39
|
+
|
|
40
|
+
/** The Bitcoin blockchain addresses this transaction was sent to. **/
|
|
41
|
+
destinationAddresses: string[];
|
|
42
|
+
|
|
43
|
+
/** The typename of the object **/
|
|
44
|
+
typename: string;
|
|
45
|
+
|
|
46
|
+
/** The date and time when this transaction was completed or failed. **/
|
|
47
|
+
resolvedAt?: string;
|
|
48
|
+
|
|
49
|
+
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
50
|
+
transactionHash?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
|
|
54
|
+
* blockchain.
|
|
55
|
+
**/
|
|
56
|
+
fees?: CurrencyAmount;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The hash of the block that included this transaction. This will be null for unconfirmed
|
|
60
|
+
* transactions.
|
|
61
|
+
**/
|
|
62
|
+
blockHash?: string;
|
|
63
|
+
|
|
64
|
+
/** The number of blockchain confirmations for this transaction in real time. **/
|
|
65
|
+
numConfirmations?: number;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const OnChainTransactionFromJson = (obj: any): OnChainTransaction => {
|
|
69
|
+
if (obj["__typename"] == "ChannelClosingTransaction") {
|
|
70
|
+
return {
|
|
71
|
+
id: obj["channel_closing_transaction_id"],
|
|
72
|
+
createdAt: obj["channel_closing_transaction_created_at"],
|
|
73
|
+
updatedAt: obj["channel_closing_transaction_updated_at"],
|
|
74
|
+
status:
|
|
75
|
+
TransactionStatus[obj["channel_closing_transaction_status"]] ??
|
|
76
|
+
TransactionStatus.FUTURE_VALUE,
|
|
77
|
+
amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
|
|
78
|
+
blockHeight: obj["channel_closing_transaction_block_height"],
|
|
79
|
+
destinationAddresses:
|
|
80
|
+
obj["channel_closing_transaction_destination_addresses"],
|
|
81
|
+
typename: "ChannelClosingTransaction",
|
|
82
|
+
resolvedAt: obj["channel_closing_transaction_resolved_at"],
|
|
83
|
+
transactionHash: obj["channel_closing_transaction_transaction_hash"],
|
|
84
|
+
fees: !!obj["channel_closing_transaction_fees"]
|
|
85
|
+
? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"])
|
|
86
|
+
: undefined,
|
|
87
|
+
blockHash: obj["channel_closing_transaction_block_hash"],
|
|
88
|
+
numConfirmations: obj["channel_closing_transaction_num_confirmations"],
|
|
89
|
+
channelId: obj["channel_closing_transaction_channel"]?.id ?? undefined,
|
|
90
|
+
} as ChannelClosingTransaction;
|
|
91
|
+
}
|
|
92
|
+
if (obj["__typename"] == "ChannelOpeningTransaction") {
|
|
93
|
+
return {
|
|
94
|
+
id: obj["channel_opening_transaction_id"],
|
|
95
|
+
createdAt: obj["channel_opening_transaction_created_at"],
|
|
96
|
+
updatedAt: obj["channel_opening_transaction_updated_at"],
|
|
97
|
+
status:
|
|
98
|
+
TransactionStatus[obj["channel_opening_transaction_status"]] ??
|
|
99
|
+
TransactionStatus.FUTURE_VALUE,
|
|
100
|
+
amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
|
|
101
|
+
blockHeight: obj["channel_opening_transaction_block_height"],
|
|
102
|
+
destinationAddresses:
|
|
103
|
+
obj["channel_opening_transaction_destination_addresses"],
|
|
104
|
+
typename: "ChannelOpeningTransaction",
|
|
105
|
+
resolvedAt: obj["channel_opening_transaction_resolved_at"],
|
|
106
|
+
transactionHash: obj["channel_opening_transaction_transaction_hash"],
|
|
107
|
+
fees: !!obj["channel_opening_transaction_fees"]
|
|
108
|
+
? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"])
|
|
109
|
+
: undefined,
|
|
110
|
+
blockHash: obj["channel_opening_transaction_block_hash"],
|
|
111
|
+
numConfirmations: obj["channel_opening_transaction_num_confirmations"],
|
|
112
|
+
channelId: obj["channel_opening_transaction_channel"]?.id ?? undefined,
|
|
113
|
+
} as ChannelOpeningTransaction;
|
|
114
|
+
}
|
|
115
|
+
if (obj["__typename"] == "Deposit") {
|
|
116
|
+
return {
|
|
117
|
+
id: obj["deposit_id"],
|
|
118
|
+
createdAt: obj["deposit_created_at"],
|
|
119
|
+
updatedAt: obj["deposit_updated_at"],
|
|
120
|
+
status:
|
|
121
|
+
TransactionStatus[obj["deposit_status"]] ??
|
|
122
|
+
TransactionStatus.FUTURE_VALUE,
|
|
123
|
+
amount: CurrencyAmountFromJson(obj["deposit_amount"]),
|
|
124
|
+
blockHeight: obj["deposit_block_height"],
|
|
125
|
+
destinationAddresses: obj["deposit_destination_addresses"],
|
|
126
|
+
destinationId: obj["deposit_destination"].id,
|
|
127
|
+
typename: "Deposit",
|
|
128
|
+
resolvedAt: obj["deposit_resolved_at"],
|
|
129
|
+
transactionHash: obj["deposit_transaction_hash"],
|
|
130
|
+
fees: !!obj["deposit_fees"]
|
|
131
|
+
? CurrencyAmountFromJson(obj["deposit_fees"])
|
|
132
|
+
: undefined,
|
|
133
|
+
blockHash: obj["deposit_block_hash"],
|
|
134
|
+
numConfirmations: obj["deposit_num_confirmations"],
|
|
135
|
+
} as Deposit;
|
|
136
|
+
}
|
|
137
|
+
if (obj["__typename"] == "Withdrawal") {
|
|
138
|
+
return {
|
|
139
|
+
id: obj["withdrawal_id"],
|
|
140
|
+
createdAt: obj["withdrawal_created_at"],
|
|
141
|
+
updatedAt: obj["withdrawal_updated_at"],
|
|
142
|
+
status:
|
|
143
|
+
TransactionStatus[obj["withdrawal_status"]] ??
|
|
144
|
+
TransactionStatus.FUTURE_VALUE,
|
|
145
|
+
amount: CurrencyAmountFromJson(obj["withdrawal_amount"]),
|
|
146
|
+
blockHeight: obj["withdrawal_block_height"],
|
|
147
|
+
destinationAddresses: obj["withdrawal_destination_addresses"],
|
|
148
|
+
originId: obj["withdrawal_origin"].id,
|
|
149
|
+
typename: "Withdrawal",
|
|
150
|
+
resolvedAt: obj["withdrawal_resolved_at"],
|
|
151
|
+
transactionHash: obj["withdrawal_transaction_hash"],
|
|
152
|
+
fees: !!obj["withdrawal_fees"]
|
|
153
|
+
? CurrencyAmountFromJson(obj["withdrawal_fees"])
|
|
154
|
+
: undefined,
|
|
155
|
+
blockHash: obj["withdrawal_block_hash"],
|
|
156
|
+
numConfirmations: obj["withdrawal_num_confirmations"],
|
|
157
|
+
} as Withdrawal;
|
|
158
|
+
}
|
|
159
|
+
throw new LightsparkException(
|
|
160
|
+
"DeserializationError",
|
|
161
|
+
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const FRAGMENT = `
|
|
166
|
+
fragment OnChainTransactionFragment on OnChainTransaction {
|
|
167
|
+
__typename
|
|
168
|
+
... on ChannelClosingTransaction {
|
|
169
|
+
__typename
|
|
170
|
+
channel_closing_transaction_id: id
|
|
171
|
+
channel_closing_transaction_created_at: created_at
|
|
172
|
+
channel_closing_transaction_updated_at: updated_at
|
|
173
|
+
channel_closing_transaction_status: status
|
|
174
|
+
channel_closing_transaction_resolved_at: resolved_at
|
|
175
|
+
channel_closing_transaction_amount: amount {
|
|
176
|
+
__typename
|
|
177
|
+
currency_amount_original_value: original_value
|
|
178
|
+
currency_amount_original_unit: original_unit
|
|
179
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
180
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
181
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
182
|
+
}
|
|
183
|
+
channel_closing_transaction_transaction_hash: transaction_hash
|
|
184
|
+
channel_closing_transaction_fees: fees {
|
|
185
|
+
__typename
|
|
186
|
+
currency_amount_original_value: original_value
|
|
187
|
+
currency_amount_original_unit: original_unit
|
|
188
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
189
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
190
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
191
|
+
}
|
|
192
|
+
channel_closing_transaction_block_hash: block_hash
|
|
193
|
+
channel_closing_transaction_block_height: block_height
|
|
194
|
+
channel_closing_transaction_destination_addresses: destination_addresses
|
|
195
|
+
channel_closing_transaction_num_confirmations: num_confirmations
|
|
196
|
+
channel_closing_transaction_channel: channel {
|
|
197
|
+
id
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
... on ChannelOpeningTransaction {
|
|
201
|
+
__typename
|
|
202
|
+
channel_opening_transaction_id: id
|
|
203
|
+
channel_opening_transaction_created_at: created_at
|
|
204
|
+
channel_opening_transaction_updated_at: updated_at
|
|
205
|
+
channel_opening_transaction_status: status
|
|
206
|
+
channel_opening_transaction_resolved_at: resolved_at
|
|
207
|
+
channel_opening_transaction_amount: amount {
|
|
208
|
+
__typename
|
|
209
|
+
currency_amount_original_value: original_value
|
|
210
|
+
currency_amount_original_unit: original_unit
|
|
211
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
212
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
213
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
214
|
+
}
|
|
215
|
+
channel_opening_transaction_transaction_hash: transaction_hash
|
|
216
|
+
channel_opening_transaction_fees: fees {
|
|
217
|
+
__typename
|
|
218
|
+
currency_amount_original_value: original_value
|
|
219
|
+
currency_amount_original_unit: original_unit
|
|
220
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
221
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
222
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
223
|
+
}
|
|
224
|
+
channel_opening_transaction_block_hash: block_hash
|
|
225
|
+
channel_opening_transaction_block_height: block_height
|
|
226
|
+
channel_opening_transaction_destination_addresses: destination_addresses
|
|
227
|
+
channel_opening_transaction_num_confirmations: num_confirmations
|
|
228
|
+
channel_opening_transaction_channel: channel {
|
|
229
|
+
id
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
... on Deposit {
|
|
233
|
+
__typename
|
|
234
|
+
deposit_id: id
|
|
235
|
+
deposit_created_at: created_at
|
|
236
|
+
deposit_updated_at: updated_at
|
|
237
|
+
deposit_status: status
|
|
238
|
+
deposit_resolved_at: resolved_at
|
|
239
|
+
deposit_amount: amount {
|
|
240
|
+
__typename
|
|
241
|
+
currency_amount_original_value: original_value
|
|
242
|
+
currency_amount_original_unit: original_unit
|
|
243
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
244
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
245
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
246
|
+
}
|
|
247
|
+
deposit_transaction_hash: transaction_hash
|
|
248
|
+
deposit_fees: fees {
|
|
249
|
+
__typename
|
|
250
|
+
currency_amount_original_value: original_value
|
|
251
|
+
currency_amount_original_unit: original_unit
|
|
252
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
253
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
254
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
255
|
+
}
|
|
256
|
+
deposit_block_hash: block_hash
|
|
257
|
+
deposit_block_height: block_height
|
|
258
|
+
deposit_destination_addresses: destination_addresses
|
|
259
|
+
deposit_num_confirmations: num_confirmations
|
|
260
|
+
deposit_destination: destination {
|
|
261
|
+
id
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
... on Withdrawal {
|
|
265
|
+
__typename
|
|
266
|
+
withdrawal_id: id
|
|
267
|
+
withdrawal_created_at: created_at
|
|
268
|
+
withdrawal_updated_at: updated_at
|
|
269
|
+
withdrawal_status: status
|
|
270
|
+
withdrawal_resolved_at: resolved_at
|
|
271
|
+
withdrawal_amount: amount {
|
|
272
|
+
__typename
|
|
273
|
+
currency_amount_original_value: original_value
|
|
274
|
+
currency_amount_original_unit: original_unit
|
|
275
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
276
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
277
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
278
|
+
}
|
|
279
|
+
withdrawal_transaction_hash: transaction_hash
|
|
280
|
+
withdrawal_fees: fees {
|
|
281
|
+
__typename
|
|
282
|
+
currency_amount_original_value: original_value
|
|
283
|
+
currency_amount_original_unit: original_unit
|
|
284
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
285
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
286
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
287
|
+
}
|
|
288
|
+
withdrawal_block_hash: block_hash
|
|
289
|
+
withdrawal_block_height: block_height
|
|
290
|
+
withdrawal_destination_addresses: destination_addresses
|
|
291
|
+
withdrawal_num_confirmations: num_confirmations
|
|
292
|
+
withdrawal_origin: origin {
|
|
293
|
+
id
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}`;
|
|
297
|
+
|
|
298
|
+
export const getOnChainTransactionQuery = (
|
|
299
|
+
id: string
|
|
300
|
+
): Query<OnChainTransaction> => {
|
|
301
|
+
return {
|
|
302
|
+
queryPayload: `
|
|
303
|
+
query GetOnChainTransaction($id: ID!) {
|
|
304
|
+
entity(id: $id) {
|
|
305
|
+
... on OnChainTransaction {
|
|
306
|
+
...OnChainTransactionFragment
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
${FRAGMENT}
|
|
312
|
+
`,
|
|
313
|
+
variables: { id },
|
|
314
|
+
constructObject: (data: any) => OnChainTransactionFromJson(data.entity),
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export default OnChainTransaction;
|