@lightsparkdev/lightspark-sdk 0.4.10 → 1.0.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 +30 -0
- package/README.md +1 -1
- package/dist/{chunk-NXUFC5J7.js → chunk-LZC5C5NI.js} +2908 -635
- package/dist/{index-3ffe9e7b.d.ts → index-09d4ac20.d.ts} +373 -62
- package/dist/index.cjs +3395 -842
- package/dist/index.d.ts +2 -2
- package/dist/index.js +390 -94
- package/dist/objects/index.cjs +2735 -553
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +17 -5
- package/package.json +12 -9
- package/src/NodeKeyLoaderCache.ts +87 -0
- package/src/SigningKeyLoader.ts +177 -0
- package/src/auth/AccountTokenAuthProvider.ts +4 -4
- package/src/client.ts +209 -118
- package/src/graphql/CreateInvoice.ts +3 -2
- package/src/graphql/CreateLnurlInvoice.ts +2 -0
- package/src/graphql/CreateUmaInvoice.ts +23 -0
- package/src/graphql/MultiNodeDashboard.ts +0 -3
- package/src/graphql/PayUmaInvoice.ts +29 -0
- package/src/graphql/RecoverNodeSigningKey.ts +1 -1
- package/src/graphql/SingleNodeDashboard.ts +0 -1
- package/src/lightspark_crypto/lightspark_crypto.d.ts +157 -0
- package/src/lightspark_crypto/lightspark_crypto.js +1010 -0
- package/src/lightspark_crypto/lightspark_crypto_bg.wasm +0 -0
- package/src/lightspark_crypto/lightspark_crypto_bg.wasm.d.ts +120 -0
- package/src/lightspark_crypto/package.json +11 -0
- package/src/objects/Account.ts +437 -120
- package/src/objects/AccountToApiTokensConnection.ts +3 -3
- package/src/objects/AccountToChannelsConnection.ts +4 -4
- package/src/objects/AccountToNodesConnection.ts +2 -15
- package/src/objects/AccountToPaymentRequestsConnection.ts +3 -3
- package/src/objects/AccountToTransactionsConnection.ts +6 -6
- package/src/objects/AccountToWalletsConnection.ts +2 -2
- package/src/objects/Balances.ts +2 -2
- package/src/objects/Channel.ts +4 -4
- package/src/objects/ChannelClosingTransaction.ts +2 -2
- package/src/objects/ChannelOpeningTransaction.ts +2 -2
- package/src/objects/ChannelToTransactionsConnection.ts +4 -4
- package/src/objects/{CryptoSanctionsScreeningProvider.ts → ComplianceProvider.ts} +3 -3
- package/src/objects/Connection.ts +25 -31
- package/src/objects/CreateApiTokenInput.ts +1 -1
- package/src/objects/CreateApiTokenOutput.ts +1 -1
- package/src/objects/CreateInvoiceInput.ts +0 -6
- package/src/objects/CreateLnurlInvoiceInput.ts +1 -7
- package/src/objects/CreateNodeWalletAddressInput.ts +1 -1
- package/src/objects/CreateNodeWalletAddressOutput.ts +1 -1
- package/src/objects/CreateTestModeInvoiceInput.ts +1 -1
- package/src/objects/CreateTestModeInvoiceOutput.ts +1 -1
- package/src/objects/CreateTestModePaymentInput.ts +1 -1
- package/src/objects/CreateTestModePaymentoutput.ts +14 -2
- package/src/objects/CreateUmaInvoiceInput.ts +24 -0
- package/src/objects/DeclineToSignMessagesInput.ts +16 -0
- package/src/objects/DeclineToSignMessagesOutput.ts +28 -0
- package/src/objects/DeleteApiTokenOutput.ts +1 -1
- package/src/objects/Entity.ts +401 -66
- package/src/objects/GraphNode.ts +3 -3
- package/src/objects/IdAndSignature.ts +16 -0
- package/src/objects/IncomingPayment.ts +21 -8
- package/src/objects/IncomingPaymentAttempt.ts +2 -2
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -3
- package/src/objects/Invoice.ts +118 -21
- package/src/objects/InvoiceData.ts +118 -21
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +1 -1
- package/src/objects/LightningFeeEstimateForNodeInput.ts +1 -1
- package/src/objects/LightningFeeEstimateOutput.ts +2 -2
- package/src/objects/LightningTransaction.ts +155 -31
- package/src/objects/LightsparkNode.ts +272 -112
- package/src/objects/LightsparkNodeOwner.ts +8 -4
- package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -3
- package/src/objects/LightsparkNodeWithOSK.ts +389 -0
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +384 -0
- package/src/objects/Node.ts +213 -60
- package/src/objects/NodeToAddressesConnection.ts +2 -2
- package/src/objects/OnChainTransaction.ts +2 -2
- package/src/objects/OutgoingPayment.ts +139 -24
- package/src/objects/OutgoingPaymentAttempt.ts +5 -5
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +3 -3
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -3
- package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +25 -0
- package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +28 -0
- package/src/objects/PayUmaInvoiceInput.ts +25 -0
- package/src/objects/{LightsparkNodePurpose.ts → PaymentDirection.ts} +5 -7
- package/src/objects/PaymentRequest.ts +119 -22
- package/src/objects/PaymentRequestData.ts +119 -22
- package/src/objects/PostTransactionData.ts +39 -0
- package/src/objects/RegisterPaymentInput.ts +31 -0
- package/src/objects/RegisterPaymentOutput.ts +23 -0
- package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +23 -0
- package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +23 -0
- package/src/objects/ReleasePaymentPreimageInput.ts +20 -0
- package/src/objects/ReleasePaymentPreimageOutput.ts +23 -0
- package/src/objects/RemoteSigningSubEventType.ts +26 -0
- package/src/objects/RequestWithdrawalInput.ts +1 -1
- package/src/objects/RequestWithdrawalOutput.ts +1 -1
- package/src/objects/RoutingTransaction.ts +1 -1
- package/src/objects/ScreenNodeInput.ts +20 -0
- package/src/objects/ScreenNodeOutput.ts +22 -0
- package/src/objects/SetInvoicePaymentHashInput.ts +24 -0
- package/src/objects/SetInvoicePaymentHashOutput.ts +23 -0
- package/src/objects/SignInvoiceInput.ts +19 -0
- package/src/objects/SignInvoiceOutput.ts +21 -0
- package/src/objects/SignMessagesInput.ts +18 -0
- package/src/objects/SignMessagesOutput.ts +26 -0
- package/src/objects/Signable.ts +58 -0
- package/src/objects/SignablePayload.ts +93 -0
- package/src/objects/SignablePayloadStatus.ts +17 -0
- package/src/objects/SingleNodeDashboard.ts +0 -2
- package/src/objects/Transaction.ts +153 -29
- package/src/objects/TransactionFailures.ts +1 -1
- package/src/objects/UpdateChannelPerCommitmentPointInput.ts +25 -0
- package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +23 -0
- package/src/objects/UpdateNodeSharedSecretInput.ts +18 -0
- package/src/objects/UpdateNodeSharedSecretOutput.ts +23 -0
- package/src/objects/Wallet.ts +271 -51
- package/src/objects/WalletToPaymentRequestsConnection.ts +3 -3
- package/src/objects/WalletToTransactionsConnection.ts +3 -3
- package/src/objects/WithdrawalRequest.ts +6 -6
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +2 -2
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +2 -2
- package/src/objects/index.ts +37 -4
- package/src/{__tests__ → tests}/webhooks.test.ts +1 -1
- package/src/webhooks.ts +1 -1
- package/src/objects/ScreenBitcoinAddressesInput.ts +0 -23
- package/src/objects/ScreenBitcoinAddressesOutput.ts +0 -25
|
@@ -6,8 +6,9 @@ export const CreateInvoice = `
|
|
|
6
6
|
$amount_msats: Long!
|
|
7
7
|
$memo: String
|
|
8
8
|
$type: InvoiceType = null
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
$expiry_secs: Int = null
|
|
10
|
+
) {
|
|
11
|
+
create_invoice(input: { node_id: $node_id, amount_msats: $amount_msats, memo: $memo, invoice_type: $type, expiry_secs: $expiry_secs }) {
|
|
11
12
|
invoice {
|
|
12
13
|
data {
|
|
13
14
|
encoded_payment_request
|
|
@@ -6,11 +6,13 @@ mutation CreateLnurlInvoice(
|
|
|
6
6
|
$node_id: ID!
|
|
7
7
|
$amount_msats: Long!
|
|
8
8
|
$metadata_hash: String!
|
|
9
|
+
$expiry_secs: Int = null
|
|
9
10
|
) {
|
|
10
11
|
create_lnurl_invoice(input: {
|
|
11
12
|
node_id: $node_id
|
|
12
13
|
amount_msats: $amount_msats
|
|
13
14
|
metadata_hash: $metadata_hash
|
|
15
|
+
expiry_secs: $expiry_secs
|
|
14
16
|
}) {
|
|
15
17
|
invoice {
|
|
16
18
|
...InvoiceFragment
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
import { FRAGMENT as InvoiceFragment } from "../objects/Invoice.js";
|
|
3
|
+
|
|
4
|
+
export const CreateUmaInvoice = `
|
|
5
|
+
mutation CreateUmaInvoice(
|
|
6
|
+
$node_id: ID!
|
|
7
|
+
$amount_msats: Long!
|
|
8
|
+
$metadata_hash: String!
|
|
9
|
+
$expiry_secs: Int = null
|
|
10
|
+
) {
|
|
11
|
+
create_uma_invoice(input: {
|
|
12
|
+
node_id: $node_id
|
|
13
|
+
amount_msats: $amount_msats
|
|
14
|
+
metadata_hash: $metadata_hash
|
|
15
|
+
expiry_secs: $expiry_secs
|
|
16
|
+
}) {
|
|
17
|
+
invoice {
|
|
18
|
+
...InvoiceFragment
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
${InvoiceFragment}
|
|
23
|
+
`;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import type { Maybe } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "../objects/CurrencyAmount.js";
|
|
5
5
|
import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js";
|
|
6
|
-
import type LightsparkNodePurpose from "../objects/LightsparkNodePurpose.js";
|
|
7
6
|
import type LightsparkNodeStatus from "../objects/LightsparkNodeStatus.js";
|
|
8
7
|
import type NodeAddressType from "../objects/NodeAddressType.js";
|
|
9
8
|
|
|
@@ -14,7 +13,6 @@ export type AccountDashboard = {
|
|
|
14
13
|
id: string;
|
|
15
14
|
color: Maybe<string>;
|
|
16
15
|
displayName: string;
|
|
17
|
-
purpose: Maybe<LightsparkNodePurpose>;
|
|
18
16
|
publicKey: Maybe<string>;
|
|
19
17
|
status: Maybe<LightsparkNodeStatus>;
|
|
20
18
|
addresses: {
|
|
@@ -57,7 +55,6 @@ export const MultiNodeDashboard = `
|
|
|
57
55
|
entities {
|
|
58
56
|
color
|
|
59
57
|
display_name
|
|
60
|
-
purpose
|
|
61
58
|
id
|
|
62
59
|
addresses(first: 1) {
|
|
63
60
|
entities {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
|
|
4
|
+
|
|
5
|
+
export const PayUmaInvoice = `
|
|
6
|
+
mutation PayUmaInvoice(
|
|
7
|
+
$node_id: ID!
|
|
8
|
+
$encoded_invoice: String!
|
|
9
|
+
$timeout_secs: Int!
|
|
10
|
+
$maximum_fees_msats: Long!
|
|
11
|
+
$amount_msats: Long
|
|
12
|
+
) {
|
|
13
|
+
pay_uma_invoice(
|
|
14
|
+
input: {
|
|
15
|
+
node_id: $node_id
|
|
16
|
+
encoded_invoice: $encoded_invoice
|
|
17
|
+
timeout_secs: $timeout_secs
|
|
18
|
+
maximum_fees_msats: $maximum_fees_msats
|
|
19
|
+
amount_msats: $amount_msats
|
|
20
|
+
}
|
|
21
|
+
) {
|
|
22
|
+
payment {
|
|
23
|
+
...OutgoingPaymentFragment
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
${OutgoingPaymentFragment}
|
|
29
|
+
`;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
*/
|
|
5
|
+
export enum Network {
|
|
6
|
+
Bitcoin = 0,
|
|
7
|
+
Testnet = 1,
|
|
8
|
+
Regtest = 2,
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
*/
|
|
12
|
+
export class InvoiceSignature {
|
|
13
|
+
free(): void;
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Uint8Array}
|
|
16
|
+
*/
|
|
17
|
+
get_signature(): Uint8Array;
|
|
18
|
+
/**
|
|
19
|
+
* @returns {number}
|
|
20
|
+
*/
|
|
21
|
+
get_recovery_id(): number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
*/
|
|
25
|
+
export class LightsparkSigner {
|
|
26
|
+
free(): void;
|
|
27
|
+
/**
|
|
28
|
+
* @param {Seed} seed
|
|
29
|
+
* @param {number} network
|
|
30
|
+
* @returns {LightsparkSigner}
|
|
31
|
+
*/
|
|
32
|
+
static new(seed: Seed, network: number): LightsparkSigner;
|
|
33
|
+
/**
|
|
34
|
+
* @param {Uint8Array} seed
|
|
35
|
+
* @param {number} network
|
|
36
|
+
* @returns {LightsparkSigner}
|
|
37
|
+
*/
|
|
38
|
+
static from_bytes(seed: Uint8Array, network: number): LightsparkSigner;
|
|
39
|
+
/**
|
|
40
|
+
* @returns {string}
|
|
41
|
+
*/
|
|
42
|
+
get_master_public_key(): string;
|
|
43
|
+
/**
|
|
44
|
+
* @param {string} derivation_path
|
|
45
|
+
* @returns {string}
|
|
46
|
+
*/
|
|
47
|
+
derive_public_key(derivation_path: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* @param {Uint8Array} message
|
|
50
|
+
* @param {string} derivation_path
|
|
51
|
+
* @param {boolean} is_raw
|
|
52
|
+
* @param {Uint8Array | undefined} add_tweak
|
|
53
|
+
* @param {Uint8Array | undefined} mul_tweak
|
|
54
|
+
* @returns {Uint8Array}
|
|
55
|
+
*/
|
|
56
|
+
derive_key_and_sign(
|
|
57
|
+
message: Uint8Array,
|
|
58
|
+
derivation_path: string,
|
|
59
|
+
is_raw: boolean,
|
|
60
|
+
add_tweak?: Uint8Array,
|
|
61
|
+
mul_tweak?: Uint8Array,
|
|
62
|
+
): Uint8Array;
|
|
63
|
+
/**
|
|
64
|
+
* @param {Uint8Array} public_key
|
|
65
|
+
* @returns {Uint8Array}
|
|
66
|
+
*/
|
|
67
|
+
ecdh(public_key: Uint8Array): Uint8Array;
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} derivation_path
|
|
70
|
+
* @param {bigint} per_commitment_point_idx
|
|
71
|
+
* @returns {Uint8Array}
|
|
72
|
+
*/
|
|
73
|
+
get_per_commitment_point(
|
|
74
|
+
derivation_path: string,
|
|
75
|
+
per_commitment_point_idx: bigint,
|
|
76
|
+
): Uint8Array;
|
|
77
|
+
/**
|
|
78
|
+
* @param {string} derivation_path
|
|
79
|
+
* @param {bigint} per_commitment_point_idx
|
|
80
|
+
* @returns {Uint8Array}
|
|
81
|
+
*/
|
|
82
|
+
release_per_commitment_secret(
|
|
83
|
+
derivation_path: string,
|
|
84
|
+
per_commitment_point_idx: bigint,
|
|
85
|
+
): Uint8Array;
|
|
86
|
+
/**
|
|
87
|
+
* @returns {Uint8Array}
|
|
88
|
+
*/
|
|
89
|
+
generate_preimage_nonce(): Uint8Array;
|
|
90
|
+
/**
|
|
91
|
+
* @param {Uint8Array} nonce
|
|
92
|
+
* @returns {Uint8Array}
|
|
93
|
+
*/
|
|
94
|
+
generate_preimage(nonce: Uint8Array): Uint8Array;
|
|
95
|
+
/**
|
|
96
|
+
* @param {Uint8Array} nonce
|
|
97
|
+
* @returns {Uint8Array}
|
|
98
|
+
*/
|
|
99
|
+
generate_preimage_hash(nonce: Uint8Array): Uint8Array;
|
|
100
|
+
/**
|
|
101
|
+
* @param {string} derivation_path
|
|
102
|
+
* @returns {string}
|
|
103
|
+
*/
|
|
104
|
+
derive_private_key(derivation_path: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* @param {string} unsigned_invoice
|
|
107
|
+
* @returns {InvoiceSignature}
|
|
108
|
+
*/
|
|
109
|
+
sign_invoice_wasm(unsigned_invoice: string): InvoiceSignature;
|
|
110
|
+
/**
|
|
111
|
+
* @param {Uint8Array} invoice_hash
|
|
112
|
+
* @returns {InvoiceSignature}
|
|
113
|
+
*/
|
|
114
|
+
sign_invoice_hash_wasm(invoice_hash: Uint8Array): InvoiceSignature;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
*/
|
|
118
|
+
export class Mnemonic {
|
|
119
|
+
free(): void;
|
|
120
|
+
/**
|
|
121
|
+
* @returns {Mnemonic}
|
|
122
|
+
*/
|
|
123
|
+
static random(): Mnemonic;
|
|
124
|
+
/**
|
|
125
|
+
* @param {Uint8Array} entropy
|
|
126
|
+
* @returns {Mnemonic}
|
|
127
|
+
*/
|
|
128
|
+
static from_entropy(entropy: Uint8Array): Mnemonic;
|
|
129
|
+
/**
|
|
130
|
+
* @param {string} phrase
|
|
131
|
+
* @returns {Mnemonic}
|
|
132
|
+
*/
|
|
133
|
+
static from_phrase(phrase: string): Mnemonic;
|
|
134
|
+
/**
|
|
135
|
+
* @returns {string}
|
|
136
|
+
*/
|
|
137
|
+
as_string(): string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
*/
|
|
141
|
+
export class Seed {
|
|
142
|
+
free(): void;
|
|
143
|
+
/**
|
|
144
|
+
* @param {Mnemonic} mnemonic
|
|
145
|
+
* @returns {Seed}
|
|
146
|
+
*/
|
|
147
|
+
static from_mnemonic(mnemonic: Mnemonic): Seed;
|
|
148
|
+
/**
|
|
149
|
+
* @param {Uint8Array} seed
|
|
150
|
+
* @returns {Seed}
|
|
151
|
+
*/
|
|
152
|
+
static new(seed: Uint8Array): Seed;
|
|
153
|
+
/**
|
|
154
|
+
* @returns {Uint8Array}
|
|
155
|
+
*/
|
|
156
|
+
as_bytes(): Uint8Array;
|
|
157
|
+
}
|