@lightsparkdev/lightspark-sdk 1.1.6 → 1.2.0
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/CHANGELOG.md +14 -0
- package/dist/{chunk-7UNNCH5S.js → chunk-VTPDR6P4.js} +1270 -342
- package/dist/{index-5235e43b.d.ts → index-f040db9f.d.ts} +707 -407
- package/dist/index.cjs +1247 -319
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/objects/index.cjs +1180 -306
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +5 -5
- package/package.json +2 -2
- package/src/objects/Account.ts +175 -2
- package/src/objects/AccountToApiTokensConnection.ts +16 -5
- package/src/objects/AccountToChannelsConnection.ts +9 -0
- package/src/objects/AccountToNodesConnection.ts +19 -5
- package/src/objects/AccountToPaymentRequestsConnection.ts +21 -5
- package/src/objects/AccountToTransactionsConnection.ts +33 -9
- package/src/objects/AccountToWalletsConnection.ts +13 -4
- package/src/objects/ApiToken.ts +13 -3
- package/src/objects/Balances.ts +17 -3
- package/src/objects/BlockchainBalance.ts +34 -9
- package/src/objects/Channel.ts +61 -16
- package/src/objects/ChannelClosingTransaction.ts +81 -61
- package/src/objects/ChannelFees.ts +16 -5
- package/src/objects/ChannelOpeningTransaction.ts +81 -61
- package/src/objects/ChannelSnapshot.ts +66 -6
- package/src/objects/ChannelToTransactionsConnection.ts +26 -6
- package/src/objects/Connection.ts +205 -10
- package/src/objects/CreateApiTokenInput.ts +8 -2
- package/src/objects/CreateApiTokenOutput.ts +9 -3
- package/src/objects/CreateInvoiceInput.ts +14 -5
- package/src/objects/CreateInvoiceOutput.ts +7 -2
- package/src/objects/CreateLnurlInvoiceInput.ts +13 -3
- package/src/objects/CreateNodeWalletAddressInput.ts +9 -2
- package/src/objects/CreateNodeWalletAddressOutput.ts +10 -2
- package/src/objects/CreateTestModeInvoiceInput.ts +14 -4
- package/src/objects/CreateTestModeInvoiceOutput.ts +10 -2
- package/src/objects/CreateTestModePaymentInput.ts +12 -3
- package/src/objects/CreateTestModePaymentoutput.ts +12 -2
- package/src/objects/CreateUmaInvoiceInput.ts +13 -3
- package/src/objects/CurrencyAmount.ts +13 -2
- package/src/objects/DeclineToSignMessagesInput.ts +9 -2
- package/src/objects/DeclineToSignMessagesOutput.ts +15 -3
- package/src/objects/DeleteApiTokenInput.ts +7 -2
- package/src/objects/DeleteApiTokenOutput.ts +7 -2
- package/src/objects/Deposit.ts +77 -61
- package/src/objects/Entity.ts +184 -2
- package/src/objects/FeeEstimate.ts +12 -3
- package/src/objects/FundNodeInput.ts +9 -3
- package/src/objects/FundNodeOutput.ts +11 -3
- package/src/objects/GraphNode.ts +21 -5
- package/src/objects/Hop.ts +27 -9
- package/src/objects/HtlcAttemptFailureCode.ts +2 -0
- package/src/objects/IdAndSignature.ts +8 -2
- package/src/objects/IncomingPayment.ts +33 -7
- package/src/objects/IncomingPaymentAttempt.ts +21 -5
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
- package/src/objects/Invoice.ts +91 -24
- package/src/objects/InvoiceData.ts +75 -6
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
- package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
- package/src/objects/LightningFeeEstimateOutput.ts +15 -3
- package/src/objects/LightningTransaction.ts +171 -28
- package/src/objects/LightsparkNode.ts +311 -208
- package/src/objects/LightsparkNodeOwner.ts +35 -4
- package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
- package/src/objects/LightsparkNodeWithOSK.ts +97 -15
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +93 -13
- package/src/objects/Node.ts +269 -67
- package/src/objects/NodeAddress.ts +8 -2
- package/src/objects/NodeToAddressesConnection.ts +13 -3
- package/src/objects/OnChainTransaction.ts +156 -44
- package/src/objects/OutgoingPayment.ts +127 -14
- package/src/objects/OutgoingPaymentAttempt.ts +57 -8
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
- package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
- package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
- package/src/objects/PageInfo.ts +14 -6
- package/src/objects/PayInvoiceInput.ts +12 -3
- package/src/objects/PayInvoiceOutput.ts +7 -2
- package/src/objects/PayUmaInvoiceInput.ts +12 -3
- package/src/objects/PaymentRequest.ts +81 -5
- package/src/objects/PaymentRequestData.ts +81 -4
- package/src/objects/PostTransactionData.ts +12 -3
- package/src/objects/RegisterPaymentInput.ts +10 -2
- package/src/objects/RegisterPaymentOutput.ts +9 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
- package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
- package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
- package/src/objects/RequestWithdrawalInput.ts +12 -2
- package/src/objects/RequestWithdrawalOutput.ts +9 -2
- package/src/objects/RichText.ts +7 -2
- package/src/objects/RoutingTransaction.ts +62 -41
- package/src/objects/ScreenNodeInput.ts +8 -2
- package/src/objects/ScreenNodeOutput.ts +7 -2
- package/src/objects/Secret.ts +8 -2
- package/src/objects/SendPaymentInput.ts +11 -2
- package/src/objects/SendPaymentOutput.ts +7 -2
- package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
- package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
- package/src/objects/SignInvoiceInput.ts +9 -2
- package/src/objects/SignInvoiceOutput.ts +7 -2
- package/src/objects/SignMessagesInput.ts +13 -3
- package/src/objects/SignMessagesOutput.ts +13 -3
- package/src/objects/Signable.ts +10 -3
- package/src/objects/SignablePayload.ts +18 -5
- package/src/objects/Transaction.ts +260 -9
- package/src/objects/TransactionFailures.ts +11 -4
- package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
- package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
- package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
- package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
- package/src/objects/Wallet.ts +130 -5
- package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
- package/src/objects/WalletToTransactionsConnection.ts +16 -5
- package/src/objects/Withdrawal.ts +77 -61
- package/src/objects/WithdrawalRequest.ts +25 -4
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
- package/src/objects/index.ts +5 -2
- package/src/tests/integration/client.test.ts +46 -7
- package/src/tests/serialization.test.ts +18 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateTestModeInvoiceOutput {
|
|
4
4
|
encodedPaymentRequest: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const CreateTestModeInvoiceOutputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -12,6 +12,14 @@ export const CreateTestModeInvoiceOutputFromJson = (
|
|
|
12
12
|
obj["create_test_mode_invoice_output_encoded_payment_request"],
|
|
13
13
|
} as CreateTestModeInvoiceOutput;
|
|
14
14
|
};
|
|
15
|
+
export const CreateTestModeInvoiceOutputToJson = (
|
|
16
|
+
obj: CreateTestModeInvoiceOutput,
|
|
17
|
+
): any => {
|
|
18
|
+
return {
|
|
19
|
+
create_test_mode_invoice_output_encoded_payment_request:
|
|
20
|
+
obj.encodedPaymentRequest,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
15
23
|
|
|
16
24
|
export const FRAGMENT = `
|
|
17
25
|
fragment CreateTestModeInvoiceOutputFragment on CreateTestModeInvoiceOutput {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateTestModePaymentInput {
|
|
4
4
|
/** The node to where you want to send the payment. **/
|
|
5
5
|
localNodeId: string;
|
|
6
6
|
|
|
@@ -11,8 +11,8 @@ type CreateTestModePaymentInput = {
|
|
|
11
11
|
* The amount you will be paid for this invoice, expressed in msats. It should ONLY be set when the
|
|
12
12
|
* invoice amount is zero.
|
|
13
13
|
**/
|
|
14
|
-
amountMsats?: number;
|
|
15
|
-
}
|
|
14
|
+
amountMsats?: number | undefined;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
export const CreateTestModePaymentInputFromJson = (
|
|
18
18
|
obj: any,
|
|
@@ -23,5 +23,14 @@ export const CreateTestModePaymentInputFromJson = (
|
|
|
23
23
|
amountMsats: obj["create_test_mode_payment_input_amount_msats"],
|
|
24
24
|
} as CreateTestModePaymentInput;
|
|
25
25
|
};
|
|
26
|
+
export const CreateTestModePaymentInputToJson = (
|
|
27
|
+
obj: CreateTestModePaymentInput,
|
|
28
|
+
): any => {
|
|
29
|
+
return {
|
|
30
|
+
create_test_mode_payment_input_local_node_id: obj.localNodeId,
|
|
31
|
+
create_test_mode_payment_input_encoded_invoice: obj.encodedInvoice,
|
|
32
|
+
create_test_mode_payment_input_amount_msats: obj.amountMsats,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
26
35
|
|
|
27
36
|
export default CreateTestModePaymentInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
/** This is an object identifying the output of a test mode payment. This object can be used to retrieve the associated payment made from a Test Mode Payment call. **/
|
|
4
|
-
|
|
4
|
+
interface CreateTestModePaymentoutput {
|
|
5
5
|
/**
|
|
6
6
|
* The payment that has been sent.
|
|
7
7
|
*
|
|
@@ -11,7 +11,7 @@ type CreateTestModePaymentoutput = {
|
|
|
11
11
|
|
|
12
12
|
/** The payment that has been received. **/
|
|
13
13
|
incomingPaymentId: string;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
export const CreateTestModePaymentoutputFromJson = (
|
|
17
17
|
obj: any,
|
|
@@ -22,6 +22,16 @@ export const CreateTestModePaymentoutputFromJson = (
|
|
|
22
22
|
obj["create_test_mode_paymentoutput_incoming_payment"].id,
|
|
23
23
|
} as CreateTestModePaymentoutput;
|
|
24
24
|
};
|
|
25
|
+
export const CreateTestModePaymentoutputToJson = (
|
|
26
|
+
obj: CreateTestModePaymentoutput,
|
|
27
|
+
): any => {
|
|
28
|
+
return {
|
|
29
|
+
create_test_mode_paymentoutput_payment: { id: obj.paymentId },
|
|
30
|
+
create_test_mode_paymentoutput_incoming_payment: {
|
|
31
|
+
id: obj.incomingPaymentId,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
};
|
|
25
35
|
|
|
26
36
|
export const FRAGMENT = `
|
|
27
37
|
fragment CreateTestModePaymentoutputFragment on CreateTestModePaymentoutput {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateUmaInvoiceInput {
|
|
4
4
|
nodeId: string;
|
|
5
5
|
|
|
6
6
|
amountMsats: number;
|
|
7
7
|
|
|
8
8
|
metadataHash: string;
|
|
9
9
|
|
|
10
|
-
expirySecs?: number;
|
|
11
|
-
}
|
|
10
|
+
expirySecs?: number | undefined;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export const CreateUmaInvoiceInputFromJson = (
|
|
14
14
|
obj: any,
|
|
@@ -20,5 +20,15 @@ export const CreateUmaInvoiceInputFromJson = (
|
|
|
20
20
|
expirySecs: obj["create_uma_invoice_input_expiry_secs"],
|
|
21
21
|
} as CreateUmaInvoiceInput;
|
|
22
22
|
};
|
|
23
|
+
export const CreateUmaInvoiceInputToJson = (
|
|
24
|
+
obj: CreateUmaInvoiceInput,
|
|
25
|
+
): any => {
|
|
26
|
+
return {
|
|
27
|
+
create_uma_invoice_input_node_id: obj.nodeId,
|
|
28
|
+
create_uma_invoice_input_amount_msats: obj.amountMsats,
|
|
29
|
+
create_uma_invoice_input_metadata_hash: obj.metadataHash,
|
|
30
|
+
create_uma_invoice_input_expiry_secs: obj.expirySecs,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
23
33
|
|
|
24
34
|
export default CreateUmaInvoiceInput;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import CurrencyUnit from "./CurrencyUnit.js";
|
|
4
4
|
|
|
5
5
|
/** This object represents the value and unit for an amount of currency. **/
|
|
6
|
-
|
|
6
|
+
interface CurrencyAmount {
|
|
7
7
|
/** The original numeric value for this CurrencyAmount. **/
|
|
8
8
|
originalValue: number;
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ type CurrencyAmount = {
|
|
|
24
24
|
* currency. For example, for USD, the value will be in cents.
|
|
25
25
|
**/
|
|
26
26
|
preferredCurrencyValueApprox: number;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
export const CurrencyAmountFromJson = (obj: any): CurrencyAmount => {
|
|
30
30
|
return {
|
|
@@ -41,6 +41,17 @@ export const CurrencyAmountFromJson = (obj: any): CurrencyAmount => {
|
|
|
41
41
|
obj["currency_amount_preferred_currency_value_approx"],
|
|
42
42
|
} as CurrencyAmount;
|
|
43
43
|
};
|
|
44
|
+
export const CurrencyAmountToJson = (obj: CurrencyAmount): any => {
|
|
45
|
+
return {
|
|
46
|
+
currency_amount_original_value: obj.originalValue,
|
|
47
|
+
currency_amount_original_unit: obj.originalUnit,
|
|
48
|
+
currency_amount_preferred_currency_unit: obj.preferredCurrencyUnit,
|
|
49
|
+
currency_amount_preferred_currency_value_rounded:
|
|
50
|
+
obj.preferredCurrencyValueRounded,
|
|
51
|
+
currency_amount_preferred_currency_value_approx:
|
|
52
|
+
obj.preferredCurrencyValueApprox,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
44
55
|
|
|
45
56
|
export const FRAGMENT = `
|
|
46
57
|
fragment CurrencyAmountFragment on CurrencyAmount {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface DeclineToSignMessagesInput {
|
|
4
4
|
/** List of payload ids to decline to sign because validation failed. **/
|
|
5
5
|
payloadIds: string[];
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const DeclineToSignMessagesInputFromJson = (
|
|
9
9
|
obj: any,
|
|
@@ -12,5 +12,12 @@ export const DeclineToSignMessagesInputFromJson = (
|
|
|
12
12
|
payloadIds: obj["decline_to_sign_messages_input_payload_ids"],
|
|
13
13
|
} as DeclineToSignMessagesInput;
|
|
14
14
|
};
|
|
15
|
+
export const DeclineToSignMessagesInputToJson = (
|
|
16
|
+
obj: DeclineToSignMessagesInput,
|
|
17
|
+
): any => {
|
|
18
|
+
return {
|
|
19
|
+
decline_to_sign_messages_input_payload_ids: obj.payloadIds,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
15
22
|
|
|
16
23
|
export default DeclineToSignMessagesInput;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type SignablePayload from "./SignablePayload.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
SignablePayloadFromJson,
|
|
6
|
+
SignablePayloadToJson,
|
|
7
|
+
} from "./SignablePayload.js";
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
interface DeclineToSignMessagesOutput {
|
|
7
10
|
declinedPayloads: SignablePayload[];
|
|
8
|
-
}
|
|
11
|
+
}
|
|
9
12
|
|
|
10
13
|
export const DeclineToSignMessagesOutputFromJson = (
|
|
11
14
|
obj: any,
|
|
@@ -16,6 +19,15 @@ export const DeclineToSignMessagesOutputFromJson = (
|
|
|
16
19
|
].map((e) => SignablePayloadFromJson(e)),
|
|
17
20
|
} as DeclineToSignMessagesOutput;
|
|
18
21
|
};
|
|
22
|
+
export const DeclineToSignMessagesOutputToJson = (
|
|
23
|
+
obj: DeclineToSignMessagesOutput,
|
|
24
|
+
): any => {
|
|
25
|
+
return {
|
|
26
|
+
decline_to_sign_messages_output_declined_payloads: obj.declinedPayloads.map(
|
|
27
|
+
(e) => SignablePayloadToJson(e),
|
|
28
|
+
),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
19
31
|
|
|
20
32
|
export const FRAGMENT = `
|
|
21
33
|
fragment DeclineToSignMessagesOutputFragment on DeclineToSignMessagesOutput {
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface DeleteApiTokenInput {
|
|
4
4
|
apiTokenId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const DeleteApiTokenInputFromJson = (obj: any): DeleteApiTokenInput => {
|
|
8
8
|
return {
|
|
9
9
|
apiTokenId: obj["delete_api_token_input_api_token_id"],
|
|
10
10
|
} as DeleteApiTokenInput;
|
|
11
11
|
};
|
|
12
|
+
export const DeleteApiTokenInputToJson = (obj: DeleteApiTokenInput): any => {
|
|
13
|
+
return {
|
|
14
|
+
delete_api_token_input_api_token_id: obj.apiTokenId,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
export default DeleteApiTokenInput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface DeleteApiTokenOutput {
|
|
4
4
|
accountId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const DeleteApiTokenOutputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -11,6 +11,11 @@ export const DeleteApiTokenOutputFromJson = (
|
|
|
11
11
|
accountId: obj["delete_api_token_output_account"].id,
|
|
12
12
|
} as DeleteApiTokenOutput;
|
|
13
13
|
};
|
|
14
|
+
export const DeleteApiTokenOutputToJson = (obj: DeleteApiTokenOutput): any => {
|
|
15
|
+
return {
|
|
16
|
+
delete_api_token_output_account: { id: obj.accountId },
|
|
17
|
+
};
|
|
18
|
+
};
|
|
14
19
|
|
|
15
20
|
export const FRAGMENT = `
|
|
16
21
|
fragment DeleteApiTokenOutputFragment on DeleteApiTokenOutput {
|
package/src/objects/Deposit.ts
CHANGED
|
@@ -2,70 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {
|
|
6
|
+
CurrencyAmountFromJson,
|
|
7
|
+
CurrencyAmountToJson,
|
|
8
|
+
} from "./CurrencyAmount.js";
|
|
9
9
|
import TransactionStatus from "./TransactionStatus.js";
|
|
10
10
|
|
|
11
11
|
/** This object represents a Deposit made to a Lightspark node wallet. This operation occurs for any L1 funding transaction to the wallet. You can retrieve this object to receive detailed information about the deposit. **/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
numConfirmations?: number;
|
|
68
|
-
};
|
|
12
|
+
interface Deposit {
|
|
13
|
+
/**
|
|
14
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
15
|
+
* string.
|
|
16
|
+
**/
|
|
17
|
+
id: string;
|
|
18
|
+
|
|
19
|
+
/** The date and time when this transaction was initiated. **/
|
|
20
|
+
createdAt: string;
|
|
21
|
+
|
|
22
|
+
/** The date and time when the entity was last updated. **/
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
|
|
25
|
+
/** The current status of this transaction. **/
|
|
26
|
+
status: TransactionStatus;
|
|
27
|
+
|
|
28
|
+
/** The amount of money involved in this transaction. **/
|
|
29
|
+
amount: CurrencyAmount;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The height of the block that included this transaction. This will be zero for unconfirmed
|
|
33
|
+
* transactions.
|
|
34
|
+
**/
|
|
35
|
+
blockHeight: number;
|
|
36
|
+
|
|
37
|
+
/** The Bitcoin blockchain addresses this transaction was sent to. **/
|
|
38
|
+
destinationAddresses: string[];
|
|
39
|
+
|
|
40
|
+
/** The recipient Lightspark node this deposit was sent to. **/
|
|
41
|
+
destinationId: string;
|
|
42
|
+
|
|
43
|
+
/** The typename of the object **/
|
|
44
|
+
typename: string;
|
|
45
|
+
|
|
46
|
+
/** The date and time when this transaction was completed or failed. **/
|
|
47
|
+
resolvedAt?: string | undefined;
|
|
48
|
+
|
|
49
|
+
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
50
|
+
transactionHash?: string | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
|
|
54
|
+
* blockchain.
|
|
55
|
+
**/
|
|
56
|
+
fees?: CurrencyAmount | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The hash of the block that included this transaction. This will be null for unconfirmed
|
|
60
|
+
* transactions.
|
|
61
|
+
**/
|
|
62
|
+
blockHash?: string | undefined;
|
|
63
|
+
|
|
64
|
+
/** The number of blockchain confirmations for this transaction in real time. **/
|
|
65
|
+
numConfirmations?: number | undefined;
|
|
66
|
+
}
|
|
69
67
|
|
|
70
68
|
export const DepositFromJson = (obj: any): Deposit => {
|
|
71
69
|
return {
|
|
@@ -89,6 +87,24 @@ export const DepositFromJson = (obj: any): Deposit => {
|
|
|
89
87
|
numConfirmations: obj["deposit_num_confirmations"],
|
|
90
88
|
} as Deposit;
|
|
91
89
|
};
|
|
90
|
+
export const DepositToJson = (obj: Deposit): any => {
|
|
91
|
+
return {
|
|
92
|
+
__typename: "Deposit",
|
|
93
|
+
deposit_id: obj.id,
|
|
94
|
+
deposit_created_at: obj.createdAt,
|
|
95
|
+
deposit_updated_at: obj.updatedAt,
|
|
96
|
+
deposit_status: obj.status,
|
|
97
|
+
deposit_resolved_at: obj.resolvedAt,
|
|
98
|
+
deposit_amount: CurrencyAmountToJson(obj.amount),
|
|
99
|
+
deposit_transaction_hash: obj.transactionHash,
|
|
100
|
+
deposit_fees: obj.fees ? CurrencyAmountToJson(obj.fees) : undefined,
|
|
101
|
+
deposit_block_hash: obj.blockHash,
|
|
102
|
+
deposit_block_height: obj.blockHeight,
|
|
103
|
+
deposit_destination_addresses: obj.destinationAddresses,
|
|
104
|
+
deposit_num_confirmations: obj.numConfirmations,
|
|
105
|
+
deposit_destination: { id: obj.destinationId },
|
|
106
|
+
};
|
|
107
|
+
};
|
|
92
108
|
|
|
93
109
|
export const FRAGMENT = `
|
|
94
110
|
fragment DepositFragment on Deposit {
|