@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,609 @@
|
|
|
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 IncomingPayment from "./IncomingPayment.js";
|
|
10
|
+
import OutgoingPayment from "./OutgoingPayment.js";
|
|
11
|
+
import PaymentFailureReason from "./PaymentFailureReason.js";
|
|
12
|
+
import { PaymentRequestDataFromJson } from "./PaymentRequestData.js";
|
|
13
|
+
import { RichTextFromJson } from "./RichText.js";
|
|
14
|
+
import RoutingTransaction from "./RoutingTransaction.js";
|
|
15
|
+
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
16
|
+
import TransactionStatus from "./TransactionStatus.js";
|
|
17
|
+
import Withdrawal from "./Withdrawal.js";
|
|
18
|
+
|
|
19
|
+
type Transaction = Entity & {
|
|
20
|
+
/**
|
|
21
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
22
|
+
* string.
|
|
23
|
+
**/
|
|
24
|
+
id: string;
|
|
25
|
+
|
|
26
|
+
/** The date and time when this transaction was initiated. **/
|
|
27
|
+
createdAt: string;
|
|
28
|
+
|
|
29
|
+
/** The date and time when the entity was last updated. **/
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
|
|
32
|
+
/** The current status of this transaction. **/
|
|
33
|
+
status: TransactionStatus;
|
|
34
|
+
|
|
35
|
+
/** The amount of money involved in this transaction. **/
|
|
36
|
+
amount: CurrencyAmount;
|
|
37
|
+
|
|
38
|
+
/** The typename of the object **/
|
|
39
|
+
typename: string;
|
|
40
|
+
|
|
41
|
+
/** The date and time when this transaction was completed or failed. **/
|
|
42
|
+
resolvedAt?: string;
|
|
43
|
+
|
|
44
|
+
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
45
|
+
transactionHash?: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const TransactionFromJson = (obj: any): Transaction => {
|
|
49
|
+
if (obj["__typename"] == "ChannelClosingTransaction") {
|
|
50
|
+
return {
|
|
51
|
+
id: obj["channel_closing_transaction_id"],
|
|
52
|
+
createdAt: obj["channel_closing_transaction_created_at"],
|
|
53
|
+
updatedAt: obj["channel_closing_transaction_updated_at"],
|
|
54
|
+
status:
|
|
55
|
+
TransactionStatus[obj["channel_closing_transaction_status"]] ??
|
|
56
|
+
TransactionStatus.FUTURE_VALUE,
|
|
57
|
+
amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
|
|
58
|
+
blockHeight: obj["channel_closing_transaction_block_height"],
|
|
59
|
+
destinationAddresses:
|
|
60
|
+
obj["channel_closing_transaction_destination_addresses"],
|
|
61
|
+
typename: "ChannelClosingTransaction",
|
|
62
|
+
resolvedAt: obj["channel_closing_transaction_resolved_at"],
|
|
63
|
+
transactionHash: obj["channel_closing_transaction_transaction_hash"],
|
|
64
|
+
fees: !!obj["channel_closing_transaction_fees"]
|
|
65
|
+
? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"])
|
|
66
|
+
: undefined,
|
|
67
|
+
blockHash: obj["channel_closing_transaction_block_hash"],
|
|
68
|
+
numConfirmations: obj["channel_closing_transaction_num_confirmations"],
|
|
69
|
+
channelId: obj["channel_closing_transaction_channel"]?.id ?? undefined,
|
|
70
|
+
} as ChannelClosingTransaction;
|
|
71
|
+
}
|
|
72
|
+
if (obj["__typename"] == "ChannelOpeningTransaction") {
|
|
73
|
+
return {
|
|
74
|
+
id: obj["channel_opening_transaction_id"],
|
|
75
|
+
createdAt: obj["channel_opening_transaction_created_at"],
|
|
76
|
+
updatedAt: obj["channel_opening_transaction_updated_at"],
|
|
77
|
+
status:
|
|
78
|
+
TransactionStatus[obj["channel_opening_transaction_status"]] ??
|
|
79
|
+
TransactionStatus.FUTURE_VALUE,
|
|
80
|
+
amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
|
|
81
|
+
blockHeight: obj["channel_opening_transaction_block_height"],
|
|
82
|
+
destinationAddresses:
|
|
83
|
+
obj["channel_opening_transaction_destination_addresses"],
|
|
84
|
+
typename: "ChannelOpeningTransaction",
|
|
85
|
+
resolvedAt: obj["channel_opening_transaction_resolved_at"],
|
|
86
|
+
transactionHash: obj["channel_opening_transaction_transaction_hash"],
|
|
87
|
+
fees: !!obj["channel_opening_transaction_fees"]
|
|
88
|
+
? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"])
|
|
89
|
+
: undefined,
|
|
90
|
+
blockHash: obj["channel_opening_transaction_block_hash"],
|
|
91
|
+
numConfirmations: obj["channel_opening_transaction_num_confirmations"],
|
|
92
|
+
channelId: obj["channel_opening_transaction_channel"]?.id ?? undefined,
|
|
93
|
+
} as ChannelOpeningTransaction;
|
|
94
|
+
}
|
|
95
|
+
if (obj["__typename"] == "Deposit") {
|
|
96
|
+
return {
|
|
97
|
+
id: obj["deposit_id"],
|
|
98
|
+
createdAt: obj["deposit_created_at"],
|
|
99
|
+
updatedAt: obj["deposit_updated_at"],
|
|
100
|
+
status:
|
|
101
|
+
TransactionStatus[obj["deposit_status"]] ??
|
|
102
|
+
TransactionStatus.FUTURE_VALUE,
|
|
103
|
+
amount: CurrencyAmountFromJson(obj["deposit_amount"]),
|
|
104
|
+
blockHeight: obj["deposit_block_height"],
|
|
105
|
+
destinationAddresses: obj["deposit_destination_addresses"],
|
|
106
|
+
destinationId: obj["deposit_destination"].id,
|
|
107
|
+
typename: "Deposit",
|
|
108
|
+
resolvedAt: obj["deposit_resolved_at"],
|
|
109
|
+
transactionHash: obj["deposit_transaction_hash"],
|
|
110
|
+
fees: !!obj["deposit_fees"]
|
|
111
|
+
? CurrencyAmountFromJson(obj["deposit_fees"])
|
|
112
|
+
: undefined,
|
|
113
|
+
blockHash: obj["deposit_block_hash"],
|
|
114
|
+
numConfirmations: obj["deposit_num_confirmations"],
|
|
115
|
+
} as Deposit;
|
|
116
|
+
}
|
|
117
|
+
if (obj["__typename"] == "IncomingPayment") {
|
|
118
|
+
return new IncomingPayment(
|
|
119
|
+
obj["incoming_payment_id"],
|
|
120
|
+
obj["incoming_payment_created_at"],
|
|
121
|
+
obj["incoming_payment_updated_at"],
|
|
122
|
+
TransactionStatus[obj["incoming_payment_status"]] ??
|
|
123
|
+
TransactionStatus.FUTURE_VALUE,
|
|
124
|
+
CurrencyAmountFromJson(obj["incoming_payment_amount"]),
|
|
125
|
+
obj["incoming_payment_destination"].id,
|
|
126
|
+
"IncomingPayment",
|
|
127
|
+
obj["incoming_payment_resolved_at"],
|
|
128
|
+
obj["incoming_payment_transaction_hash"],
|
|
129
|
+
obj["incoming_payment_origin"]?.id ?? undefined,
|
|
130
|
+
obj["incoming_payment_payment_request"]?.id ?? undefined
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
if (obj["__typename"] == "OutgoingPayment") {
|
|
134
|
+
return new OutgoingPayment(
|
|
135
|
+
obj["outgoing_payment_id"],
|
|
136
|
+
obj["outgoing_payment_created_at"],
|
|
137
|
+
obj["outgoing_payment_updated_at"],
|
|
138
|
+
TransactionStatus[obj["outgoing_payment_status"]] ??
|
|
139
|
+
TransactionStatus.FUTURE_VALUE,
|
|
140
|
+
CurrencyAmountFromJson(obj["outgoing_payment_amount"]),
|
|
141
|
+
obj["outgoing_payment_origin"].id,
|
|
142
|
+
"OutgoingPayment",
|
|
143
|
+
obj["outgoing_payment_resolved_at"],
|
|
144
|
+
obj["outgoing_payment_transaction_hash"],
|
|
145
|
+
obj["outgoing_payment_destination"]?.id ?? undefined,
|
|
146
|
+
!!obj["outgoing_payment_fees"]
|
|
147
|
+
? CurrencyAmountFromJson(obj["outgoing_payment_fees"])
|
|
148
|
+
: undefined,
|
|
149
|
+
!!obj["outgoing_payment_payment_request_data"]
|
|
150
|
+
? PaymentRequestDataFromJson(
|
|
151
|
+
obj["outgoing_payment_payment_request_data"]
|
|
152
|
+
)
|
|
153
|
+
: undefined,
|
|
154
|
+
!!obj["outgoing_payment_failure_reason"]
|
|
155
|
+
? PaymentFailureReason[obj["outgoing_payment_failure_reason"]] ??
|
|
156
|
+
PaymentFailureReason.FUTURE_VALUE
|
|
157
|
+
: null,
|
|
158
|
+
!!obj["outgoing_payment_failure_message"]
|
|
159
|
+
? RichTextFromJson(obj["outgoing_payment_failure_message"])
|
|
160
|
+
: undefined
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
if (obj["__typename"] == "RoutingTransaction") {
|
|
164
|
+
return {
|
|
165
|
+
id: obj["routing_transaction_id"],
|
|
166
|
+
createdAt: obj["routing_transaction_created_at"],
|
|
167
|
+
updatedAt: obj["routing_transaction_updated_at"],
|
|
168
|
+
status:
|
|
169
|
+
TransactionStatus[obj["routing_transaction_status"]] ??
|
|
170
|
+
TransactionStatus.FUTURE_VALUE,
|
|
171
|
+
amount: CurrencyAmountFromJson(obj["routing_transaction_amount"]),
|
|
172
|
+
typename: "RoutingTransaction",
|
|
173
|
+
resolvedAt: obj["routing_transaction_resolved_at"],
|
|
174
|
+
transactionHash: obj["routing_transaction_transaction_hash"],
|
|
175
|
+
incomingChannelId:
|
|
176
|
+
obj["routing_transaction_incoming_channel"]?.id ?? undefined,
|
|
177
|
+
outgoingChannelId:
|
|
178
|
+
obj["routing_transaction_outgoing_channel"]?.id ?? undefined,
|
|
179
|
+
fees: !!obj["routing_transaction_fees"]
|
|
180
|
+
? CurrencyAmountFromJson(obj["routing_transaction_fees"])
|
|
181
|
+
: undefined,
|
|
182
|
+
failureMessage: !!obj["routing_transaction_failure_message"]
|
|
183
|
+
? RichTextFromJson(obj["routing_transaction_failure_message"])
|
|
184
|
+
: undefined,
|
|
185
|
+
failureReason: !!obj["routing_transaction_failure_reason"]
|
|
186
|
+
? RoutingTransactionFailureReason[
|
|
187
|
+
obj["routing_transaction_failure_reason"]
|
|
188
|
+
] ?? RoutingTransactionFailureReason.FUTURE_VALUE
|
|
189
|
+
: null,
|
|
190
|
+
} as RoutingTransaction;
|
|
191
|
+
}
|
|
192
|
+
if (obj["__typename"] == "Withdrawal") {
|
|
193
|
+
return {
|
|
194
|
+
id: obj["withdrawal_id"],
|
|
195
|
+
createdAt: obj["withdrawal_created_at"],
|
|
196
|
+
updatedAt: obj["withdrawal_updated_at"],
|
|
197
|
+
status:
|
|
198
|
+
TransactionStatus[obj["withdrawal_status"]] ??
|
|
199
|
+
TransactionStatus.FUTURE_VALUE,
|
|
200
|
+
amount: CurrencyAmountFromJson(obj["withdrawal_amount"]),
|
|
201
|
+
blockHeight: obj["withdrawal_block_height"],
|
|
202
|
+
destinationAddresses: obj["withdrawal_destination_addresses"],
|
|
203
|
+
originId: obj["withdrawal_origin"].id,
|
|
204
|
+
typename: "Withdrawal",
|
|
205
|
+
resolvedAt: obj["withdrawal_resolved_at"],
|
|
206
|
+
transactionHash: obj["withdrawal_transaction_hash"],
|
|
207
|
+
fees: !!obj["withdrawal_fees"]
|
|
208
|
+
? CurrencyAmountFromJson(obj["withdrawal_fees"])
|
|
209
|
+
: undefined,
|
|
210
|
+
blockHash: obj["withdrawal_block_hash"],
|
|
211
|
+
numConfirmations: obj["withdrawal_num_confirmations"],
|
|
212
|
+
} as Withdrawal;
|
|
213
|
+
}
|
|
214
|
+
throw new LightsparkException(
|
|
215
|
+
"DeserializationError",
|
|
216
|
+
`Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export const FRAGMENT = `
|
|
221
|
+
fragment TransactionFragment on Transaction {
|
|
222
|
+
__typename
|
|
223
|
+
... on ChannelClosingTransaction {
|
|
224
|
+
__typename
|
|
225
|
+
channel_closing_transaction_id: id
|
|
226
|
+
channel_closing_transaction_created_at: created_at
|
|
227
|
+
channel_closing_transaction_updated_at: updated_at
|
|
228
|
+
channel_closing_transaction_status: status
|
|
229
|
+
channel_closing_transaction_resolved_at: resolved_at
|
|
230
|
+
channel_closing_transaction_amount: amount {
|
|
231
|
+
__typename
|
|
232
|
+
currency_amount_original_value: original_value
|
|
233
|
+
currency_amount_original_unit: original_unit
|
|
234
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
235
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
236
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
237
|
+
}
|
|
238
|
+
channel_closing_transaction_transaction_hash: transaction_hash
|
|
239
|
+
channel_closing_transaction_fees: fees {
|
|
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
|
+
channel_closing_transaction_block_hash: block_hash
|
|
248
|
+
channel_closing_transaction_block_height: block_height
|
|
249
|
+
channel_closing_transaction_destination_addresses: destination_addresses
|
|
250
|
+
channel_closing_transaction_num_confirmations: num_confirmations
|
|
251
|
+
channel_closing_transaction_channel: channel {
|
|
252
|
+
id
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
... on ChannelOpeningTransaction {
|
|
256
|
+
__typename
|
|
257
|
+
channel_opening_transaction_id: id
|
|
258
|
+
channel_opening_transaction_created_at: created_at
|
|
259
|
+
channel_opening_transaction_updated_at: updated_at
|
|
260
|
+
channel_opening_transaction_status: status
|
|
261
|
+
channel_opening_transaction_resolved_at: resolved_at
|
|
262
|
+
channel_opening_transaction_amount: amount {
|
|
263
|
+
__typename
|
|
264
|
+
currency_amount_original_value: original_value
|
|
265
|
+
currency_amount_original_unit: original_unit
|
|
266
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
267
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
268
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
269
|
+
}
|
|
270
|
+
channel_opening_transaction_transaction_hash: transaction_hash
|
|
271
|
+
channel_opening_transaction_fees: fees {
|
|
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
|
+
channel_opening_transaction_block_hash: block_hash
|
|
280
|
+
channel_opening_transaction_block_height: block_height
|
|
281
|
+
channel_opening_transaction_destination_addresses: destination_addresses
|
|
282
|
+
channel_opening_transaction_num_confirmations: num_confirmations
|
|
283
|
+
channel_opening_transaction_channel: channel {
|
|
284
|
+
id
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
... on Deposit {
|
|
288
|
+
__typename
|
|
289
|
+
deposit_id: id
|
|
290
|
+
deposit_created_at: created_at
|
|
291
|
+
deposit_updated_at: updated_at
|
|
292
|
+
deposit_status: status
|
|
293
|
+
deposit_resolved_at: resolved_at
|
|
294
|
+
deposit_amount: amount {
|
|
295
|
+
__typename
|
|
296
|
+
currency_amount_original_value: original_value
|
|
297
|
+
currency_amount_original_unit: original_unit
|
|
298
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
299
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
300
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
301
|
+
}
|
|
302
|
+
deposit_transaction_hash: transaction_hash
|
|
303
|
+
deposit_fees: fees {
|
|
304
|
+
__typename
|
|
305
|
+
currency_amount_original_value: original_value
|
|
306
|
+
currency_amount_original_unit: original_unit
|
|
307
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
308
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
309
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
310
|
+
}
|
|
311
|
+
deposit_block_hash: block_hash
|
|
312
|
+
deposit_block_height: block_height
|
|
313
|
+
deposit_destination_addresses: destination_addresses
|
|
314
|
+
deposit_num_confirmations: num_confirmations
|
|
315
|
+
deposit_destination: destination {
|
|
316
|
+
id
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
... on IncomingPayment {
|
|
320
|
+
__typename
|
|
321
|
+
incoming_payment_id: id
|
|
322
|
+
incoming_payment_created_at: created_at
|
|
323
|
+
incoming_payment_updated_at: updated_at
|
|
324
|
+
incoming_payment_status: status
|
|
325
|
+
incoming_payment_resolved_at: resolved_at
|
|
326
|
+
incoming_payment_amount: amount {
|
|
327
|
+
__typename
|
|
328
|
+
currency_amount_original_value: original_value
|
|
329
|
+
currency_amount_original_unit: original_unit
|
|
330
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
331
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
332
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
333
|
+
}
|
|
334
|
+
incoming_payment_transaction_hash: transaction_hash
|
|
335
|
+
incoming_payment_origin: origin {
|
|
336
|
+
id
|
|
337
|
+
}
|
|
338
|
+
incoming_payment_destination: destination {
|
|
339
|
+
id
|
|
340
|
+
}
|
|
341
|
+
incoming_payment_payment_request: payment_request {
|
|
342
|
+
id
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
... on OutgoingPayment {
|
|
346
|
+
__typename
|
|
347
|
+
outgoing_payment_id: id
|
|
348
|
+
outgoing_payment_created_at: created_at
|
|
349
|
+
outgoing_payment_updated_at: updated_at
|
|
350
|
+
outgoing_payment_status: status
|
|
351
|
+
outgoing_payment_resolved_at: resolved_at
|
|
352
|
+
outgoing_payment_amount: amount {
|
|
353
|
+
__typename
|
|
354
|
+
currency_amount_original_value: original_value
|
|
355
|
+
currency_amount_original_unit: original_unit
|
|
356
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
357
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
358
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
359
|
+
}
|
|
360
|
+
outgoing_payment_transaction_hash: transaction_hash
|
|
361
|
+
outgoing_payment_origin: origin {
|
|
362
|
+
id
|
|
363
|
+
}
|
|
364
|
+
outgoing_payment_destination: destination {
|
|
365
|
+
id
|
|
366
|
+
}
|
|
367
|
+
outgoing_payment_fees: fees {
|
|
368
|
+
__typename
|
|
369
|
+
currency_amount_original_value: original_value
|
|
370
|
+
currency_amount_original_unit: original_unit
|
|
371
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
372
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
373
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
374
|
+
}
|
|
375
|
+
outgoing_payment_payment_request_data: payment_request_data {
|
|
376
|
+
__typename
|
|
377
|
+
... on InvoiceData {
|
|
378
|
+
__typename
|
|
379
|
+
invoice_data_encoded_payment_request: encoded_payment_request
|
|
380
|
+
invoice_data_bitcoin_network: bitcoin_network
|
|
381
|
+
invoice_data_payment_hash: payment_hash
|
|
382
|
+
invoice_data_amount: amount {
|
|
383
|
+
__typename
|
|
384
|
+
currency_amount_original_value: original_value
|
|
385
|
+
currency_amount_original_unit: original_unit
|
|
386
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
387
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
388
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
389
|
+
}
|
|
390
|
+
invoice_data_created_at: created_at
|
|
391
|
+
invoice_data_expires_at: expires_at
|
|
392
|
+
invoice_data_destination: destination {
|
|
393
|
+
__typename
|
|
394
|
+
... on GraphNode {
|
|
395
|
+
__typename
|
|
396
|
+
graph_node_id: id
|
|
397
|
+
graph_node_created_at: created_at
|
|
398
|
+
graph_node_updated_at: updated_at
|
|
399
|
+
graph_node_alias: alias
|
|
400
|
+
graph_node_bitcoin_network: bitcoin_network
|
|
401
|
+
graph_node_color: color
|
|
402
|
+
graph_node_conductivity: conductivity
|
|
403
|
+
graph_node_display_name: display_name
|
|
404
|
+
graph_node_public_key: public_key
|
|
405
|
+
}
|
|
406
|
+
... on LightsparkNode {
|
|
407
|
+
__typename
|
|
408
|
+
lightspark_node_id: id
|
|
409
|
+
lightspark_node_created_at: created_at
|
|
410
|
+
lightspark_node_updated_at: updated_at
|
|
411
|
+
lightspark_node_alias: alias
|
|
412
|
+
lightspark_node_bitcoin_network: bitcoin_network
|
|
413
|
+
lightspark_node_color: color
|
|
414
|
+
lightspark_node_conductivity: conductivity
|
|
415
|
+
lightspark_node_display_name: display_name
|
|
416
|
+
lightspark_node_public_key: public_key
|
|
417
|
+
lightspark_node_account: account {
|
|
418
|
+
id
|
|
419
|
+
}
|
|
420
|
+
lightspark_node_blockchain_balance: blockchain_balance {
|
|
421
|
+
__typename
|
|
422
|
+
blockchain_balance_total_balance: total_balance {
|
|
423
|
+
__typename
|
|
424
|
+
currency_amount_original_value: original_value
|
|
425
|
+
currency_amount_original_unit: original_unit
|
|
426
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
427
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
428
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
429
|
+
}
|
|
430
|
+
blockchain_balance_confirmed_balance: confirmed_balance {
|
|
431
|
+
__typename
|
|
432
|
+
currency_amount_original_value: original_value
|
|
433
|
+
currency_amount_original_unit: original_unit
|
|
434
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
435
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
436
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
437
|
+
}
|
|
438
|
+
blockchain_balance_unconfirmed_balance: unconfirmed_balance {
|
|
439
|
+
__typename
|
|
440
|
+
currency_amount_original_value: original_value
|
|
441
|
+
currency_amount_original_unit: original_unit
|
|
442
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
443
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
444
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
445
|
+
}
|
|
446
|
+
blockchain_balance_locked_balance: locked_balance {
|
|
447
|
+
__typename
|
|
448
|
+
currency_amount_original_value: original_value
|
|
449
|
+
currency_amount_original_unit: original_unit
|
|
450
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
451
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
452
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
453
|
+
}
|
|
454
|
+
blockchain_balance_required_reserve: required_reserve {
|
|
455
|
+
__typename
|
|
456
|
+
currency_amount_original_value: original_value
|
|
457
|
+
currency_amount_original_unit: original_unit
|
|
458
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
459
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
460
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
461
|
+
}
|
|
462
|
+
blockchain_balance_available_balance: available_balance {
|
|
463
|
+
__typename
|
|
464
|
+
currency_amount_original_value: original_value
|
|
465
|
+
currency_amount_original_unit: original_unit
|
|
466
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
467
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
468
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
|
|
472
|
+
__typename
|
|
473
|
+
secret_encrypted_value: encrypted_value
|
|
474
|
+
secret_cipher: cipher
|
|
475
|
+
}
|
|
476
|
+
lightspark_node_total_balance: total_balance {
|
|
477
|
+
__typename
|
|
478
|
+
currency_amount_original_value: original_value
|
|
479
|
+
currency_amount_original_unit: original_unit
|
|
480
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
481
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
482
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
483
|
+
}
|
|
484
|
+
lightspark_node_total_local_balance: total_local_balance {
|
|
485
|
+
__typename
|
|
486
|
+
currency_amount_original_value: original_value
|
|
487
|
+
currency_amount_original_unit: original_unit
|
|
488
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
489
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
490
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
491
|
+
}
|
|
492
|
+
lightspark_node_local_balance: local_balance {
|
|
493
|
+
__typename
|
|
494
|
+
currency_amount_original_value: original_value
|
|
495
|
+
currency_amount_original_unit: original_unit
|
|
496
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
497
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
498
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
499
|
+
}
|
|
500
|
+
lightspark_node_purpose: purpose
|
|
501
|
+
lightspark_node_remote_balance: remote_balance {
|
|
502
|
+
__typename
|
|
503
|
+
currency_amount_original_value: original_value
|
|
504
|
+
currency_amount_original_unit: original_unit
|
|
505
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
506
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
507
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
508
|
+
}
|
|
509
|
+
lightspark_node_status: status
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
invoice_data_memo: memo
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
outgoing_payment_failure_reason: failure_reason
|
|
516
|
+
outgoing_payment_failure_message: failure_message {
|
|
517
|
+
__typename
|
|
518
|
+
rich_text_text: text
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
... on RoutingTransaction {
|
|
522
|
+
__typename
|
|
523
|
+
routing_transaction_id: id
|
|
524
|
+
routing_transaction_created_at: created_at
|
|
525
|
+
routing_transaction_updated_at: updated_at
|
|
526
|
+
routing_transaction_status: status
|
|
527
|
+
routing_transaction_resolved_at: resolved_at
|
|
528
|
+
routing_transaction_amount: amount {
|
|
529
|
+
__typename
|
|
530
|
+
currency_amount_original_value: original_value
|
|
531
|
+
currency_amount_original_unit: original_unit
|
|
532
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
533
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
534
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
535
|
+
}
|
|
536
|
+
routing_transaction_transaction_hash: transaction_hash
|
|
537
|
+
routing_transaction_incoming_channel: incoming_channel {
|
|
538
|
+
id
|
|
539
|
+
}
|
|
540
|
+
routing_transaction_outgoing_channel: outgoing_channel {
|
|
541
|
+
id
|
|
542
|
+
}
|
|
543
|
+
routing_transaction_fees: fees {
|
|
544
|
+
__typename
|
|
545
|
+
currency_amount_original_value: original_value
|
|
546
|
+
currency_amount_original_unit: original_unit
|
|
547
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
548
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
549
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
550
|
+
}
|
|
551
|
+
routing_transaction_failure_message: failure_message {
|
|
552
|
+
__typename
|
|
553
|
+
rich_text_text: text
|
|
554
|
+
}
|
|
555
|
+
routing_transaction_failure_reason: failure_reason
|
|
556
|
+
}
|
|
557
|
+
... on Withdrawal {
|
|
558
|
+
__typename
|
|
559
|
+
withdrawal_id: id
|
|
560
|
+
withdrawal_created_at: created_at
|
|
561
|
+
withdrawal_updated_at: updated_at
|
|
562
|
+
withdrawal_status: status
|
|
563
|
+
withdrawal_resolved_at: resolved_at
|
|
564
|
+
withdrawal_amount: amount {
|
|
565
|
+
__typename
|
|
566
|
+
currency_amount_original_value: original_value
|
|
567
|
+
currency_amount_original_unit: original_unit
|
|
568
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
569
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
570
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
571
|
+
}
|
|
572
|
+
withdrawal_transaction_hash: transaction_hash
|
|
573
|
+
withdrawal_fees: fees {
|
|
574
|
+
__typename
|
|
575
|
+
currency_amount_original_value: original_value
|
|
576
|
+
currency_amount_original_unit: original_unit
|
|
577
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
578
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
579
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
580
|
+
}
|
|
581
|
+
withdrawal_block_hash: block_hash
|
|
582
|
+
withdrawal_block_height: block_height
|
|
583
|
+
withdrawal_destination_addresses: destination_addresses
|
|
584
|
+
withdrawal_num_confirmations: num_confirmations
|
|
585
|
+
withdrawal_origin: origin {
|
|
586
|
+
id
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}`;
|
|
590
|
+
|
|
591
|
+
export const getTransactionQuery = (id: string): Query<Transaction> => {
|
|
592
|
+
return {
|
|
593
|
+
queryPayload: `
|
|
594
|
+
query GetTransaction($id: ID!) {
|
|
595
|
+
entity(id: $id) {
|
|
596
|
+
... on Transaction {
|
|
597
|
+
...TransactionFragment
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
${FRAGMENT}
|
|
603
|
+
`,
|
|
604
|
+
variables: { id },
|
|
605
|
+
constructObject: (data: any) => TransactionFromJson(data.entity),
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
export default Transaction;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import PaymentFailureReason from "./PaymentFailureReason.js";
|
|
4
|
+
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
5
|
+
|
|
6
|
+
type TransactionFailures = {
|
|
7
|
+
paymentFailures?: PaymentFailureReason[];
|
|
8
|
+
|
|
9
|
+
routingTransactionFailures?: RoutingTransactionFailureReason[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const TransactionFailuresFromJson = (obj: any): TransactionFailures => {
|
|
13
|
+
return {
|
|
14
|
+
paymentFailures: obj["transaction_failures_payment_failures"]?.map(
|
|
15
|
+
(e) => PaymentFailureReason[e]
|
|
16
|
+
),
|
|
17
|
+
routingTransactionFailures: obj[
|
|
18
|
+
"transaction_failures_routing_transaction_failures"
|
|
19
|
+
]?.map((e) => RoutingTransactionFailureReason[e]),
|
|
20
|
+
} as TransactionFailures;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default TransactionFailures;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
export enum TransactionStatus {
|
|
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
|
+
/** Transaction succeeded.. **/
|
|
10
|
+
SUCCESS = "SUCCESS",
|
|
11
|
+
/** Transaction failed. **/
|
|
12
|
+
FAILED = "FAILED",
|
|
13
|
+
/** Transaction has been initiated and is currently in-flight. **/
|
|
14
|
+
PENDING = "PENDING",
|
|
15
|
+
/** For transaction type PAYMENT_REQUEST only. No payments have been made to a payment request. **/
|
|
16
|
+
NOT_STARTED = "NOT_STARTED",
|
|
17
|
+
/** For transaction type PAYMENT_REQUEST only. A payment request has expired. **/
|
|
18
|
+
EXPIRED = "EXPIRED",
|
|
19
|
+
/** For transaction type PAYMENT_REQUEST only. **/
|
|
20
|
+
CANCELLED = "CANCELLED",
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default TransactionStatus;
|