@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,39 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
4
|
+
|
|
5
|
+
type FeeEstimate = {
|
|
6
|
+
feeFast: CurrencyAmount;
|
|
7
|
+
|
|
8
|
+
feeMin: CurrencyAmount;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const FeeEstimateFromJson = (obj: any): FeeEstimate => {
|
|
12
|
+
return {
|
|
13
|
+
feeFast: CurrencyAmountFromJson(obj["fee_estimate_fee_fast"]),
|
|
14
|
+
feeMin: CurrencyAmountFromJson(obj["fee_estimate_fee_min"]),
|
|
15
|
+
} as FeeEstimate;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const FRAGMENT = `
|
|
19
|
+
fragment FeeEstimateFragment on FeeEstimate {
|
|
20
|
+
__typename
|
|
21
|
+
fee_estimate_fee_fast: fee_fast {
|
|
22
|
+
__typename
|
|
23
|
+
currency_amount_original_value: original_value
|
|
24
|
+
currency_amount_original_unit: original_unit
|
|
25
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
26
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
27
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
28
|
+
}
|
|
29
|
+
fee_estimate_fee_min: fee_min {
|
|
30
|
+
__typename
|
|
31
|
+
currency_amount_original_value: original_value
|
|
32
|
+
currency_amount_original_unit: original_unit
|
|
33
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
34
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
35
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
36
|
+
}
|
|
37
|
+
}`;
|
|
38
|
+
|
|
39
|
+
export default FeeEstimate;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
type FundNodeInput = {
|
|
4
|
+
nodeId: string;
|
|
5
|
+
|
|
6
|
+
amountSats?: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const FundNodeInputFromJson = (obj: any): FundNodeInput => {
|
|
10
|
+
return {
|
|
11
|
+
nodeId: obj["fund_node_input_node_id"],
|
|
12
|
+
amountSats: obj["fund_node_input_amount_sats"],
|
|
13
|
+
} as FundNodeInput;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default FundNodeInput;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
4
|
+
|
|
5
|
+
type FundNodeOutput = {
|
|
6
|
+
amount: CurrencyAmount;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const FundNodeOutputFromJson = (obj: any): FundNodeOutput => {
|
|
10
|
+
return {
|
|
11
|
+
amount: CurrencyAmountFromJson(obj["fund_node_output_amount"]),
|
|
12
|
+
} as FundNodeOutput;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const FRAGMENT = `
|
|
16
|
+
fragment FundNodeOutputFragment on FundNodeOutput {
|
|
17
|
+
__typename
|
|
18
|
+
fund_node_output_amount: amount {
|
|
19
|
+
__typename
|
|
20
|
+
currency_amount_original_value: original_value
|
|
21
|
+
currency_amount_original_unit: original_unit
|
|
22
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
23
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
24
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
25
|
+
}
|
|
26
|
+
}`;
|
|
27
|
+
|
|
28
|
+
export default FundNodeOutput;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { Query } from "@lightsparkdev/core";
|
|
4
|
+
import autoBind from "auto-bind";
|
|
5
|
+
import LightsparkClient from "../client.js";
|
|
6
|
+
import BitcoinNetwork from "./BitcoinNetwork.js";
|
|
7
|
+
import Node from "./Node.js";
|
|
8
|
+
import NodeAddressType from "./NodeAddressType.js";
|
|
9
|
+
import NodeToAddressesConnection, {
|
|
10
|
+
NodeToAddressesConnectionFromJson,
|
|
11
|
+
} from "./NodeToAddressesConnection.js";
|
|
12
|
+
|
|
13
|
+
/** This is a node on the Lightning Network, managed by a third party. The information about this node is public data that has been obtained by observing the Lightning Network. **/
|
|
14
|
+
class GraphNode implements Node {
|
|
15
|
+
constructor(
|
|
16
|
+
public readonly id: string,
|
|
17
|
+
public readonly createdAt: string,
|
|
18
|
+
public readonly updatedAt: string,
|
|
19
|
+
public readonly bitcoinNetwork: BitcoinNetwork,
|
|
20
|
+
public readonly displayName: string,
|
|
21
|
+
public readonly typename: string,
|
|
22
|
+
public readonly alias?: string,
|
|
23
|
+
public readonly color?: string,
|
|
24
|
+
public readonly conductivity?: number,
|
|
25
|
+
public readonly publicKey?: string
|
|
26
|
+
) {
|
|
27
|
+
autoBind(this);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async getAddresses(
|
|
31
|
+
client: LightsparkClient,
|
|
32
|
+
first: number | undefined = undefined,
|
|
33
|
+
types: NodeAddressType[] | undefined = undefined
|
|
34
|
+
): Promise<NodeToAddressesConnection> {
|
|
35
|
+
return (await client.executeRawQuery({
|
|
36
|
+
queryPayload: `
|
|
37
|
+
query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
|
|
38
|
+
entity(id: $entity_id) {
|
|
39
|
+
... on GraphNode {
|
|
40
|
+
addresses(, first: $first, types: $types) {
|
|
41
|
+
__typename
|
|
42
|
+
node_to_addresses_connection_count: count
|
|
43
|
+
node_to_addresses_connection_entities: entities {
|
|
44
|
+
__typename
|
|
45
|
+
node_address_address: address
|
|
46
|
+
node_address_type: type
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
variables: { entity_id: this.id, first: first, types: types },
|
|
54
|
+
constructObject: (json) => {
|
|
55
|
+
const connection = json["entity"]["addresses"];
|
|
56
|
+
return NodeToAddressesConnectionFromJson(connection);
|
|
57
|
+
},
|
|
58
|
+
}))!;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static getGraphNodeQuery(id: string): Query<GraphNode> {
|
|
62
|
+
return {
|
|
63
|
+
queryPayload: `
|
|
64
|
+
query GetGraphNode($id: ID!) {
|
|
65
|
+
entity(id: $id) {
|
|
66
|
+
... on GraphNode {
|
|
67
|
+
...GraphNodeFragment
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
${FRAGMENT}
|
|
73
|
+
`,
|
|
74
|
+
variables: { id },
|
|
75
|
+
constructObject: (data: any) => GraphNodeFromJson(data.entity),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const GraphNodeFromJson = (obj: any): GraphNode => {
|
|
81
|
+
return new GraphNode(
|
|
82
|
+
obj["graph_node_id"],
|
|
83
|
+
obj["graph_node_created_at"],
|
|
84
|
+
obj["graph_node_updated_at"],
|
|
85
|
+
BitcoinNetwork[obj["graph_node_bitcoin_network"]] ??
|
|
86
|
+
BitcoinNetwork.FUTURE_VALUE,
|
|
87
|
+
obj["graph_node_display_name"],
|
|
88
|
+
"GraphNode",
|
|
89
|
+
obj["graph_node_alias"],
|
|
90
|
+
obj["graph_node_color"],
|
|
91
|
+
obj["graph_node_conductivity"],
|
|
92
|
+
obj["graph_node_public_key"]
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const FRAGMENT = `
|
|
97
|
+
fragment GraphNodeFragment on GraphNode {
|
|
98
|
+
__typename
|
|
99
|
+
graph_node_id: id
|
|
100
|
+
graph_node_created_at: created_at
|
|
101
|
+
graph_node_updated_at: updated_at
|
|
102
|
+
graph_node_alias: alias
|
|
103
|
+
graph_node_bitcoin_network: bitcoin_network
|
|
104
|
+
graph_node_color: color
|
|
105
|
+
graph_node_conductivity: conductivity
|
|
106
|
+
graph_node_display_name: display_name
|
|
107
|
+
graph_node_public_key: public_key
|
|
108
|
+
}`;
|
|
109
|
+
|
|
110
|
+
export default GraphNode;
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
|
|
7
|
+
/** One hop signifies a payment moving one node ahead on a payment route; a list of sequential hops defines the path from sender node to recipient node for a payment attempt. **/
|
|
8
|
+
type Hop = Entity & {
|
|
9
|
+
/**
|
|
10
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
11
|
+
* string.
|
|
12
|
+
**/
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
/** The date and time when the entity was first created. **/
|
|
16
|
+
createdAt: string;
|
|
17
|
+
|
|
18
|
+
/** The date and time when the entity was last updated. **/
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
|
|
21
|
+
/** The zero-based index position of this hop in the path **/
|
|
22
|
+
index: number;
|
|
23
|
+
|
|
24
|
+
/** The typename of the object **/
|
|
25
|
+
typename: string;
|
|
26
|
+
|
|
27
|
+
/** The destination node of the hop. **/
|
|
28
|
+
destinationId?: string;
|
|
29
|
+
|
|
30
|
+
/** The public key of the node to which the hop is bound. **/
|
|
31
|
+
publicKey?: string;
|
|
32
|
+
|
|
33
|
+
/** The amount that is to be forwarded to the destination node. **/
|
|
34
|
+
amountToForward?: CurrencyAmount;
|
|
35
|
+
|
|
36
|
+
/** The fees to be collected by the source node for forwarding the payment over the hop. **/
|
|
37
|
+
fee?: CurrencyAmount;
|
|
38
|
+
|
|
39
|
+
/** The block height at which an unsettled HTLC is considered expired. **/
|
|
40
|
+
expiryBlockHeight?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const HopFromJson = (obj: any): Hop => {
|
|
44
|
+
return {
|
|
45
|
+
id: obj["hop_id"],
|
|
46
|
+
createdAt: obj["hop_created_at"],
|
|
47
|
+
updatedAt: obj["hop_updated_at"],
|
|
48
|
+
index: obj["hop_index"],
|
|
49
|
+
typename: "Hop",
|
|
50
|
+
destinationId: obj["hop_destination"]?.id ?? undefined,
|
|
51
|
+
publicKey: obj["hop_public_key"],
|
|
52
|
+
amountToForward: !!obj["hop_amount_to_forward"]
|
|
53
|
+
? CurrencyAmountFromJson(obj["hop_amount_to_forward"])
|
|
54
|
+
: undefined,
|
|
55
|
+
fee: !!obj["hop_fee"] ? CurrencyAmountFromJson(obj["hop_fee"]) : undefined,
|
|
56
|
+
expiryBlockHeight: obj["hop_expiry_block_height"],
|
|
57
|
+
} as Hop;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const FRAGMENT = `
|
|
61
|
+
fragment HopFragment on Hop {
|
|
62
|
+
__typename
|
|
63
|
+
hop_id: id
|
|
64
|
+
hop_created_at: created_at
|
|
65
|
+
hop_updated_at: updated_at
|
|
66
|
+
hop_destination: destination {
|
|
67
|
+
id
|
|
68
|
+
}
|
|
69
|
+
hop_index: index
|
|
70
|
+
hop_public_key: public_key
|
|
71
|
+
hop_amount_to_forward: amount_to_forward {
|
|
72
|
+
__typename
|
|
73
|
+
currency_amount_original_value: original_value
|
|
74
|
+
currency_amount_original_unit: original_unit
|
|
75
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
76
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
77
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
78
|
+
}
|
|
79
|
+
hop_fee: fee {
|
|
80
|
+
__typename
|
|
81
|
+
currency_amount_original_value: original_value
|
|
82
|
+
currency_amount_original_unit: original_unit
|
|
83
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
84
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
85
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
86
|
+
}
|
|
87
|
+
hop_expiry_block_height: expiry_block_height
|
|
88
|
+
}`;
|
|
89
|
+
|
|
90
|
+
export const getHopQuery = (id: string): Query<Hop> => {
|
|
91
|
+
return {
|
|
92
|
+
queryPayload: `
|
|
93
|
+
query GetHop($id: ID!) {
|
|
94
|
+
entity(id: $id) {
|
|
95
|
+
... on Hop {
|
|
96
|
+
...HopFragment
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
${FRAGMENT}
|
|
102
|
+
`,
|
|
103
|
+
variables: { id },
|
|
104
|
+
constructObject: (data: any) => HopFromJson(data.entity),
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default Hop;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
export enum HtlcAttemptFailureCode {
|
|
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
|
+
INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS = "INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS",
|
|
11
|
+
|
|
12
|
+
INCORRECT_PAYMENT_AMOUNT = "INCORRECT_PAYMENT_AMOUNT",
|
|
13
|
+
|
|
14
|
+
FINAL_INCORRECT_CLTV_EXPIRY = "FINAL_INCORRECT_CLTV_EXPIRY",
|
|
15
|
+
|
|
16
|
+
FINAL_INCORRECT_HTLC_AMOUNT = "FINAL_INCORRECT_HTLC_AMOUNT",
|
|
17
|
+
|
|
18
|
+
FINAL_EXPIRY_TOO_SOON = "FINAL_EXPIRY_TOO_SOON",
|
|
19
|
+
|
|
20
|
+
INVALID_REALM = "INVALID_REALM",
|
|
21
|
+
|
|
22
|
+
EXPIRY_TOO_SOON = "EXPIRY_TOO_SOON",
|
|
23
|
+
|
|
24
|
+
INVALID_ONION_VERSION = "INVALID_ONION_VERSION",
|
|
25
|
+
|
|
26
|
+
INVALID_ONION_HMAC = "INVALID_ONION_HMAC",
|
|
27
|
+
|
|
28
|
+
INVALID_ONION_KEY = "INVALID_ONION_KEY",
|
|
29
|
+
|
|
30
|
+
AMOUNT_BELOW_MINIMUM = "AMOUNT_BELOW_MINIMUM",
|
|
31
|
+
|
|
32
|
+
FEE_INSUFFICIENT = "FEE_INSUFFICIENT",
|
|
33
|
+
|
|
34
|
+
INCORRECT_CLTV_EXPIRY = "INCORRECT_CLTV_EXPIRY",
|
|
35
|
+
|
|
36
|
+
CHANNEL_DISABLED = "CHANNEL_DISABLED",
|
|
37
|
+
|
|
38
|
+
TEMPORARY_CHANNEL_FAILURE = "TEMPORARY_CHANNEL_FAILURE",
|
|
39
|
+
|
|
40
|
+
REQUIRED_NODE_FEATURE_MISSING = "REQUIRED_NODE_FEATURE_MISSING",
|
|
41
|
+
|
|
42
|
+
REQUIRED_CHANNEL_FEATURE_MISSING = "REQUIRED_CHANNEL_FEATURE_MISSING",
|
|
43
|
+
|
|
44
|
+
UNKNOWN_NEXT_PEER = "UNKNOWN_NEXT_PEER",
|
|
45
|
+
|
|
46
|
+
TEMPORARY_NODE_FAILURE = "TEMPORARY_NODE_FAILURE",
|
|
47
|
+
|
|
48
|
+
PERMANENT_NODE_FAILURE = "PERMANENT_NODE_FAILURE",
|
|
49
|
+
|
|
50
|
+
PERMANENT_CHANNEL_FAILURE = "PERMANENT_CHANNEL_FAILURE",
|
|
51
|
+
|
|
52
|
+
EXPIRY_TOO_FAR = "EXPIRY_TOO_FAR",
|
|
53
|
+
|
|
54
|
+
MPP_TIMEOUT = "MPP_TIMEOUT",
|
|
55
|
+
|
|
56
|
+
INVALID_ONION_PAYLOAD = "INVALID_ONION_PAYLOAD",
|
|
57
|
+
|
|
58
|
+
INTERNAL_FAILURE = "INTERNAL_FAILURE",
|
|
59
|
+
|
|
60
|
+
UNKNOWN_FAILURE = "UNKNOWN_FAILURE",
|
|
61
|
+
|
|
62
|
+
UNREADABLE_FAILURE = "UNREADABLE_FAILURE",
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default HtlcAttemptFailureCode;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { Query } from "@lightsparkdev/core";
|
|
4
|
+
import autoBind from "auto-bind";
|
|
5
|
+
import LightsparkClient from "../client.js";
|
|
6
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
7
|
+
import IncomingPaymentAttemptStatus from "./IncomingPaymentAttemptStatus.js";
|
|
8
|
+
import IncomingPaymentToAttemptsConnection, {
|
|
9
|
+
IncomingPaymentToAttemptsConnectionFromJson,
|
|
10
|
+
} from "./IncomingPaymentToAttemptsConnection.js";
|
|
11
|
+
import LightningTransaction from "./LightningTransaction.js";
|
|
12
|
+
import TransactionStatus from "./TransactionStatus.js";
|
|
13
|
+
|
|
14
|
+
/** A transaction that was sent to a Lightspark node on the Lightning Network. **/
|
|
15
|
+
class IncomingPayment implements LightningTransaction {
|
|
16
|
+
constructor(
|
|
17
|
+
public readonly id: string,
|
|
18
|
+
public readonly createdAt: string,
|
|
19
|
+
public readonly updatedAt: string,
|
|
20
|
+
public readonly status: TransactionStatus,
|
|
21
|
+
public readonly amount: CurrencyAmount,
|
|
22
|
+
public readonly destinationId: string,
|
|
23
|
+
public readonly typename: string,
|
|
24
|
+
public readonly resolvedAt?: string,
|
|
25
|
+
public readonly transactionHash?: string,
|
|
26
|
+
public readonly originId?: string,
|
|
27
|
+
public readonly paymentRequestId?: string
|
|
28
|
+
) {
|
|
29
|
+
autoBind(this);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async getAttempts(
|
|
33
|
+
client: LightsparkClient,
|
|
34
|
+
first: number | undefined = undefined,
|
|
35
|
+
statuses: IncomingPaymentAttemptStatus[] | undefined = undefined
|
|
36
|
+
): Promise<IncomingPaymentToAttemptsConnection> {
|
|
37
|
+
return (await client.executeRawQuery({
|
|
38
|
+
queryPayload: `
|
|
39
|
+
query FetchIncomingPaymentToAttemptsConnection($entity_id: ID!, $first: Int, $statuses: [IncomingPaymentAttemptStatus!]) {
|
|
40
|
+
entity(id: $entity_id) {
|
|
41
|
+
... on IncomingPayment {
|
|
42
|
+
attempts(, first: $first, statuses: $statuses) {
|
|
43
|
+
__typename
|
|
44
|
+
incoming_payment_to_attempts_connection_count: count
|
|
45
|
+
incoming_payment_to_attempts_connection_entities: entities {
|
|
46
|
+
__typename
|
|
47
|
+
incoming_payment_attempt_id: id
|
|
48
|
+
incoming_payment_attempt_created_at: created_at
|
|
49
|
+
incoming_payment_attempt_updated_at: updated_at
|
|
50
|
+
incoming_payment_attempt_status: status
|
|
51
|
+
incoming_payment_attempt_resolved_at: resolved_at
|
|
52
|
+
incoming_payment_attempt_amount: amount {
|
|
53
|
+
__typename
|
|
54
|
+
currency_amount_original_value: original_value
|
|
55
|
+
currency_amount_original_unit: original_unit
|
|
56
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
57
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
58
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
59
|
+
}
|
|
60
|
+
incoming_payment_attempt_channel: channel {
|
|
61
|
+
id
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`,
|
|
69
|
+
variables: { entity_id: this.id, first: first, statuses: statuses },
|
|
70
|
+
constructObject: (json) => {
|
|
71
|
+
const connection = json["entity"]["attempts"];
|
|
72
|
+
return IncomingPaymentToAttemptsConnectionFromJson(connection);
|
|
73
|
+
},
|
|
74
|
+
}))!;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static getIncomingPaymentQuery(id: string): Query<IncomingPayment> {
|
|
78
|
+
return {
|
|
79
|
+
queryPayload: `
|
|
80
|
+
query GetIncomingPayment($id: ID!) {
|
|
81
|
+
entity(id: $id) {
|
|
82
|
+
... on IncomingPayment {
|
|
83
|
+
...IncomingPaymentFragment
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
${FRAGMENT}
|
|
89
|
+
`,
|
|
90
|
+
variables: { id },
|
|
91
|
+
constructObject: (data: any) => IncomingPaymentFromJson(data.entity),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const IncomingPaymentFromJson = (obj: any): IncomingPayment => {
|
|
97
|
+
return new IncomingPayment(
|
|
98
|
+
obj["incoming_payment_id"],
|
|
99
|
+
obj["incoming_payment_created_at"],
|
|
100
|
+
obj["incoming_payment_updated_at"],
|
|
101
|
+
TransactionStatus[obj["incoming_payment_status"]] ??
|
|
102
|
+
TransactionStatus.FUTURE_VALUE,
|
|
103
|
+
CurrencyAmountFromJson(obj["incoming_payment_amount"]),
|
|
104
|
+
obj["incoming_payment_destination"].id,
|
|
105
|
+
"IncomingPayment",
|
|
106
|
+
obj["incoming_payment_resolved_at"],
|
|
107
|
+
obj["incoming_payment_transaction_hash"],
|
|
108
|
+
obj["incoming_payment_origin"]?.id ?? undefined,
|
|
109
|
+
obj["incoming_payment_payment_request"]?.id ?? undefined
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const FRAGMENT = `
|
|
114
|
+
fragment IncomingPaymentFragment on IncomingPayment {
|
|
115
|
+
__typename
|
|
116
|
+
incoming_payment_id: id
|
|
117
|
+
incoming_payment_created_at: created_at
|
|
118
|
+
incoming_payment_updated_at: updated_at
|
|
119
|
+
incoming_payment_status: status
|
|
120
|
+
incoming_payment_resolved_at: resolved_at
|
|
121
|
+
incoming_payment_amount: amount {
|
|
122
|
+
__typename
|
|
123
|
+
currency_amount_original_value: original_value
|
|
124
|
+
currency_amount_original_unit: original_unit
|
|
125
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
126
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
127
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
128
|
+
}
|
|
129
|
+
incoming_payment_transaction_hash: transaction_hash
|
|
130
|
+
incoming_payment_origin: origin {
|
|
131
|
+
id
|
|
132
|
+
}
|
|
133
|
+
incoming_payment_destination: destination {
|
|
134
|
+
id
|
|
135
|
+
}
|
|
136
|
+
incoming_payment_payment_request: payment_request {
|
|
137
|
+
id
|
|
138
|
+
}
|
|
139
|
+
}`;
|
|
140
|
+
|
|
141
|
+
export default IncomingPayment;
|
|
@@ -0,0 +1,96 @@
|
|
|
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 IncomingPaymentAttemptStatus from "./IncomingPaymentAttemptStatus.js";
|
|
7
|
+
|
|
8
|
+
/** An attempt for a payment over a route from sender node to recipient node. **/
|
|
9
|
+
type IncomingPaymentAttempt = Entity & {
|
|
10
|
+
/**
|
|
11
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
12
|
+
* string.
|
|
13
|
+
**/
|
|
14
|
+
id: string;
|
|
15
|
+
|
|
16
|
+
/** The date and time when the entity was first created. **/
|
|
17
|
+
createdAt: string;
|
|
18
|
+
|
|
19
|
+
/** The date and time when the entity was last updated. **/
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
|
|
22
|
+
/** The status of the incoming payment attempt. **/
|
|
23
|
+
status: IncomingPaymentAttemptStatus;
|
|
24
|
+
|
|
25
|
+
/** The total amount of that was attempted to send. **/
|
|
26
|
+
amount: CurrencyAmount;
|
|
27
|
+
|
|
28
|
+
/** The channel this attempt was made on. **/
|
|
29
|
+
channelId: string;
|
|
30
|
+
|
|
31
|
+
/** The typename of the object **/
|
|
32
|
+
typename: string;
|
|
33
|
+
|
|
34
|
+
/** The time the incoming payment attempt failed or succeeded. **/
|
|
35
|
+
resolvedAt?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const IncomingPaymentAttemptFromJson = (
|
|
39
|
+
obj: any
|
|
40
|
+
): IncomingPaymentAttempt => {
|
|
41
|
+
return {
|
|
42
|
+
id: obj["incoming_payment_attempt_id"],
|
|
43
|
+
createdAt: obj["incoming_payment_attempt_created_at"],
|
|
44
|
+
updatedAt: obj["incoming_payment_attempt_updated_at"],
|
|
45
|
+
status:
|
|
46
|
+
IncomingPaymentAttemptStatus[obj["incoming_payment_attempt_status"]] ??
|
|
47
|
+
IncomingPaymentAttemptStatus.FUTURE_VALUE,
|
|
48
|
+
amount: CurrencyAmountFromJson(obj["incoming_payment_attempt_amount"]),
|
|
49
|
+
channelId: obj["incoming_payment_attempt_channel"].id,
|
|
50
|
+
typename: "IncomingPaymentAttempt",
|
|
51
|
+
resolvedAt: obj["incoming_payment_attempt_resolved_at"],
|
|
52
|
+
} as IncomingPaymentAttempt;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const FRAGMENT = `
|
|
56
|
+
fragment IncomingPaymentAttemptFragment on IncomingPaymentAttempt {
|
|
57
|
+
__typename
|
|
58
|
+
incoming_payment_attempt_id: id
|
|
59
|
+
incoming_payment_attempt_created_at: created_at
|
|
60
|
+
incoming_payment_attempt_updated_at: updated_at
|
|
61
|
+
incoming_payment_attempt_status: status
|
|
62
|
+
incoming_payment_attempt_resolved_at: resolved_at
|
|
63
|
+
incoming_payment_attempt_amount: amount {
|
|
64
|
+
__typename
|
|
65
|
+
currency_amount_original_value: original_value
|
|
66
|
+
currency_amount_original_unit: original_unit
|
|
67
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
68
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
69
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
70
|
+
}
|
|
71
|
+
incoming_payment_attempt_channel: channel {
|
|
72
|
+
id
|
|
73
|
+
}
|
|
74
|
+
}`;
|
|
75
|
+
|
|
76
|
+
export const getIncomingPaymentAttemptQuery = (
|
|
77
|
+
id: string
|
|
78
|
+
): Query<IncomingPaymentAttempt> => {
|
|
79
|
+
return {
|
|
80
|
+
queryPayload: `
|
|
81
|
+
query GetIncomingPaymentAttempt($id: ID!) {
|
|
82
|
+
entity(id: $id) {
|
|
83
|
+
... on IncomingPaymentAttempt {
|
|
84
|
+
...IncomingPaymentAttemptFragment
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
${FRAGMENT}
|
|
90
|
+
`,
|
|
91
|
+
variables: { id },
|
|
92
|
+
constructObject: (data: any) => IncomingPaymentAttemptFromJson(data.entity),
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export default IncomingPaymentAttempt;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
/** Enum that enumerates all the possible status of an incoming payment attempt. **/
|
|
4
|
+
export enum IncomingPaymentAttemptStatus {
|
|
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
|
+
ACCEPTED = "ACCEPTED",
|
|
12
|
+
|
|
13
|
+
SETTLED = "SETTLED",
|
|
14
|
+
|
|
15
|
+
CANCELED = "CANCELED",
|
|
16
|
+
|
|
17
|
+
UNKNOWN = "UNKNOWN",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default IncomingPaymentAttemptStatus;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import IncomingPaymentAttempt, {
|
|
4
|
+
IncomingPaymentAttemptFromJson,
|
|
5
|
+
} from "./IncomingPaymentAttempt.js";
|
|
6
|
+
|
|
7
|
+
/** The connection from incoming payment to all attempts. **/
|
|
8
|
+
type IncomingPaymentToAttemptsConnection = {
|
|
9
|
+
/**
|
|
10
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
11
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
12
|
+
**/
|
|
13
|
+
count: number;
|
|
14
|
+
|
|
15
|
+
/** The incoming payment attempts for the current page of this connection. **/
|
|
16
|
+
entities: IncomingPaymentAttempt[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const IncomingPaymentToAttemptsConnectionFromJson = (
|
|
20
|
+
obj: any
|
|
21
|
+
): IncomingPaymentToAttemptsConnection => {
|
|
22
|
+
return {
|
|
23
|
+
count: obj["incoming_payment_to_attempts_connection_count"],
|
|
24
|
+
entities: obj["incoming_payment_to_attempts_connection_entities"].map((e) =>
|
|
25
|
+
IncomingPaymentAttemptFromJson(e)
|
|
26
|
+
),
|
|
27
|
+
} as IncomingPaymentToAttemptsConnection;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const FRAGMENT = `
|
|
31
|
+
fragment IncomingPaymentToAttemptsConnectionFragment on IncomingPaymentToAttemptsConnection {
|
|
32
|
+
__typename
|
|
33
|
+
incoming_payment_to_attempts_connection_count: count
|
|
34
|
+
incoming_payment_to_attempts_connection_entities: entities {
|
|
35
|
+
id
|
|
36
|
+
}
|
|
37
|
+
}`;
|
|
38
|
+
|
|
39
|
+
export default IncomingPaymentToAttemptsConnection;
|