@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,150 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { Query } from "@lightsparkdev/core";
|
|
4
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
5
|
+
import Entity from "./Entity.js";
|
|
6
|
+
import LightningTransaction from "./LightningTransaction.js";
|
|
7
|
+
import RichText, { RichTextFromJson } from "./RichText.js";
|
|
8
|
+
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
9
|
+
import Transaction from "./Transaction.js";
|
|
10
|
+
import TransactionStatus from "./TransactionStatus.js";
|
|
11
|
+
|
|
12
|
+
/** A transaction that was forwarded through a Lightspark node on the Lightning Network. **/
|
|
13
|
+
type RoutingTransaction = LightningTransaction &
|
|
14
|
+
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
|
+
/** The typename of the object **/
|
|
35
|
+
typename: string;
|
|
36
|
+
|
|
37
|
+
/** The date and time when this transaction was completed or failed. **/
|
|
38
|
+
resolvedAt?: string;
|
|
39
|
+
|
|
40
|
+
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
41
|
+
transactionHash?: string;
|
|
42
|
+
|
|
43
|
+
/** If known, the channel this transaction was received from. **/
|
|
44
|
+
incomingChannelId?: string;
|
|
45
|
+
|
|
46
|
+
/** If known, the channel this transaction was forwarded to. **/
|
|
47
|
+
outgoingChannelId?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The fees collected by the node when routing this transaction. We subtract the outgoing amount to
|
|
51
|
+
* the incoming amount to determine how much fees were collected.
|
|
52
|
+
**/
|
|
53
|
+
fees?: CurrencyAmount;
|
|
54
|
+
|
|
55
|
+
/** If applicable, user-facing error message describing why the routing failed. **/
|
|
56
|
+
failureMessage?: RichText;
|
|
57
|
+
|
|
58
|
+
/** If applicable, the reason why the routing failed. **/
|
|
59
|
+
failureReason?: RoutingTransactionFailureReason;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const RoutingTransactionFromJson = (obj: any): RoutingTransaction => {
|
|
63
|
+
return {
|
|
64
|
+
id: obj["routing_transaction_id"],
|
|
65
|
+
createdAt: obj["routing_transaction_created_at"],
|
|
66
|
+
updatedAt: obj["routing_transaction_updated_at"],
|
|
67
|
+
status:
|
|
68
|
+
TransactionStatus[obj["routing_transaction_status"]] ??
|
|
69
|
+
TransactionStatus.FUTURE_VALUE,
|
|
70
|
+
amount: CurrencyAmountFromJson(obj["routing_transaction_amount"]),
|
|
71
|
+
typename: "RoutingTransaction",
|
|
72
|
+
resolvedAt: obj["routing_transaction_resolved_at"],
|
|
73
|
+
transactionHash: obj["routing_transaction_transaction_hash"],
|
|
74
|
+
incomingChannelId:
|
|
75
|
+
obj["routing_transaction_incoming_channel"]?.id ?? undefined,
|
|
76
|
+
outgoingChannelId:
|
|
77
|
+
obj["routing_transaction_outgoing_channel"]?.id ?? undefined,
|
|
78
|
+
fees: !!obj["routing_transaction_fees"]
|
|
79
|
+
? CurrencyAmountFromJson(obj["routing_transaction_fees"])
|
|
80
|
+
: undefined,
|
|
81
|
+
failureMessage: !!obj["routing_transaction_failure_message"]
|
|
82
|
+
? RichTextFromJson(obj["routing_transaction_failure_message"])
|
|
83
|
+
: undefined,
|
|
84
|
+
failureReason: !!obj["routing_transaction_failure_reason"]
|
|
85
|
+
? RoutingTransactionFailureReason[
|
|
86
|
+
obj["routing_transaction_failure_reason"]
|
|
87
|
+
] ?? RoutingTransactionFailureReason.FUTURE_VALUE
|
|
88
|
+
: null,
|
|
89
|
+
} as RoutingTransaction;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const FRAGMENT = `
|
|
93
|
+
fragment RoutingTransactionFragment on RoutingTransaction {
|
|
94
|
+
__typename
|
|
95
|
+
routing_transaction_id: id
|
|
96
|
+
routing_transaction_created_at: created_at
|
|
97
|
+
routing_transaction_updated_at: updated_at
|
|
98
|
+
routing_transaction_status: status
|
|
99
|
+
routing_transaction_resolved_at: resolved_at
|
|
100
|
+
routing_transaction_amount: amount {
|
|
101
|
+
__typename
|
|
102
|
+
currency_amount_original_value: original_value
|
|
103
|
+
currency_amount_original_unit: original_unit
|
|
104
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
105
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
106
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
107
|
+
}
|
|
108
|
+
routing_transaction_transaction_hash: transaction_hash
|
|
109
|
+
routing_transaction_incoming_channel: incoming_channel {
|
|
110
|
+
id
|
|
111
|
+
}
|
|
112
|
+
routing_transaction_outgoing_channel: outgoing_channel {
|
|
113
|
+
id
|
|
114
|
+
}
|
|
115
|
+
routing_transaction_fees: fees {
|
|
116
|
+
__typename
|
|
117
|
+
currency_amount_original_value: original_value
|
|
118
|
+
currency_amount_original_unit: original_unit
|
|
119
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
120
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
121
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
122
|
+
}
|
|
123
|
+
routing_transaction_failure_message: failure_message {
|
|
124
|
+
__typename
|
|
125
|
+
rich_text_text: text
|
|
126
|
+
}
|
|
127
|
+
routing_transaction_failure_reason: failure_reason
|
|
128
|
+
}`;
|
|
129
|
+
|
|
130
|
+
export const getRoutingTransactionQuery = (
|
|
131
|
+
id: string
|
|
132
|
+
): Query<RoutingTransaction> => {
|
|
133
|
+
return {
|
|
134
|
+
queryPayload: `
|
|
135
|
+
query GetRoutingTransaction($id: ID!) {
|
|
136
|
+
entity(id: $id) {
|
|
137
|
+
... on RoutingTransaction {
|
|
138
|
+
...RoutingTransactionFragment
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
${FRAGMENT}
|
|
144
|
+
`,
|
|
145
|
+
variables: { id },
|
|
146
|
+
constructObject: (data: any) => RoutingTransactionFromJson(data.entity),
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default RoutingTransaction;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
export enum RoutingTransactionFailureReason {
|
|
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
|
+
|
|
10
|
+
INCOMING_LINK_FAILURE = "INCOMING_LINK_FAILURE",
|
|
11
|
+
|
|
12
|
+
OUTGOING_LINK_FAILURE = "OUTGOING_LINK_FAILURE",
|
|
13
|
+
|
|
14
|
+
FORWARDING_FAILURE = "FORWARDING_FAILURE",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default RoutingTransactionFailureReason;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
type Secret = {
|
|
4
|
+
encryptedValue: string;
|
|
5
|
+
|
|
6
|
+
cipher: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const SecretFromJson = (obj: any): Secret => {
|
|
10
|
+
return {
|
|
11
|
+
encryptedValue: obj["secret_encrypted_value"],
|
|
12
|
+
cipher: obj["secret_cipher"],
|
|
13
|
+
} as Secret;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const FRAGMENT = `
|
|
17
|
+
fragment SecretFragment on Secret {
|
|
18
|
+
__typename
|
|
19
|
+
secret_encrypted_value: encrypted_value
|
|
20
|
+
secret_cipher: cipher
|
|
21
|
+
}`;
|
|
22
|
+
|
|
23
|
+
export default Secret;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
type SendPaymentInput = {
|
|
4
|
+
/** The node from where you want to send the payment. **/
|
|
5
|
+
nodeId: string;
|
|
6
|
+
|
|
7
|
+
/** The public key of the destination node. **/
|
|
8
|
+
destinationPublicKey: string;
|
|
9
|
+
|
|
10
|
+
/** The timeout in seconds that we will try to make the payment. **/
|
|
11
|
+
timeoutSecs: number;
|
|
12
|
+
|
|
13
|
+
/** The amount you will send to the destination node, expressed in msats. **/
|
|
14
|
+
amountMsats: number;
|
|
15
|
+
|
|
16
|
+
/** The maximum amount of fees that you want to pay for this payment to be sent, expressed in msats. **/
|
|
17
|
+
maximumFeesMsats: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const SendPaymentInputFromJson = (obj: any): SendPaymentInput => {
|
|
21
|
+
return {
|
|
22
|
+
nodeId: obj["send_payment_input_node_id"],
|
|
23
|
+
destinationPublicKey: obj["send_payment_input_destination_public_key"],
|
|
24
|
+
timeoutSecs: obj["send_payment_input_timeout_secs"],
|
|
25
|
+
amountMsats: obj["send_payment_input_amount_msats"],
|
|
26
|
+
maximumFeesMsats: obj["send_payment_input_maximum_fees_msats"],
|
|
27
|
+
} as SendPaymentInput;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default SendPaymentInput;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
type SendPaymentOutput = {
|
|
4
|
+
/** The payment that has been sent. **/
|
|
5
|
+
paymentId: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const SendPaymentOutputFromJson = (obj: any): SendPaymentOutput => {
|
|
9
|
+
return {
|
|
10
|
+
paymentId: obj["send_payment_output_payment"].id,
|
|
11
|
+
} as SendPaymentOutput;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const FRAGMENT = `
|
|
15
|
+
fragment SendPaymentOutputFragment on SendPaymentOutput {
|
|
16
|
+
__typename
|
|
17
|
+
send_payment_output_payment: payment {
|
|
18
|
+
id
|
|
19
|
+
}
|
|
20
|
+
}`;
|
|
21
|
+
|
|
22
|
+
export default SendPaymentOutput;
|