@lightsparkdev/lightspark-sdk 0.4.11 → 1.0.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 +30 -0
- package/README.md +1 -1
- package/dist/BitcoinNetwork-a816c0be.d.ts +18 -0
- package/dist/chunk-5RDIWPBE.js +27 -0
- package/dist/{chunk-NXUFC5J7.js → chunk-K2ZU5YQL.js} +2910 -645
- package/dist/chunk-K6SAUSAX.js +14 -0
- package/dist/env.cjs +101 -0
- package/dist/env.d.ts +17 -0
- package/dist/env.js +47 -0
- package/dist/{index-3ffe9e7b.d.ts → index-dbf06298.d.ts} +374 -79
- package/dist/index.cjs +3397 -805
- package/dist/index.d.ts +8 -3
- package/dist/index.js +412 -94
- package/dist/objects/index.cjs +2735 -553
- package/dist/objects/index.d.ts +2 -1
- package/dist/objects/index.js +20 -6
- package/package.json +21 -8
- package/src/NodeKeyLoaderCache.ts +89 -0
- package/src/SigningKeyLoader.ts +177 -0
- package/src/client.ts +160 -71
- package/src/env.ts +54 -0
- 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/helpers.ts +31 -0
- package/src/index.ts +1 -0
- 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 +424 -107
- package/src/objects/AccountToNodesConnection.ts +0 -13
- package/src/objects/{CryptoSanctionsScreeningProvider.ts → ComplianceProvider.ts} +3 -3
- package/src/objects/Connection.ts +0 -6
- package/src/objects/CreateInvoiceInput.ts +0 -6
- package/src/objects/CreateLnurlInvoiceInput.ts +0 -6
- package/src/objects/CreateTestModePaymentoutput.ts +13 -1
- package/src/objects/CreateUmaInvoiceInput.ts +24 -0
- package/src/objects/DeclineToSignMessagesInput.ts +16 -0
- package/src/objects/DeclineToSignMessagesOutput.ts +28 -0
- package/src/objects/Entity.ts +401 -66
- package/src/objects/IdAndSignature.ts +16 -0
- package/src/objects/IncomingPayment.ts +18 -5
- package/src/objects/Invoice.ts +118 -21
- package/src/objects/InvoiceData.ts +118 -21
- package/src/objects/LightningTransaction.ts +149 -25
- package/src/objects/LightsparkNode.ts +270 -110
- package/src/objects/LightsparkNodeOwner.ts +4 -0
- package/src/objects/LightsparkNodeWithOSK.ts +389 -0
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +384 -0
- package/src/objects/Node.ts +209 -56
- package/src/objects/OutgoingPayment.ts +136 -21
- 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 +118 -21
- package/src/objects/PaymentRequestData.ts +118 -21
- 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/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 +149 -25
- 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 +265 -45
- package/src/objects/index.ts +37 -4
- package/src/objects/ScreenBitcoinAddressesInput.ts +0 -23
- package/src/objects/ScreenBitcoinAddressesOutput.ts +0 -25
- /package/src/{__tests__ → tests}/webhooks.test.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/objects/BitcoinNetwork.ts
|
|
2
|
+
var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
|
|
3
|
+
BitcoinNetwork2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
4
|
+
BitcoinNetwork2["MAINNET"] = "MAINNET";
|
|
5
|
+
BitcoinNetwork2["REGTEST"] = "REGTEST";
|
|
6
|
+
BitcoinNetwork2["SIGNET"] = "SIGNET";
|
|
7
|
+
BitcoinNetwork2["TESTNET"] = "TESTNET";
|
|
8
|
+
return BitcoinNetwork2;
|
|
9
|
+
})(BitcoinNetwork || {});
|
|
10
|
+
var BitcoinNetwork_default = BitcoinNetwork;
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
BitcoinNetwork_default
|
|
14
|
+
};
|
package/dist/env.cjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/env.ts
|
|
31
|
+
var env_exports = {};
|
|
32
|
+
__export(env_exports, {
|
|
33
|
+
RequiredCredentials: () => RequiredCredentials,
|
|
34
|
+
getCredentialsFromEnvOrThrow: () => getCredentialsFromEnvOrThrow
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(env_exports);
|
|
37
|
+
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
38
|
+
|
|
39
|
+
// src/helpers.ts
|
|
40
|
+
var BITCOIN_NETWORKS = [
|
|
41
|
+
"MAINNET" /* MAINNET */,
|
|
42
|
+
"TESTNET" /* TESTNET */,
|
|
43
|
+
"SIGNET" /* SIGNET */,
|
|
44
|
+
"REGTEST" /* REGTEST */
|
|
45
|
+
];
|
|
46
|
+
var isBitcoinNetwork = (bitcoinNetwork) => {
|
|
47
|
+
return BITCOIN_NETWORKS.includes(bitcoinNetwork);
|
|
48
|
+
};
|
|
49
|
+
var assertValidBitcoinNetwork = (bitcoinNetwork) => {
|
|
50
|
+
if (!isBitcoinNetwork(bitcoinNetwork)) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS}`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var getBitcoinNetworkOrThrow = (bitcoinNetwork) => {
|
|
57
|
+
assertValidBitcoinNetwork(bitcoinNetwork.toUpperCase());
|
|
58
|
+
return bitcoinNetwork;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/env.ts
|
|
62
|
+
var RequiredCredentials = /* @__PURE__ */ ((RequiredCredentials2) => {
|
|
63
|
+
RequiredCredentials2["ClientId"] = "LIGHTSPARK_API_TOKEN_CLIENT_ID";
|
|
64
|
+
RequiredCredentials2["ClientSecret"] = "LIGHTSPARK_API_TOKEN_CLIENT_SECRET";
|
|
65
|
+
RequiredCredentials2["BitcoinNetwork"] = "BITCOIN_NETWORK";
|
|
66
|
+
return RequiredCredentials2;
|
|
67
|
+
})(RequiredCredentials || {});
|
|
68
|
+
var getCredentialsFromEnvOrThrow = () => {
|
|
69
|
+
const env = import_dotenv.default.config({
|
|
70
|
+
path: process.env.HOME + "/.lightsparkapienv"
|
|
71
|
+
}).parsed || {};
|
|
72
|
+
const missingTestCredentials = Object.values(RequiredCredentials).filter(
|
|
73
|
+
(cred) => !env[cred]
|
|
74
|
+
);
|
|
75
|
+
if (missingTestCredentials.length) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
`Missing test credentials. Please set ${missingTestCredentials.join(
|
|
78
|
+
", "
|
|
79
|
+
)} environment variables.`
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
const apiTokenClientId = env["LIGHTSPARK_API_TOKEN_CLIENT_ID" /* ClientId */];
|
|
83
|
+
const apiTokenClientSecret = env["LIGHTSPARK_API_TOKEN_CLIENT_SECRET" /* ClientSecret */];
|
|
84
|
+
const bitcoinNetwork = getBitcoinNetworkOrThrow(
|
|
85
|
+
env["BITCOIN_NETWORK" /* BitcoinNetwork */]
|
|
86
|
+
);
|
|
87
|
+
const testNodePassword = "1234!@#$";
|
|
88
|
+
const baseUrl = env["LIGHTSPARK_BASE_URL"] || "api.lightspark.com";
|
|
89
|
+
return {
|
|
90
|
+
apiTokenClientId,
|
|
91
|
+
apiTokenClientSecret,
|
|
92
|
+
bitcoinNetwork,
|
|
93
|
+
testNodePassword,
|
|
94
|
+
baseUrl
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
RequiredCredentials,
|
|
100
|
+
getCredentialsFromEnvOrThrow
|
|
101
|
+
});
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { B as BitcoinNetwork } from './BitcoinNetwork-a816c0be.js';
|
|
2
|
+
|
|
3
|
+
type EnvCredentials = {
|
|
4
|
+
apiTokenClientId: string;
|
|
5
|
+
apiTokenClientSecret: string;
|
|
6
|
+
bitcoinNetwork: BitcoinNetwork;
|
|
7
|
+
testNodePassword: string;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
};
|
|
10
|
+
declare enum RequiredCredentials {
|
|
11
|
+
ClientId = "LIGHTSPARK_API_TOKEN_CLIENT_ID",
|
|
12
|
+
ClientSecret = "LIGHTSPARK_API_TOKEN_CLIENT_SECRET",
|
|
13
|
+
BitcoinNetwork = "BITCOIN_NETWORK"
|
|
14
|
+
}
|
|
15
|
+
declare const getCredentialsFromEnvOrThrow: () => EnvCredentials;
|
|
16
|
+
|
|
17
|
+
export { EnvCredentials, RequiredCredentials, getCredentialsFromEnvOrThrow };
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getBitcoinNetworkOrThrow
|
|
3
|
+
} from "./chunk-5RDIWPBE.js";
|
|
4
|
+
import "./chunk-K6SAUSAX.js";
|
|
5
|
+
import "./chunk-NIMBE7W3.js";
|
|
6
|
+
|
|
7
|
+
// src/env.ts
|
|
8
|
+
import dotenv from "dotenv";
|
|
9
|
+
var RequiredCredentials = /* @__PURE__ */ ((RequiredCredentials2) => {
|
|
10
|
+
RequiredCredentials2["ClientId"] = "LIGHTSPARK_API_TOKEN_CLIENT_ID";
|
|
11
|
+
RequiredCredentials2["ClientSecret"] = "LIGHTSPARK_API_TOKEN_CLIENT_SECRET";
|
|
12
|
+
RequiredCredentials2["BitcoinNetwork"] = "BITCOIN_NETWORK";
|
|
13
|
+
return RequiredCredentials2;
|
|
14
|
+
})(RequiredCredentials || {});
|
|
15
|
+
var getCredentialsFromEnvOrThrow = () => {
|
|
16
|
+
const env = dotenv.config({
|
|
17
|
+
path: process.env.HOME + "/.lightsparkapienv"
|
|
18
|
+
}).parsed || {};
|
|
19
|
+
const missingTestCredentials = Object.values(RequiredCredentials).filter(
|
|
20
|
+
(cred) => !env[cred]
|
|
21
|
+
);
|
|
22
|
+
if (missingTestCredentials.length) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Missing test credentials. Please set ${missingTestCredentials.join(
|
|
25
|
+
", "
|
|
26
|
+
)} environment variables.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const apiTokenClientId = env["LIGHTSPARK_API_TOKEN_CLIENT_ID" /* ClientId */];
|
|
30
|
+
const apiTokenClientSecret = env["LIGHTSPARK_API_TOKEN_CLIENT_SECRET" /* ClientSecret */];
|
|
31
|
+
const bitcoinNetwork = getBitcoinNetworkOrThrow(
|
|
32
|
+
env["BITCOIN_NETWORK" /* BitcoinNetwork */]
|
|
33
|
+
);
|
|
34
|
+
const testNodePassword = "1234!@#$";
|
|
35
|
+
const baseUrl = env["LIGHTSPARK_BASE_URL"] || "api.lightspark.com";
|
|
36
|
+
return {
|
|
37
|
+
apiTokenClientId,
|
|
38
|
+
apiTokenClientSecret,
|
|
39
|
+
bitcoinNetwork,
|
|
40
|
+
testNodePassword,
|
|
41
|
+
baseUrl
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
RequiredCredentials,
|
|
46
|
+
getCredentialsFromEnvOrThrow
|
|
47
|
+
};
|