Sign In

@lightsparkdev/lightspark-cli

Package Overview
Dependencies
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightsparkdev/lightspark-cli - npm Package Compare versions

Comparing version
0.0.9
to
0.0.10
+9
-0
CHANGELOG.md
# @lightsparkdev/lightspark-cli
## 0.0.10
### Patch Changes
- 4ffd9a1: Upgrade prettier, fix lint configs, move ls-react-native-crypto-app to examples
- Updated dependencies [4ffd9a1]
- @lightsparkdev/lightspark-sdk@0.4.11
- @lightsparkdev/core@0.3.11
## 0.0.9

@@ -4,0 +13,0 @@

+2
-6

@@ -146,5 +146,3 @@ #!/usr/bin/env node

};
const l1FeeEstimate = async (client
/* options: OptionValues */
) => {
const l1FeeEstimate = async (client) => {
console.log("Fetching bitcoin L1 fee estimate...\n");

@@ -167,5 +165,3 @@ const feeEstimate = await client.getBitcoinFeeEstimate();

};
const currentAccount = async (client
/* options: OptionValues */
) => {
const currentAccount = async (client) => {
console.log("Fetching current account...\n");

@@ -172,0 +168,0 @@ const account = await client.getCurrentAccount();

{
"name": "@lightsparkdev/lightspark-cli",
"version": "0.0.9",
"version": "0.0.10",
"description": "CLI for the Lightspark JS sdk",

@@ -37,3 +37,3 @@ "main": "./dist/index.js",

"nodemon": "^2.0.22",
"prettier": "2.8.7",
"prettier": "3.0.2",
"prettier-plugin-organize-imports": "^3.2.2",

@@ -46,4 +46,4 @@ "ts-node": "^10.9.1",

"@inquirer/prompts": "^1.1.3",
"@lightsparkdev/core": "0.3.10",
"@lightsparkdev/lightspark-sdk": "0.4.10",
"@lightsparkdev/core": "0.3.11",
"@lightsparkdev/lightspark-sdk": "0.4.11",
"commander": "^11.0.0",

@@ -50,0 +50,0 @@ "dayjs": "^1.11.7",

@@ -28,3 +28,3 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved

const missingTestCredentials = Object.values(RequiredCredentials).filter(
(cred) => !env[cred]
(cred) => !env[cred],
);

@@ -34,4 +34,4 @@ if (missingTestCredentials.length) {

`Missing test credentials. Please set ${missingTestCredentials.join(
", "
)} environment variables.`
", ",
)} environment variables.`,
);

@@ -43,3 +43,3 @@ }

const bitcoinNetwork = getBitcoinNetworkOrThrow(
env[RequiredCredentials.BitcoinNetwork]! as BitcoinNetwork
env[RequiredCredentials.BitcoinNetwork]! as BitcoinNetwork,
);

@@ -46,0 +46,0 @@ const testNodePassword = "1234!@#$";

@@ -19,7 +19,7 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved

export const assertValidBitcoinNetwork = (
bitcoinNetwork: BitcoinNetwork
bitcoinNetwork: BitcoinNetwork,
): void => {
if (!isBitcoinNetwork(bitcoinNetwork)) {
throw new Error(
`Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS}`
`Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS}`,
);

@@ -31,3 +31,3 @@ }

const packageJson = JSON.parse(
fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")
fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"),
);

@@ -38,3 +38,3 @@ return packageJson?.version;

export const getBitcoinNetworkOrThrow = (
bitcoinNetwork: BitcoinNetwork
bitcoinNetwork: BitcoinNetwork,
): BitcoinNetwork => {

@@ -47,3 +47,3 @@ assertValidBitcoinNetwork(bitcoinNetwork.toUpperCase() as BitcoinNetwork);

client: LightsparkClient,
bitcoinNetwork: BitcoinNetwork
bitcoinNetwork: BitcoinNetwork,
): Promise<string> => {

@@ -57,3 +57,3 @@ const account = await client.getCurrentAccount();

const entityForNetwork = entities.find(
(entity) => entity.bitcoinNetwork === bitcoinNetwork
(entity) => entity.bitcoinNetwork === bitcoinNetwork,
);

@@ -60,0 +60,0 @@

@@ -37,4 +37,4 @@ #!/usr/bin/env node

options: OptionValues,
credentials: EnvCredentials
) => Promise<unknown>
credentials: EnvCredentials,
) => Promise<unknown>,
) => {

@@ -45,5 +45,5 @@ const credentials = getCredentialsFromEnvOrThrow();

credentials.apiTokenClientId,
credentials.apiTokenClientSecret
credentials.apiTokenClientSecret,
),
credentials.baseUrl
credentials.baseUrl,
);

@@ -98,3 +98,3 @@ await action(client, options, credentials);

new AccountTokenAuthProvider(clientId, clientSecret),
baseUrl
baseUrl,
);

@@ -116,3 +116,3 @@

console.log(
"Could not find any nodes on the account with the provided API token client ID and secret for any bitcoin network."
"Could not find any nodes on the account with the provided API token client ID and secret for any bitcoin network.",
);

@@ -137,3 +137,3 @@ tokenBitcoinNetwork = await input({

options: OptionValues,
credentials: EnvCredentials
credentials: EnvCredentials,
) => {

@@ -167,3 +167,3 @@ const bitcoinNetwork = getBitcoinNetworkOrThrow(credentials.bitcoinNetwork);

JSON.stringify({ amount, memo, amp }, null, 2),
"\n"
"\n",
);

@@ -174,3 +174,3 @@ const encodedInvoice = await client.createInvoice(

memo,
amp ? InvoiceType.AMP : InvoiceType.STANDARD
amp ? InvoiceType.AMP : InvoiceType.STANDARD,
);

@@ -186,3 +186,3 @@ if (!encodedInvoice) {

client: LightsparkClient,
options: OptionValues
options: OptionValues,
) => {

@@ -194,3 +194,3 @@ const nodeId = await getNodeId(client, BitcoinNetwork.REGTEST);

JSON.stringify(options, null, 2),
"\n"
"\n",
);

@@ -200,3 +200,3 @@ const encodedInvoice = await client.createTestModeInvoice(

options.amount * 1000,
options.memo
options.memo,
);

@@ -212,3 +212,3 @@ if (!encodedInvoice) {

client: LightsparkClient,
options: OptionValues
options: OptionValues,
) => {

@@ -218,3 +218,3 @@ console.log(

JSON.stringify(options, null, 2),
"\n"
"\n",
);

@@ -228,3 +228,3 @@ const account = await client.getCurrentAccount();

"Transactions:",
JSON.stringify(transactionList?.entities, null, 2)
JSON.stringify(transactionList?.entities, null, 2),
);

@@ -237,3 +237,3 @@ };

JSON.stringify(options, null, 2),
"\n"
"\n",
);

@@ -246,7 +246,7 @@ const account = await client.getCurrentAccount();

client,
options.count
options.count,
);
console.log(
"paymentRequests:",
JSON.stringify(paymentRequests?.entities, null, 2)
JSON.stringify(paymentRequests?.entities, null, 2),
);

@@ -256,3 +256,3 @@ };

const balances = async (
client: LightsparkClient /* options: OptionValues */
client: LightsparkClient /* options: OptionValues */,
) => {

@@ -268,3 +268,3 @@ console.log("Fetching account balances...\n");

"Balances:",
JSON.stringify({ localBalance, remoteBalance }, null, 2)
JSON.stringify({ localBalance, remoteBalance }, null, 2),
);

@@ -274,3 +274,3 @@ };

const l1FeeEstimate = async (
client: LightsparkClient
client: LightsparkClient,
/* options: OptionValues */

@@ -286,3 +286,3 @@ ) => {

options: OptionValues,
credentials: EnvCredentials
credentials: EnvCredentials,
) => {

@@ -299,3 +299,3 @@ const bitcoinNetwork = getBitcoinNetworkOrThrow(credentials.bitcoinNetwork);

options: OptionValues,
credentials: EnvCredentials
credentials: EnvCredentials,
) => {

@@ -311,3 +311,3 @@ const bitcoinNetwork = getBitcoinNetworkOrThrow(credentials.bitcoinNetwork);

const currentAccount = async (
client: LightsparkClient
client: LightsparkClient,
/* options: OptionValues */

@@ -322,3 +322,3 @@ ) => {

client: LightsparkClient,
options: OptionValues
options: OptionValues,
) => {

@@ -340,3 +340,3 @@ let encodedInvoice = options.invoice;

options: OptionValues,
credentials: EnvCredentials
credentials: EnvCredentials,
) => {

@@ -354,3 +354,3 @@ const bitcoinNetwork = getBitcoinNetworkOrThrow(credentials.bitcoinNetwork);

options: OptionValues,
credentials: EnvCredentials
credentials: EnvCredentials,
) => {

@@ -381,3 +381,3 @@ const bitcoinNetwork = getBitcoinNetworkOrThrow(credentials.bitcoinNetwork);

JSON.stringify({ ...options, invoice: encodedInvoice }, null, 2),
"\n"
"\n",
);

@@ -391,3 +391,3 @@

60, // Default
options.amount === -1 ? undefined : options.amount * 1000
options.amount === -1 ? undefined : options.amount * 1000,
);

@@ -400,3 +400,3 @@ console.log("Payment:", JSON.stringify(payment, null, 2));

options: OptionValues,
credentials?: EnvCredentials
credentials?: EnvCredentials,
) => {

@@ -423,3 +423,3 @@ const nodeId = await getNodeId(client, BitcoinNetwork.REGTEST);

encodedInvoice,
options.amount === -1 ? undefined : options.amount * 1000
options.amount === -1 ? undefined : options.amount * 1000,
);

@@ -432,3 +432,3 @@ console.log("Payment:", JSON.stringify(payment, null, 2));

options: OptionValues,
credentials: EnvCredentials
credentials: EnvCredentials,
) => {

@@ -449,3 +449,3 @@ const bitcoinNetwork = getBitcoinNetworkOrThrow(credentials.bitcoinNetwork);

client: LightsparkClient,
options: OptionValues
options: OptionValues,
) => {

@@ -503,3 +503,3 @@ let mnemonic: Mnemonic;

"Add a memo describing the invoice.",
undefined
undefined,
)

@@ -510,3 +510,3 @@ .option(

safeParseInt,
0
0,
)

@@ -516,3 +516,3 @@ .option("--amp", "Flag to use AMP invoices.", false)

main(options, createInvoice).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -526,3 +526,3 @@ });

"Add a memo describing the invoice.",
undefined
undefined,
)

@@ -533,7 +533,7 @@ .option(

safeParseInt,
0
0,
)
.action((options) => {
main(options, createTestModeInvoice).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -548,7 +548,7 @@ });

safeParseInt,
25
25,
)
.action((options) => {
main(options, transactions).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -563,7 +563,7 @@ });

safeParseInt,
25
25,
)
.action((options) => {
main(options, invoices).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -577,3 +577,3 @@ });

main(options, decodeInvoice).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -586,3 +586,3 @@ });

main(options, balances).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -595,3 +595,3 @@ });

main(options, l1FeeEstimate).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -604,3 +604,3 @@ });

main(options, accountDashboard).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -613,3 +613,3 @@ });

main(options, singleNodeDashboard).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -622,3 +622,3 @@ });

main(options, currentAccount).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -631,3 +631,3 @@ });

main(options, createNodeWalletAddress).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -643,7 +643,7 @@ });

safeParseInt,
-1
-1,
)
.action((options) => {
main(options, payInvoice).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -654,3 +654,3 @@ });

.description(
"In test mode, simulates a payment from another node to an invoice."
"In test mode, simulates a payment from another node to an invoice.",
)

@@ -662,7 +662,7 @@ .option("-i, --invoice <value>", "The encoded payment request.")

safeParseInt,
-1
-1,
)
.action((options) => {
main(options, createTestModePayment).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -675,3 +675,3 @@ });

main(options, getNodeChannels).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -684,7 +684,7 @@ });

"-s --seed-phrase <value>",
"The seed phrase used to generate the keys need for your Lightspark node."
"The seed phrase used to generate the keys need for your Lightspark node.",
)
.action((options) => {
main(options, generateNodeKeys).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -700,3 +700,3 @@ });

initEnv(options).catch((err) =>
console.error("Oh no, something went wrong.\n", err)
console.error("Oh no, something went wrong.\n", err),
);

@@ -707,3 +707,3 @@ });

.description(
"Lightspark API CLI. Start by running init-env to set up your environment."
"Lightspark API CLI. Start by running init-env to set up your environment.",
)

@@ -710,0 +710,0 @@ .version(getPackageVersion())