@lightsparkdev/lightspark-sdk 1.1.7 → 1.2.1
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 +19 -0
- package/dist/{chunk-5RDIWPBE.js → chunk-D32EWIPX.js} +3 -1
- package/dist/{chunk-7UT6YX37.js → chunk-VTPDR6P4.js} +393 -275
- package/dist/env.cjs +3 -1
- package/dist/env.d.cts +17 -0
- package/dist/env.js +2 -2
- package/dist/{index-d31f4469.d.ts → index-5acc6526.d.ts} +1403 -408
- package/dist/index.cjs +424 -296
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +32 -27
- package/dist/objects/index.cjs +395 -277
- package/dist/objects/index.d.cts +4 -0
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +6 -6
- package/dist/{text-encoding-MDIPJAHL.js → text-encoding-26SMKBAQ.js} +3 -1
- package/package.json +5 -5
- package/src/auth/AccountTokenAuthProvider.ts +15 -11
- package/src/client.ts +7 -6
- package/src/helpers.ts +3 -1
- package/src/objects/Account.ts +21 -2
- package/src/objects/AccountToApiTokensConnection.ts +16 -5
- package/src/objects/AccountToChannelsConnection.ts +14 -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 +92 -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 +32 -8
- 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 +2 -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 +49 -5
- package/src/objects/Hop.ts +27 -9
- package/src/objects/IdAndSignature.ts +8 -2
- package/src/objects/IncomingPayment.ts +50 -7
- package/src/objects/IncomingPaymentAttempt.ts +21 -5
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
- package/src/objects/Invoice.ts +37 -24
- package/src/objects/InvoiceData.ts +21 -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 +117 -28
- package/src/objects/LightsparkNode.ts +250 -210
- package/src/objects/LightsparkNodeOwner.ts +35 -4
- package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
- package/src/objects/LightsparkNodeWithOSK.ts +127 -17
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +122 -15
- package/src/objects/Node.ts +209 -68
- 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 +72 -14
- package/src/objects/OutgoingPaymentAttempt.ts +63 -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 +27 -5
- package/src/objects/PaymentRequestData.ts +27 -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 +206 -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 +34 -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 +42 -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/constants.ts +13 -0
- package/src/tests/integration/general-regtest.test.ts +652 -0
- package/src/tests/serialization.test.ts +21 -0
- package/src/webhooks.ts +1 -1
- package/src/tests/integration/client.test.ts +0 -207
- /package/dist/{chunk-NIMBE7W3.js → chunk-BMTV3EA2.js} +0 -0
|
@@ -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 {
|
package/src/objects/Entity.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
/** This interface is used by all the entities in the Lightspark system. It defines a few core fields that are available everywhere. Any object that implements this interface can be queried using the `entity` query and its ID. **/
|
|
4
|
-
|
|
4
|
+
interface Entity {
|
|
5
5
|
/**
|
|
6
6
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
7
7
|
* string.
|
|
@@ -16,7 +16,7 @@ type Entity = {
|
|
|
16
16
|
|
|
17
17
|
/** The typename of the object **/
|
|
18
18
|
typename: string;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
|
|
21
21
|
export const FRAGMENT = `
|
|
22
22
|
fragment EntityFragment on Entity {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CurrencyAmountFromJson,
|
|
6
|
+
CurrencyAmountToJson,
|
|
7
|
+
} from "./CurrencyAmount.js";
|
|
5
8
|
|
|
6
9
|
/** This object represents the estimated L1 transaction fees for the Bitcoin network. Fee estimates are separated by potential confirmation speeds for settlement. **/
|
|
7
|
-
|
|
10
|
+
interface FeeEstimate {
|
|
8
11
|
feeFast: CurrencyAmount;
|
|
9
12
|
|
|
10
13
|
feeMin: CurrencyAmount;
|
|
11
|
-
}
|
|
14
|
+
}
|
|
12
15
|
|
|
13
16
|
export const FeeEstimateFromJson = (obj: any): FeeEstimate => {
|
|
14
17
|
return {
|
|
@@ -16,6 +19,12 @@ export const FeeEstimateFromJson = (obj: any): FeeEstimate => {
|
|
|
16
19
|
feeMin: CurrencyAmountFromJson(obj["fee_estimate_fee_min"]),
|
|
17
20
|
} as FeeEstimate;
|
|
18
21
|
};
|
|
22
|
+
export const FeeEstimateToJson = (obj: FeeEstimate): any => {
|
|
23
|
+
return {
|
|
24
|
+
fee_estimate_fee_fast: CurrencyAmountToJson(obj.feeFast),
|
|
25
|
+
fee_estimate_fee_min: CurrencyAmountToJson(obj.feeMin),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
19
28
|
|
|
20
29
|
export const FRAGMENT = `
|
|
21
30
|
fragment FeeEstimateFragment on FeeEstimate {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface FundNodeInput {
|
|
4
4
|
nodeId: string;
|
|
5
5
|
|
|
6
|
-
amountSats?: number;
|
|
7
|
-
}
|
|
6
|
+
amountSats?: number | undefined;
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
export const FundNodeInputFromJson = (obj: any): FundNodeInput => {
|
|
10
10
|
return {
|
|
@@ -12,5 +12,11 @@ export const FundNodeInputFromJson = (obj: any): FundNodeInput => {
|
|
|
12
12
|
amountSats: obj["fund_node_input_amount_sats"],
|
|
13
13
|
} as FundNodeInput;
|
|
14
14
|
};
|
|
15
|
+
export const FundNodeInputToJson = (obj: FundNodeInput): any => {
|
|
16
|
+
return {
|
|
17
|
+
fund_node_input_node_id: obj.nodeId,
|
|
18
|
+
fund_node_input_amount_sats: obj.amountSats,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
15
21
|
|
|
16
22
|
export default FundNodeInput;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CurrencyAmountFromJson,
|
|
6
|
+
CurrencyAmountToJson,
|
|
7
|
+
} from "./CurrencyAmount.js";
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
interface FundNodeOutput {
|
|
7
10
|
amount: CurrencyAmount;
|
|
8
|
-
}
|
|
11
|
+
}
|
|
9
12
|
|
|
10
13
|
export const FundNodeOutputFromJson = (obj: any): FundNodeOutput => {
|
|
11
14
|
return {
|
|
12
15
|
amount: CurrencyAmountFromJson(obj["fund_node_output_amount"]),
|
|
13
16
|
} as FundNodeOutput;
|
|
14
17
|
};
|
|
18
|
+
export const FundNodeOutputToJson = (obj: FundNodeOutput): any => {
|
|
19
|
+
return {
|
|
20
|
+
fund_node_output_amount: CurrencyAmountToJson(obj.amount),
|
|
21
|
+
};
|
|
22
|
+
};
|
|
15
23
|
|
|
16
24
|
export const FRAGMENT = `
|
|
17
25
|
fragment FundNodeOutputFragment on FundNodeOutput {
|
package/src/objects/GraphNode.ts
CHANGED
|
@@ -4,24 +4,53 @@ import { type Query } from "@lightsparkdev/core";
|
|
|
4
4
|
import autoBind from "auto-bind";
|
|
5
5
|
import type LightsparkClient from "../client.js";
|
|
6
6
|
import BitcoinNetwork from "./BitcoinNetwork.js";
|
|
7
|
+
import type Entity from "./Entity.js";
|
|
7
8
|
import type Node from "./Node.js";
|
|
8
9
|
import type NodeAddressType from "./NodeAddressType.js";
|
|
9
10
|
import type NodeToAddressesConnection from "./NodeToAddressesConnection.js";
|
|
10
11
|
import { NodeToAddressesConnectionFromJson } from "./NodeToAddressesConnection.js";
|
|
11
12
|
|
|
12
13
|
/** This object represents a node that exists on the Lightning Network, including nodes not managed by Lightspark. You can retrieve this object to get publicly available information about any node on the Lightning Network. **/
|
|
13
|
-
class GraphNode implements Node {
|
|
14
|
+
class GraphNode implements Node, Entity {
|
|
14
15
|
constructor(
|
|
16
|
+
/**
|
|
17
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
18
|
+
* string.
|
|
19
|
+
**/
|
|
15
20
|
public readonly id: string,
|
|
21
|
+
/** The date and time when the entity was first created. **/
|
|
16
22
|
public readonly createdAt: string,
|
|
23
|
+
/** The date and time when the entity was last updated. **/
|
|
17
24
|
public readonly updatedAt: string,
|
|
25
|
+
/** The Bitcoin Network this node is deployed in. **/
|
|
18
26
|
public readonly bitcoinNetwork: BitcoinNetwork,
|
|
27
|
+
/**
|
|
28
|
+
* The name of this node in the network. It will be the most human-readable option possible, depending
|
|
29
|
+
* on the data available for this node.
|
|
30
|
+
**/
|
|
19
31
|
public readonly displayName: string,
|
|
32
|
+
/** The typename of the object **/
|
|
20
33
|
public readonly typename: string,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
/**
|
|
35
|
+
* A name that identifies the node. It has no importance in terms of operating the node, it is just a
|
|
36
|
+
* way to identify and search for commercial services or popular nodes. This alias can be changed at
|
|
37
|
+
* any time by the node operator.
|
|
38
|
+
**/
|
|
39
|
+
public readonly alias?: string | undefined,
|
|
40
|
+
/**
|
|
41
|
+
* A hexadecimal string that describes a color. For example "#000000" is black, "#FFFFFF" is white. It
|
|
42
|
+
* has no importance in terms of operating the node, it is just a way to visually differentiate nodes.
|
|
43
|
+
* That color can be changed at any time by the node operator.
|
|
44
|
+
**/
|
|
45
|
+
public readonly color?: string | undefined,
|
|
46
|
+
/**
|
|
47
|
+
* A summary metric used to capture how well positioned a node is to send, receive, or route
|
|
48
|
+
* transactions efficiently. Maximizing a node's conductivity helps a node’s transactions to be
|
|
49
|
+
* capital efficient. The value is an integer ranging between 0 and 10 (bounds included).
|
|
50
|
+
**/
|
|
51
|
+
public readonly conductivity?: number | undefined,
|
|
52
|
+
/** The public key of this node. It acts as a unique identifier of this node in the Lightning Network. **/
|
|
53
|
+
public readonly publicKey?: string | undefined,
|
|
25
54
|
) {
|
|
26
55
|
autoBind(this);
|
|
27
56
|
}
|
|
@@ -74,6 +103,21 @@ ${FRAGMENT}
|
|
|
74
103
|
constructObject: (data: any) => GraphNodeFromJson(data.entity),
|
|
75
104
|
};
|
|
76
105
|
}
|
|
106
|
+
|
|
107
|
+
public toJson() {
|
|
108
|
+
return {
|
|
109
|
+
__typename: "GraphNode",
|
|
110
|
+
graph_node_id: this.id,
|
|
111
|
+
graph_node_created_at: this.createdAt,
|
|
112
|
+
graph_node_updated_at: this.updatedAt,
|
|
113
|
+
graph_node_alias: this.alias,
|
|
114
|
+
graph_node_bitcoin_network: this.bitcoinNetwork,
|
|
115
|
+
graph_node_color: this.color,
|
|
116
|
+
graph_node_conductivity: this.conductivity,
|
|
117
|
+
graph_node_display_name: this.displayName,
|
|
118
|
+
graph_node_public_key: this.publicKey,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
77
121
|
}
|
|
78
122
|
|
|
79
123
|
export const GraphNodeFromJson = (obj: any): GraphNode => {
|
package/src/objects/Hop.ts
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
CurrencyAmountFromJson,
|
|
7
|
+
CurrencyAmountToJson,
|
|
8
|
+
} from "./CurrencyAmount.js";
|
|
7
9
|
|
|
8
10
|
/** This object represents a specific node that existed on a particular payment route. You can retrieve this object to get information about a node on a particular payment path and all payment-relevant information for that node. **/
|
|
9
|
-
|
|
11
|
+
interface Hop {
|
|
10
12
|
/**
|
|
11
13
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
12
14
|
* string.
|
|
@@ -26,20 +28,20 @@ type Hop = Entity & {
|
|
|
26
28
|
typename: string;
|
|
27
29
|
|
|
28
30
|
/** The destination node of the hop. **/
|
|
29
|
-
destinationId?: string;
|
|
31
|
+
destinationId?: string | undefined;
|
|
30
32
|
|
|
31
33
|
/** The public key of the node to which the hop is bound. **/
|
|
32
|
-
publicKey?: string;
|
|
34
|
+
publicKey?: string | undefined;
|
|
33
35
|
|
|
34
36
|
/** The amount that is to be forwarded to the destination node. **/
|
|
35
|
-
amountToForward?: CurrencyAmount;
|
|
37
|
+
amountToForward?: CurrencyAmount | undefined;
|
|
36
38
|
|
|
37
39
|
/** The fees to be collected by the source node for forwarding the payment over the hop. **/
|
|
38
|
-
fee?: CurrencyAmount;
|
|
40
|
+
fee?: CurrencyAmount | undefined;
|
|
39
41
|
|
|
40
42
|
/** The block height at which an unsettled HTLC is considered expired. **/
|
|
41
|
-
expiryBlockHeight?: number;
|
|
42
|
-
}
|
|
43
|
+
expiryBlockHeight?: number | undefined;
|
|
44
|
+
}
|
|
43
45
|
|
|
44
46
|
export const HopFromJson = (obj: any): Hop => {
|
|
45
47
|
return {
|
|
@@ -57,6 +59,22 @@ export const HopFromJson = (obj: any): Hop => {
|
|
|
57
59
|
expiryBlockHeight: obj["hop_expiry_block_height"],
|
|
58
60
|
} as Hop;
|
|
59
61
|
};
|
|
62
|
+
export const HopToJson = (obj: Hop): any => {
|
|
63
|
+
return {
|
|
64
|
+
__typename: "Hop",
|
|
65
|
+
hop_id: obj.id,
|
|
66
|
+
hop_created_at: obj.createdAt,
|
|
67
|
+
hop_updated_at: obj.updatedAt,
|
|
68
|
+
hop_destination: { id: obj.destinationId } ?? undefined,
|
|
69
|
+
hop_index: obj.index,
|
|
70
|
+
hop_public_key: obj.publicKey,
|
|
71
|
+
hop_amount_to_forward: obj.amountToForward
|
|
72
|
+
? CurrencyAmountToJson(obj.amountToForward)
|
|
73
|
+
: undefined,
|
|
74
|
+
hop_fee: obj.fee ? CurrencyAmountToJson(obj.fee) : undefined,
|
|
75
|
+
hop_expiry_block_height: obj.expiryBlockHeight,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
60
78
|
|
|
61
79
|
export const FRAGMENT = `
|
|
62
80
|
fragment HopFragment on Hop {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface IdAndSignature {
|
|
4
4
|
/** The id of the message. **/
|
|
5
5
|
id: string;
|
|
6
6
|
|
|
7
7
|
/** The signature of the message. **/
|
|
8
8
|
signature: string;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
export const IdAndSignatureFromJson = (obj: any): IdAndSignature => {
|
|
12
12
|
return {
|
|
@@ -14,5 +14,11 @@ export const IdAndSignatureFromJson = (obj: any): IdAndSignature => {
|
|
|
14
14
|
signature: obj["id_and_signature_signature"],
|
|
15
15
|
} as IdAndSignature;
|
|
16
16
|
};
|
|
17
|
+
export const IdAndSignatureToJson = (obj: IdAndSignature): any => {
|
|
18
|
+
return {
|
|
19
|
+
id_and_signature_id: obj.id,
|
|
20
|
+
id_and_signature_signature: obj.signature,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
17
23
|
|
|
18
24
|
export default IdAndSignature;
|