@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import ComplianceProvider from "./ComplianceProvider.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface ScreenNodeInput {
|
|
6
6
|
/**
|
|
7
7
|
* The compliance provider that is going to screen the node. You need to be a customer of the selected
|
|
8
8
|
* provider and store the API key on the Lightspark account setting page.
|
|
@@ -11,7 +11,7 @@ type ScreenNodeInput = {
|
|
|
11
11
|
|
|
12
12
|
/** The public key of the lightning node that needs to be screened. **/
|
|
13
13
|
nodePubkey: string;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
export const ScreenNodeInputFromJson = (obj: any): ScreenNodeInput => {
|
|
17
17
|
return {
|
|
@@ -21,5 +21,11 @@ export const ScreenNodeInputFromJson = (obj: any): ScreenNodeInput => {
|
|
|
21
21
|
nodePubkey: obj["screen_node_input_node_pubkey"],
|
|
22
22
|
} as ScreenNodeInput;
|
|
23
23
|
};
|
|
24
|
+
export const ScreenNodeInputToJson = (obj: ScreenNodeInput): any => {
|
|
25
|
+
return {
|
|
26
|
+
screen_node_input_provider: obj.provider,
|
|
27
|
+
screen_node_input_node_pubkey: obj.nodePubkey,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
24
30
|
|
|
25
31
|
export default ScreenNodeInput;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import RiskRating from "./RiskRating.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface ScreenNodeOutput {
|
|
6
6
|
rating: RiskRating;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
export const ScreenNodeOutputFromJson = (obj: any): ScreenNodeOutput => {
|
|
10
10
|
return {
|
|
@@ -12,6 +12,11 @@ export const ScreenNodeOutputFromJson = (obj: any): ScreenNodeOutput => {
|
|
|
12
12
|
RiskRating[obj["screen_node_output_rating"]] ?? RiskRating.FUTURE_VALUE,
|
|
13
13
|
} as ScreenNodeOutput;
|
|
14
14
|
};
|
|
15
|
+
export const ScreenNodeOutputToJson = (obj: ScreenNodeOutput): any => {
|
|
16
|
+
return {
|
|
17
|
+
screen_node_output_rating: obj.rating,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export const FRAGMENT = `
|
|
17
22
|
fragment ScreenNodeOutputFragment on ScreenNodeOutput {
|
package/src/objects/Secret.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface Secret {
|
|
4
4
|
encryptedValue: string;
|
|
5
5
|
|
|
6
6
|
cipher: string;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
export const SecretFromJson = (obj: any): Secret => {
|
|
10
10
|
return {
|
|
@@ -12,6 +12,12 @@ export const SecretFromJson = (obj: any): Secret => {
|
|
|
12
12
|
cipher: obj["secret_cipher"],
|
|
13
13
|
} as Secret;
|
|
14
14
|
};
|
|
15
|
+
export const SecretToJson = (obj: Secret): any => {
|
|
16
|
+
return {
|
|
17
|
+
secret_encrypted_value: obj.encryptedValue,
|
|
18
|
+
secret_cipher: obj.cipher,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
15
21
|
|
|
16
22
|
export const FRAGMENT = `
|
|
17
23
|
fragment SecretFragment on Secret {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface SendPaymentInput {
|
|
4
4
|
/** The node from where you want to send the payment. **/
|
|
5
5
|
nodeId: string;
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ type SendPaymentInput = {
|
|
|
15
15
|
|
|
16
16
|
/** The maximum amount of fees that you want to pay for this payment to be sent, expressed in msats. **/
|
|
17
17
|
maximumFeesMsats: number;
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export const SendPaymentInputFromJson = (obj: any): SendPaymentInput => {
|
|
21
21
|
return {
|
|
@@ -26,5 +26,14 @@ export const SendPaymentInputFromJson = (obj: any): SendPaymentInput => {
|
|
|
26
26
|
maximumFeesMsats: obj["send_payment_input_maximum_fees_msats"],
|
|
27
27
|
} as SendPaymentInput;
|
|
28
28
|
};
|
|
29
|
+
export const SendPaymentInputToJson = (obj: SendPaymentInput): any => {
|
|
30
|
+
return {
|
|
31
|
+
send_payment_input_node_id: obj.nodeId,
|
|
32
|
+
send_payment_input_destination_public_key: obj.destinationPublicKey,
|
|
33
|
+
send_payment_input_timeout_secs: obj.timeoutSecs,
|
|
34
|
+
send_payment_input_amount_msats: obj.amountMsats,
|
|
35
|
+
send_payment_input_maximum_fees_msats: obj.maximumFeesMsats,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
29
38
|
|
|
30
39
|
export default SendPaymentInput;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface SendPaymentOutput {
|
|
4
4
|
/** The payment that has been sent. **/
|
|
5
5
|
paymentId: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const SendPaymentOutputFromJson = (obj: any): SendPaymentOutput => {
|
|
9
9
|
return {
|
|
10
10
|
paymentId: obj["send_payment_output_payment"].id,
|
|
11
11
|
} as SendPaymentOutput;
|
|
12
12
|
};
|
|
13
|
+
export const SendPaymentOutputToJson = (obj: SendPaymentOutput): any => {
|
|
14
|
+
return {
|
|
15
|
+
send_payment_output_payment: { id: obj.paymentId },
|
|
16
|
+
};
|
|
17
|
+
};
|
|
13
18
|
|
|
14
19
|
export const FRAGMENT = `
|
|
15
20
|
fragment SendPaymentOutputFragment on SendPaymentOutput {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface SetInvoicePaymentHashInput {
|
|
4
4
|
/** The invoice that needs to be updated. **/
|
|
5
5
|
invoiceId: string;
|
|
6
6
|
|
|
@@ -11,8 +11,8 @@ type SetInvoicePaymentHashInput = {
|
|
|
11
11
|
* The 32-byte nonce used to generate the invoice preimage if applicable. It will later be included in
|
|
12
12
|
* RELEASE_PAYMENT_PREIMAGE webhook to help recover the raw preimage.
|
|
13
13
|
**/
|
|
14
|
-
preimageNonce?: string;
|
|
15
|
-
}
|
|
14
|
+
preimageNonce?: string | undefined;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
export const SetInvoicePaymentHashInputFromJson = (
|
|
18
18
|
obj: any,
|
|
@@ -23,5 +23,14 @@ export const SetInvoicePaymentHashInputFromJson = (
|
|
|
23
23
|
preimageNonce: obj["set_invoice_payment_hash_input_preimage_nonce"],
|
|
24
24
|
} as SetInvoicePaymentHashInput;
|
|
25
25
|
};
|
|
26
|
+
export const SetInvoicePaymentHashInputToJson = (
|
|
27
|
+
obj: SetInvoicePaymentHashInput,
|
|
28
|
+
): any => {
|
|
29
|
+
return {
|
|
30
|
+
set_invoice_payment_hash_input_invoice_id: obj.invoiceId,
|
|
31
|
+
set_invoice_payment_hash_input_payment_hash: obj.paymentHash,
|
|
32
|
+
set_invoice_payment_hash_input_preimage_nonce: obj.preimageNonce,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
26
35
|
|
|
27
36
|
export default SetInvoicePaymentHashInput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface SetInvoicePaymentHashOutput {
|
|
4
4
|
invoiceId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const SetInvoicePaymentHashOutputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -11,6 +11,13 @@ export const SetInvoicePaymentHashOutputFromJson = (
|
|
|
11
11
|
invoiceId: obj["set_invoice_payment_hash_output_invoice"].id,
|
|
12
12
|
} as SetInvoicePaymentHashOutput;
|
|
13
13
|
};
|
|
14
|
+
export const SetInvoicePaymentHashOutputToJson = (
|
|
15
|
+
obj: SetInvoicePaymentHashOutput,
|
|
16
|
+
): any => {
|
|
17
|
+
return {
|
|
18
|
+
set_invoice_payment_hash_output_invoice: { id: obj.invoiceId },
|
|
19
|
+
};
|
|
20
|
+
};
|
|
14
21
|
|
|
15
22
|
export const FRAGMENT = `
|
|
16
23
|
fragment SetInvoicePaymentHashOutputFragment on SetInvoicePaymentHashOutput {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface SignInvoiceInput {
|
|
4
4
|
/** The unique identifier of the invoice to be signed. **/
|
|
5
5
|
invoiceId: string;
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ type SignInvoiceInput = {
|
|
|
9
9
|
|
|
10
10
|
/** The recovery identifier for the signature. **/
|
|
11
11
|
recoveryId: number;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
export const SignInvoiceInputFromJson = (obj: any): SignInvoiceInput => {
|
|
15
15
|
return {
|
|
@@ -18,5 +18,12 @@ export const SignInvoiceInputFromJson = (obj: any): SignInvoiceInput => {
|
|
|
18
18
|
recoveryId: obj["sign_invoice_input_recovery_id"],
|
|
19
19
|
} as SignInvoiceInput;
|
|
20
20
|
};
|
|
21
|
+
export const SignInvoiceInputToJson = (obj: SignInvoiceInput): any => {
|
|
22
|
+
return {
|
|
23
|
+
sign_invoice_input_invoice_id: obj.invoiceId,
|
|
24
|
+
sign_invoice_input_signature: obj.signature,
|
|
25
|
+
sign_invoice_input_recovery_id: obj.recoveryId,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
21
28
|
|
|
22
29
|
export default SignInvoiceInput;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface SignInvoiceOutput {
|
|
4
4
|
/** The signed invoice object. **/
|
|
5
5
|
invoiceId: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const SignInvoiceOutputFromJson = (obj: any): SignInvoiceOutput => {
|
|
9
9
|
return {
|
|
10
10
|
invoiceId: obj["sign_invoice_output_invoice"].id,
|
|
11
11
|
} as SignInvoiceOutput;
|
|
12
12
|
};
|
|
13
|
+
export const SignInvoiceOutputToJson = (obj: SignInvoiceOutput): any => {
|
|
14
|
+
return {
|
|
15
|
+
sign_invoice_output_invoice: { id: obj.invoiceId },
|
|
16
|
+
};
|
|
17
|
+
};
|
|
13
18
|
|
|
14
19
|
export const FRAGMENT = `
|
|
15
20
|
fragment SignInvoiceOutputFragment on SignInvoiceOutput {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type IdAndSignature from "./IdAndSignature.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
IdAndSignatureFromJson,
|
|
6
|
+
IdAndSignatureToJson,
|
|
7
|
+
} from "./IdAndSignature.js";
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
interface SignMessagesInput {
|
|
7
10
|
/** The list of the message ids and signatures. **/
|
|
8
11
|
signatures: IdAndSignature[];
|
|
9
|
-
}
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
export const SignMessagesInputFromJson = (obj: any): SignMessagesInput => {
|
|
12
15
|
return {
|
|
@@ -15,5 +18,12 @@ export const SignMessagesInputFromJson = (obj: any): SignMessagesInput => {
|
|
|
15
18
|
),
|
|
16
19
|
} as SignMessagesInput;
|
|
17
20
|
};
|
|
21
|
+
export const SignMessagesInputToJson = (obj: SignMessagesInput): any => {
|
|
22
|
+
return {
|
|
23
|
+
sign_messages_input_signatures: obj.signatures.map((e) =>
|
|
24
|
+
IdAndSignatureToJson(e),
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
18
28
|
|
|
19
29
|
export default SignMessagesInput;
|
|
@@ -1,12 +1,15 @@
|
|
|
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 SignMessagesOutput {
|
|
7
10
|
/** The list of signed payloads. **/
|
|
8
11
|
signedPayloads: SignablePayload[];
|
|
9
|
-
}
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
export const SignMessagesOutputFromJson = (obj: any): SignMessagesOutput => {
|
|
12
15
|
return {
|
|
@@ -15,6 +18,13 @@ export const SignMessagesOutputFromJson = (obj: any): SignMessagesOutput => {
|
|
|
15
18
|
),
|
|
16
19
|
} as SignMessagesOutput;
|
|
17
20
|
};
|
|
21
|
+
export const SignMessagesOutputToJson = (obj: SignMessagesOutput): any => {
|
|
22
|
+
return {
|
|
23
|
+
sign_messages_output_signed_payloads: obj.signedPayloads.map((e) =>
|
|
24
|
+
SignablePayloadToJson(e),
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
18
28
|
|
|
19
29
|
export const FRAGMENT = `
|
|
20
30
|
fragment SignMessagesOutputFragment on SignMessagesOutput {
|
package/src/objects/Signable.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
|
-
import type Entity from "./Entity.js";
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
interface Signable {
|
|
7
6
|
/**
|
|
8
7
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
9
8
|
* string.
|
|
@@ -18,7 +17,7 @@ type Signable = Entity & {
|
|
|
18
17
|
|
|
19
18
|
/** The typename of the object **/
|
|
20
19
|
typename: string;
|
|
21
|
-
}
|
|
20
|
+
}
|
|
22
21
|
|
|
23
22
|
export const SignableFromJson = (obj: any): Signable => {
|
|
24
23
|
return {
|
|
@@ -28,6 +27,14 @@ export const SignableFromJson = (obj: any): Signable => {
|
|
|
28
27
|
typename: "Signable",
|
|
29
28
|
} as Signable;
|
|
30
29
|
};
|
|
30
|
+
export const SignableToJson = (obj: Signable): any => {
|
|
31
|
+
return {
|
|
32
|
+
__typename: "Signable",
|
|
33
|
+
signable_id: obj.id,
|
|
34
|
+
signable_created_at: obj.createdAt,
|
|
35
|
+
signable_updated_at: obj.updatedAt,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
31
38
|
|
|
32
39
|
export const FRAGMENT = `
|
|
33
40
|
fragment SignableFragment on Signable {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
|
-
import type Entity from "./Entity.js";
|
|
5
4
|
import SignablePayloadStatus from "./SignablePayloadStatus.js";
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
interface SignablePayload {
|
|
8
7
|
/**
|
|
9
8
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
10
9
|
* string.
|
|
@@ -33,11 +32,11 @@ type SignablePayload = Entity & {
|
|
|
33
32
|
typename: string;
|
|
34
33
|
|
|
35
34
|
/** The tweak value to add. **/
|
|
36
|
-
addTweak?: string;
|
|
35
|
+
addTweak?: string | undefined;
|
|
37
36
|
|
|
38
37
|
/** The tweak value to multiply. **/
|
|
39
|
-
mulTweak?: string;
|
|
40
|
-
}
|
|
38
|
+
mulTweak?: string | undefined;
|
|
39
|
+
}
|
|
41
40
|
|
|
42
41
|
export const SignablePayloadFromJson = (obj: any): SignablePayload => {
|
|
43
42
|
return {
|
|
@@ -55,6 +54,20 @@ export const SignablePayloadFromJson = (obj: any): SignablePayload => {
|
|
|
55
54
|
mulTweak: obj["signable_payload_mul_tweak"],
|
|
56
55
|
} as SignablePayload;
|
|
57
56
|
};
|
|
57
|
+
export const SignablePayloadToJson = (obj: SignablePayload): any => {
|
|
58
|
+
return {
|
|
59
|
+
__typename: "SignablePayload",
|
|
60
|
+
signable_payload_id: obj.id,
|
|
61
|
+
signable_payload_created_at: obj.createdAt,
|
|
62
|
+
signable_payload_updated_at: obj.updatedAt,
|
|
63
|
+
signable_payload_payload: obj.payload,
|
|
64
|
+
signable_payload_derivation_path: obj.derivationPath,
|
|
65
|
+
signable_payload_status: obj.status,
|
|
66
|
+
signable_payload_add_tweak: obj.addTweak,
|
|
67
|
+
signable_payload_mul_tweak: obj.mulTweak,
|
|
68
|
+
signable_payload_signable: { id: obj.signableId },
|
|
69
|
+
};
|
|
70
|
+
};
|
|
58
71
|
|
|
59
72
|
export const FRAGMENT = `
|
|
60
73
|
fragment SignablePayloadFragment on SignablePayload {
|
|
@@ -4,22 +4,30 @@ import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
|
4
4
|
import type ChannelClosingTransaction from "./ChannelClosingTransaction.js";
|
|
5
5
|
import type ChannelOpeningTransaction from "./ChannelOpeningTransaction.js";
|
|
6
6
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
CurrencyAmountFromJson,
|
|
9
|
+
CurrencyAmountToJson,
|
|
10
|
+
} from "./CurrencyAmount.js";
|
|
8
11
|
import type Deposit from "./Deposit.js";
|
|
9
|
-
import type Entity from "./Entity.js";
|
|
10
12
|
import IncomingPayment from "./IncomingPayment.js";
|
|
11
13
|
import OutgoingPayment from "./OutgoingPayment.js";
|
|
12
14
|
import PaymentFailureReason from "./PaymentFailureReason.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
import {
|
|
16
|
+
PaymentRequestDataFromJson,
|
|
17
|
+
PaymentRequestDataToJson,
|
|
18
|
+
} from "./PaymentRequestData.js";
|
|
19
|
+
import {
|
|
20
|
+
PostTransactionDataFromJson,
|
|
21
|
+
PostTransactionDataToJson,
|
|
22
|
+
} from "./PostTransactionData.js";
|
|
23
|
+
import { RichTextFromJson, RichTextToJson } from "./RichText.js";
|
|
16
24
|
import type RoutingTransaction from "./RoutingTransaction.js";
|
|
17
25
|
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
18
26
|
import TransactionStatus from "./TransactionStatus.js";
|
|
19
27
|
import type Withdrawal from "./Withdrawal.js";
|
|
20
28
|
|
|
21
29
|
/** This object represents a payment transaction. The transaction can occur either on a Bitcoin Network, or over the Lightning Network. You can retrieve this object to receive specific information about a particular transaction tied to your Lightspark Node. **/
|
|
22
|
-
|
|
30
|
+
interface Transaction {
|
|
23
31
|
/**
|
|
24
32
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
25
33
|
* string.
|
|
@@ -42,11 +50,11 @@ type Transaction = Entity & {
|
|
|
42
50
|
typename: string;
|
|
43
51
|
|
|
44
52
|
/** The date and time when this transaction was completed or failed. **/
|
|
45
|
-
resolvedAt?: string;
|
|
53
|
+
resolvedAt?: string | undefined;
|
|
46
54
|
|
|
47
55
|
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
48
|
-
transactionHash?: string;
|
|
49
|
-
}
|
|
56
|
+
transactionHash?: string | undefined;
|
|
57
|
+
}
|
|
50
58
|
|
|
51
59
|
export const TransactionFromJson = (obj: any): Transaction => {
|
|
52
60
|
if (obj["__typename"] == "ChannelClosingTransaction") {
|
|
@@ -225,6 +233,195 @@ export const TransactionFromJson = (obj: any): Transaction => {
|
|
|
225
233
|
`Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`,
|
|
226
234
|
);
|
|
227
235
|
};
|
|
236
|
+
export const TransactionToJson = (obj: Transaction): any => {
|
|
237
|
+
if (obj.typename == "ChannelClosingTransaction") {
|
|
238
|
+
const channelClosingTransaction = obj as ChannelClosingTransaction;
|
|
239
|
+
return {
|
|
240
|
+
__typename: "ChannelClosingTransaction",
|
|
241
|
+
channel_closing_transaction_id: channelClosingTransaction.id,
|
|
242
|
+
channel_closing_transaction_created_at:
|
|
243
|
+
channelClosingTransaction.createdAt,
|
|
244
|
+
channel_closing_transaction_updated_at:
|
|
245
|
+
channelClosingTransaction.updatedAt,
|
|
246
|
+
channel_closing_transaction_status: channelClosingTransaction.status,
|
|
247
|
+
channel_closing_transaction_resolved_at:
|
|
248
|
+
channelClosingTransaction.resolvedAt,
|
|
249
|
+
channel_closing_transaction_amount: CurrencyAmountToJson(
|
|
250
|
+
channelClosingTransaction.amount,
|
|
251
|
+
),
|
|
252
|
+
channel_closing_transaction_transaction_hash:
|
|
253
|
+
channelClosingTransaction.transactionHash,
|
|
254
|
+
channel_closing_transaction_fees: channelClosingTransaction.fees
|
|
255
|
+
? CurrencyAmountToJson(channelClosingTransaction.fees)
|
|
256
|
+
: undefined,
|
|
257
|
+
channel_closing_transaction_block_hash:
|
|
258
|
+
channelClosingTransaction.blockHash,
|
|
259
|
+
channel_closing_transaction_block_height:
|
|
260
|
+
channelClosingTransaction.blockHeight,
|
|
261
|
+
channel_closing_transaction_destination_addresses:
|
|
262
|
+
channelClosingTransaction.destinationAddresses,
|
|
263
|
+
channel_closing_transaction_num_confirmations:
|
|
264
|
+
channelClosingTransaction.numConfirmations,
|
|
265
|
+
channel_closing_transaction_channel:
|
|
266
|
+
{ id: channelClosingTransaction.channelId } ?? undefined,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
if (obj.typename == "ChannelOpeningTransaction") {
|
|
270
|
+
const channelOpeningTransaction = obj as ChannelOpeningTransaction;
|
|
271
|
+
return {
|
|
272
|
+
__typename: "ChannelOpeningTransaction",
|
|
273
|
+
channel_opening_transaction_id: channelOpeningTransaction.id,
|
|
274
|
+
channel_opening_transaction_created_at:
|
|
275
|
+
channelOpeningTransaction.createdAt,
|
|
276
|
+
channel_opening_transaction_updated_at:
|
|
277
|
+
channelOpeningTransaction.updatedAt,
|
|
278
|
+
channel_opening_transaction_status: channelOpeningTransaction.status,
|
|
279
|
+
channel_opening_transaction_resolved_at:
|
|
280
|
+
channelOpeningTransaction.resolvedAt,
|
|
281
|
+
channel_opening_transaction_amount: CurrencyAmountToJson(
|
|
282
|
+
channelOpeningTransaction.amount,
|
|
283
|
+
),
|
|
284
|
+
channel_opening_transaction_transaction_hash:
|
|
285
|
+
channelOpeningTransaction.transactionHash,
|
|
286
|
+
channel_opening_transaction_fees: channelOpeningTransaction.fees
|
|
287
|
+
? CurrencyAmountToJson(channelOpeningTransaction.fees)
|
|
288
|
+
: undefined,
|
|
289
|
+
channel_opening_transaction_block_hash:
|
|
290
|
+
channelOpeningTransaction.blockHash,
|
|
291
|
+
channel_opening_transaction_block_height:
|
|
292
|
+
channelOpeningTransaction.blockHeight,
|
|
293
|
+
channel_opening_transaction_destination_addresses:
|
|
294
|
+
channelOpeningTransaction.destinationAddresses,
|
|
295
|
+
channel_opening_transaction_num_confirmations:
|
|
296
|
+
channelOpeningTransaction.numConfirmations,
|
|
297
|
+
channel_opening_transaction_channel:
|
|
298
|
+
{ id: channelOpeningTransaction.channelId } ?? undefined,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
if (obj.typename == "Deposit") {
|
|
302
|
+
const deposit = obj as Deposit;
|
|
303
|
+
return {
|
|
304
|
+
__typename: "Deposit",
|
|
305
|
+
deposit_id: deposit.id,
|
|
306
|
+
deposit_created_at: deposit.createdAt,
|
|
307
|
+
deposit_updated_at: deposit.updatedAt,
|
|
308
|
+
deposit_status: deposit.status,
|
|
309
|
+
deposit_resolved_at: deposit.resolvedAt,
|
|
310
|
+
deposit_amount: CurrencyAmountToJson(deposit.amount),
|
|
311
|
+
deposit_transaction_hash: deposit.transactionHash,
|
|
312
|
+
deposit_fees: deposit.fees
|
|
313
|
+
? CurrencyAmountToJson(deposit.fees)
|
|
314
|
+
: undefined,
|
|
315
|
+
deposit_block_hash: deposit.blockHash,
|
|
316
|
+
deposit_block_height: deposit.blockHeight,
|
|
317
|
+
deposit_destination_addresses: deposit.destinationAddresses,
|
|
318
|
+
deposit_num_confirmations: deposit.numConfirmations,
|
|
319
|
+
deposit_destination: { id: deposit.destinationId },
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
if (obj.typename == "IncomingPayment") {
|
|
323
|
+
const incomingPayment = obj as IncomingPayment;
|
|
324
|
+
return {
|
|
325
|
+
__typename: "IncomingPayment",
|
|
326
|
+
incoming_payment_id: incomingPayment.id,
|
|
327
|
+
incoming_payment_created_at: incomingPayment.createdAt,
|
|
328
|
+
incoming_payment_updated_at: incomingPayment.updatedAt,
|
|
329
|
+
incoming_payment_status: incomingPayment.status,
|
|
330
|
+
incoming_payment_resolved_at: incomingPayment.resolvedAt,
|
|
331
|
+
incoming_payment_amount: CurrencyAmountToJson(incomingPayment.amount),
|
|
332
|
+
incoming_payment_transaction_hash: incomingPayment.transactionHash,
|
|
333
|
+
incoming_payment_destination: { id: incomingPayment.destinationId },
|
|
334
|
+
incoming_payment_payment_request:
|
|
335
|
+
{ id: incomingPayment.paymentRequestId } ?? undefined,
|
|
336
|
+
incoming_payment_uma_post_transaction_data:
|
|
337
|
+
incomingPayment.umaPostTransactionData?.map((e) =>
|
|
338
|
+
PostTransactionDataToJson(e),
|
|
339
|
+
),
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
if (obj.typename == "OutgoingPayment") {
|
|
343
|
+
const outgoingPayment = obj as OutgoingPayment;
|
|
344
|
+
return {
|
|
345
|
+
__typename: "OutgoingPayment",
|
|
346
|
+
outgoing_payment_id: outgoingPayment.id,
|
|
347
|
+
outgoing_payment_created_at: outgoingPayment.createdAt,
|
|
348
|
+
outgoing_payment_updated_at: outgoingPayment.updatedAt,
|
|
349
|
+
outgoing_payment_status: outgoingPayment.status,
|
|
350
|
+
outgoing_payment_resolved_at: outgoingPayment.resolvedAt,
|
|
351
|
+
outgoing_payment_amount: CurrencyAmountToJson(outgoingPayment.amount),
|
|
352
|
+
outgoing_payment_transaction_hash: outgoingPayment.transactionHash,
|
|
353
|
+
outgoing_payment_origin: { id: outgoingPayment.originId },
|
|
354
|
+
outgoing_payment_destination:
|
|
355
|
+
{ id: outgoingPayment.destinationId } ?? undefined,
|
|
356
|
+
outgoing_payment_fees: outgoingPayment.fees
|
|
357
|
+
? CurrencyAmountToJson(outgoingPayment.fees)
|
|
358
|
+
: undefined,
|
|
359
|
+
outgoing_payment_payment_request_data: outgoingPayment.paymentRequestData
|
|
360
|
+
? PaymentRequestDataToJson(outgoingPayment.paymentRequestData)
|
|
361
|
+
: undefined,
|
|
362
|
+
outgoing_payment_failure_reason: outgoingPayment.failureReason,
|
|
363
|
+
outgoing_payment_failure_message: outgoingPayment.failureMessage
|
|
364
|
+
? RichTextToJson(outgoingPayment.failureMessage)
|
|
365
|
+
: undefined,
|
|
366
|
+
outgoing_payment_uma_post_transaction_data:
|
|
367
|
+
outgoingPayment.umaPostTransactionData?.map((e) =>
|
|
368
|
+
PostTransactionDataToJson(e),
|
|
369
|
+
),
|
|
370
|
+
outgoing_payment_payment_preimage: outgoingPayment.paymentPreimage,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
if (obj.typename == "RoutingTransaction") {
|
|
374
|
+
const routingTransaction = obj as RoutingTransaction;
|
|
375
|
+
return {
|
|
376
|
+
__typename: "RoutingTransaction",
|
|
377
|
+
routing_transaction_id: routingTransaction.id,
|
|
378
|
+
routing_transaction_created_at: routingTransaction.createdAt,
|
|
379
|
+
routing_transaction_updated_at: routingTransaction.updatedAt,
|
|
380
|
+
routing_transaction_status: routingTransaction.status,
|
|
381
|
+
routing_transaction_resolved_at: routingTransaction.resolvedAt,
|
|
382
|
+
routing_transaction_amount: CurrencyAmountToJson(
|
|
383
|
+
routingTransaction.amount,
|
|
384
|
+
),
|
|
385
|
+
routing_transaction_transaction_hash: routingTransaction.transactionHash,
|
|
386
|
+
routing_transaction_incoming_channel:
|
|
387
|
+
{ id: routingTransaction.incomingChannelId } ?? undefined,
|
|
388
|
+
routing_transaction_outgoing_channel:
|
|
389
|
+
{ id: routingTransaction.outgoingChannelId } ?? undefined,
|
|
390
|
+
routing_transaction_fees: routingTransaction.fees
|
|
391
|
+
? CurrencyAmountToJson(routingTransaction.fees)
|
|
392
|
+
: undefined,
|
|
393
|
+
routing_transaction_failure_message: routingTransaction.failureMessage
|
|
394
|
+
? RichTextToJson(routingTransaction.failureMessage)
|
|
395
|
+
: undefined,
|
|
396
|
+
routing_transaction_failure_reason: routingTransaction.failureReason,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
if (obj.typename == "Withdrawal") {
|
|
400
|
+
const withdrawal = obj as Withdrawal;
|
|
401
|
+
return {
|
|
402
|
+
__typename: "Withdrawal",
|
|
403
|
+
withdrawal_id: withdrawal.id,
|
|
404
|
+
withdrawal_created_at: withdrawal.createdAt,
|
|
405
|
+
withdrawal_updated_at: withdrawal.updatedAt,
|
|
406
|
+
withdrawal_status: withdrawal.status,
|
|
407
|
+
withdrawal_resolved_at: withdrawal.resolvedAt,
|
|
408
|
+
withdrawal_amount: CurrencyAmountToJson(withdrawal.amount),
|
|
409
|
+
withdrawal_transaction_hash: withdrawal.transactionHash,
|
|
410
|
+
withdrawal_fees: withdrawal.fees
|
|
411
|
+
? CurrencyAmountToJson(withdrawal.fees)
|
|
412
|
+
: undefined,
|
|
413
|
+
withdrawal_block_hash: withdrawal.blockHash,
|
|
414
|
+
withdrawal_block_height: withdrawal.blockHeight,
|
|
415
|
+
withdrawal_destination_addresses: withdrawal.destinationAddresses,
|
|
416
|
+
withdrawal_num_confirmations: withdrawal.numConfirmations,
|
|
417
|
+
withdrawal_origin: { id: withdrawal.originId },
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
throw new LightsparkException(
|
|
421
|
+
"DeserializationError",
|
|
422
|
+
`Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj.typename}`,
|
|
423
|
+
);
|
|
424
|
+
};
|
|
228
425
|
|
|
229
426
|
export const FRAGMENT = `
|
|
230
427
|
fragment TransactionFragment on Transaction {
|
|
@@ -4,11 +4,11 @@ import PaymentFailureReason from "./PaymentFailureReason.js";
|
|
|
4
4
|
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
5
5
|
|
|
6
6
|
/** This object represents payment failures associated with your Lightspark Node. **/
|
|
7
|
-
|
|
8
|
-
paymentFailures?: PaymentFailureReason[];
|
|
7
|
+
interface TransactionFailures {
|
|
8
|
+
paymentFailures?: PaymentFailureReason[] | undefined;
|
|
9
9
|
|
|
10
|
-
routingTransactionFailures?: RoutingTransactionFailureReason[];
|
|
11
|
-
}
|
|
10
|
+
routingTransactionFailures?: RoutingTransactionFailureReason[] | undefined;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export const TransactionFailuresFromJson = (obj: any): TransactionFailures => {
|
|
14
14
|
return {
|
|
@@ -20,5 +20,12 @@ export const TransactionFailuresFromJson = (obj: any): TransactionFailures => {
|
|
|
20
20
|
]?.map((e) => RoutingTransactionFailureReason[e]),
|
|
21
21
|
} as TransactionFailures;
|
|
22
22
|
};
|
|
23
|
+
export const TransactionFailuresToJson = (obj: TransactionFailures): any => {
|
|
24
|
+
return {
|
|
25
|
+
transaction_failures_payment_failures: obj.paymentFailures,
|
|
26
|
+
transaction_failures_routing_transaction_failures:
|
|
27
|
+
obj.routingTransactionFailures,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
23
30
|
|
|
24
31
|
export default TransactionFailures;
|