@solard/cli 0.1.8 → 0.2.2

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/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @solard/cli
2
+
3
+ CLI adapter for `@solard/sdk`.
4
+
5
+ ```bash
6
+ slrd wallet create trader-1
7
+ slrd wallets
8
+ slrd token <mint> my-token
9
+ slrd buy my-token --wallet trader-1 --sol 0.05
10
+ slrd sell my-token --wallet trader-1
11
+ ```
12
+
13
+ Set `SLRD_MASTER_KEY` for persisted wallets and `RPC_ENDPOINT` for chain operations.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solard/cli",
3
- "version": "0.1.8",
4
- "description": "Multi-wallet Solana trading CLI UI and commands.",
3
+ "version": "0.2.2",
4
+ "description": "Command-line interface for the Solard SDK.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
7
7
  "bin": {
@@ -13,8 +13,12 @@
13
13
  "src",
14
14
  "README.md"
15
15
  ],
16
- "dependencies": {
17
- "@solard/core": "0.1.10"
16
+ "license": "MIT",
17
+ "engines": {
18
+ "bun": ">=1.1.0"
18
19
  },
19
- "license": "MIT"
20
+ "dependencies": {
21
+ "@solard/sdk": "0.2.0",
22
+ "bs58": "^6.0.0"
23
+ }
20
24
  }
package/src/index.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env bun
2
- import type { TokenRow } from "@solard/core/db/schema.ts";
3
- import { emit } from "@solard/core/core/ui.ts";
4
- import { listScripts, runScript } from "@solard/core/runner/run-script.ts";
2
+ import { listScripts, runScript, type TokenRow } from "@solard/sdk";
3
+
4
+ function emit(value: string): void {
5
+ process.stdout.write(value);
6
+ }
5
7
 
6
8
  const OWL = "🦉";
7
9
  type Flags = Map<string, string>;
@@ -116,6 +118,7 @@ function help(): string {
116
118
  return `${OWL} slrd — multi-wallet Solana CLI + SDK for traders and AI agents
117
119
 
118
120
  Wallets and tokens
121
+ slrd wallet create [name] Generate and persist an encrypted Solana wallet
119
122
  slrd import <private_key> [name]
120
123
  cat key.json | slrd import --stdin [name]
121
124
  slrd wallets [--token <token>] [--addresses-only] Show SOL and registered-token balances
@@ -125,13 +128,12 @@ Wallets and tokens
125
128
  slrd tokens
126
129
 
127
130
  Metadata and launching
128
- solwal launch pump --creator <wallet> (--uri <metadata_uri> | --metadata <json> | --image <path> --description <text>) [--alias <name>] [--live] [--skip-simulation]
131
+ slrd launch pump --creator <wallet> (--uri <metadata_uri> | --metadata <json> | --image <path> --description <text>) [--alias <name>] [--live] [--skip-simulation]
129
132
  [--deployment-sender helius-rpc|helius-fast] [--helius-tip-sol 0.01]
130
133
  slrd metadata upload --image <local_path> --name <name> --symbol <symbol> --description <text> [--provider pump-frontend|pinata]
131
134
  [--twitter <url>] [--telegram <url>] [--website <url>] [--video <url>] [--hide-name]
132
135
  slrd deploy pump --wallet <wallet> --name <name> --symbol <symbol> (--uri <metadata_uri> | --image <local_path> --description <text>) [--alias <name>] [--live]
133
136
  [--twitter <url>] [--telegram <url>] [--website <url>] [--video <url>] [--hide-name]
134
- slrd run launch-pump-token --creator <wallet> --metadata <token.json> [--deploy-only] [--live]
135
137
 
136
138
  Prices
137
139
  slrd quote buy <token|ca> --sol <amount> Inspect buy quote without submitting
@@ -143,7 +145,6 @@ Trading
143
145
  slrd buy <token|ca> (--wallet <wallet> | --wallets <w1,w2> | --group <name>) --sol <amount> [--slippage-bps 1500] [--sender rpc|helius|jito] [--simulate-only]
144
146
  slrd buy <future-mint> (--wallet <wallet> | --group <name>) (--sol <amount> | --lamports <amount> | --min-bps <n> --max-bps <n>) --spam [--live]
145
147
  slrd spam-buy [pump] <future-mint> (--wallet <wallet> | --group <name>) (--sol <amount> | --lamports <amount> | --min-bps <n> --max-bps <n>) [--sender <id>] [--live]
146
- bun run scripts/spam-pump-buyers.ts --mint <future-mint> (--wallet <wallet> | --group <name>) --amount-mode range-bps --min-bps <n> --max-bps <n> [--live]
147
148
  slrd sell <token|ca> (--wallet <wallet> | --wallets <w1,w2> | --group <name>) [--bps 10000] [--slippage-bps 1500] [--sender rpc|helius|jito] [--simulate-only]
148
149
  slrd unwrap-wsol (--wallet <wallet> | --wallets <w1,w2> | --group <name>) [--sender rpc|helius|jito] [--ignore-missing] [--simulate-only]
149
150
  slrd claim <token|ca> --wallet <wallet> [--sender rpc|helius|jito]
@@ -152,7 +153,6 @@ Scripts (strategies stay outside the kernel)
152
153
  slrd scripts List scripts registered in slrd.config.ts
153
154
  slrd run <name-or-path> [script flags...] Execute a script that imports slrd
154
155
  slrd run snipe --name <exact_name> --group <group> --sol 0.05 --sender jito
155
- slrd run claim-trade-send --claim <token> --buy <token> --wallet <wallet> --recipient <address>
156
156
 
157
157
  Groups and agents
158
158
  slrd group create <name> [description]
@@ -180,8 +180,8 @@ Transactions and ALTs
180
180
  slrd alt extend <address> --wallet <wallet> <account...>
181
181
 
182
182
  Environment
183
- SLRD_DB_PATH local shared database; default ./slrd.db
184
- SLRD_MASTER_KEY required to import/decrypt stored wallets
183
+ SLRD_DB_PATH shared SDK/CLI database; default ./slrd.db (SOLARD_DB_PATH alias supported)
184
+ SLRD_MASTER_KEY required to create/import/decrypt stored wallets
185
185
  RPC_ENDPOINT required only for chain operations
186
186
  HELIUS_SENDER_URL regional/global Helius Sender endpoint used by launch scripts
187
187
  HELIUS_RPC_URL RPC endpoint used for ordinary Helius-RPC buyer lane
@@ -212,8 +212,11 @@ async function main() {
212
212
  return;
213
213
  }
214
214
  if (command === "vanity") {
215
- const { generateMintKeypairWithSuffix, saveMintKeypairFile, cleanVanitySuffix } =
216
- await import("@solard/core/launches/pump/vanity-mint.ts");
215
+ const {
216
+ generateMintKeypairWithSuffix,
217
+ saveMintKeypairFile,
218
+ cleanVanitySuffix,
219
+ } = await import("@solard/sdk");
217
220
  const suffix = cleanVanitySuffix(need(flags, "suffix"));
218
221
  const out = need(flags, "out");
219
222
  const count = int(flags, "count", 1)!;
@@ -226,10 +229,14 @@ async function main() {
226
229
  timeoutMs: int(flags, "timeout-ms", 0)!,
227
230
  reportEvery: int(flags, "report-every", 1_000_000)!,
228
231
  onProgress: (p) =>
229
- emit(`${OWL} grinding ${p.suffix}: ${p.attempts} attempts, ${p.ratePerSecond}/s\n`),
232
+ emit(
233
+ `${OWL} grinding ${p.suffix}: ${p.attempts} attempts, ${p.ratePerSecond}/s\n`,
234
+ ),
230
235
  });
231
236
  const path = count === 1 ? out : out.replace(/(\.json)?$/, `-${i + 1}$1`);
232
- const saved = saveMintKeypairFile(path, found.mint, { force: flags.has("force") });
237
+ const saved = saveMintKeypairFile(path, found.mint, {
238
+ force: flags.has("force"),
239
+ });
233
240
  results.push({
234
241
  address: found.mint.publicKey.toBase58(),
235
242
  keypairPath: saved,
@@ -242,21 +249,15 @@ async function main() {
242
249
  return;
243
250
  }
244
251
  if (command === "spam-buy" || command === "buy-spam") {
245
- const { runPumpSpamBuyFromArgs } =
246
- await import("@solard/core/launches/pump/spam-buy-cli.ts");
252
+ const { runPumpSpamBuyFromArgs } = await import("@solard/sdk");
247
253
  await runPumpSpamBuyFromArgs(rest);
248
254
  return;
249
255
  }
250
256
  if (command === "buy" && flags.has("spam")) {
251
- const { runPumpSpamBuyFromArgs } =
252
- await import("@solard/core/launches/pump/spam-buy-cli.ts");
257
+ const { runPumpSpamBuyFromArgs } = await import("@solard/sdk");
253
258
  await runPumpSpamBuyFromArgs(rest);
254
259
  return;
255
260
  }
256
- // const { maybeRunWorkerCliCommand } =
257
- // await import("./worker-commands.js");
258
- // if (await maybeRunWorkerCliCommand({ values: [command, ...values], flags }))
259
- // return;
260
261
  if (command === "scripts") {
261
262
  emit(json(await listScripts()) + "\n");
262
263
  return;
@@ -272,8 +273,7 @@ async function main() {
272
273
  command === "launch" &&
273
274
  (values[0] === "pump" || values[0] === "pump-token")
274
275
  ) {
275
- const { runPumpTokenLaunchFromArgs } =
276
- await import("@solard/core/launches/pump/token-launch-cli.ts");
276
+ const { runPumpTokenLaunchFromArgs } = await import("@solard/sdk");
277
277
  await runPumpTokenLaunchFromArgs(rest.slice(1), {
278
278
  defaultSubmitMode: "after-deploy-processed",
279
279
  defaultDeploymentPriorityMicroLamports: 500_000,
@@ -290,29 +290,13 @@ async function main() {
290
290
  process.env.JITO_BLOCK_ENGINE_URL ??
291
291
  "https://mainnet.block-engine.jito.wtf"
292
292
  ).replace(/\/$/, "");
293
- const response = await fetch(`${endpoint}/api/v1/bundles`, {
294
- method: "POST",
295
- headers: { "content-type": "application/json" },
296
- body: JSON.stringify({
297
- jsonrpc: "2.0",
298
- id: Date.now(),
299
- method: "getTipAccounts",
300
- params: [],
301
- }),
302
- });
303
- const payload = (await response.json()) as {
304
- result?: string[];
305
- error?: unknown;
306
- };
307
- if (!response.ok || payload.error || !Array.isArray(payload.result))
308
- throw new Error(
309
- `Jito getTipAccounts failed: ${JSON.stringify(payload.error ?? response.status)}`,
310
- );
311
- emit(json({ endpoint, tipAccounts: payload.result }) + "\n");
293
+ const { getJitoTipAccounts } = await import("@solard/sdk");
294
+ const tipAccounts = await getJitoTipAccounts(endpoint);
295
+ emit(json({ endpoint, tipAccounts }) + "\n");
312
296
  return;
313
297
  }
314
298
  if (command === "metadata" && values[0] === "upload") {
315
- const { uploadPumpMetadata } = await import("@solard/core/metadata/pump-metadata.ts");
299
+ const { uploadPumpMetadata } = await import("@solard/sdk");
316
300
  const uploaded = await uploadPumpMetadata(
317
301
  {
318
302
  imagePath: need(flags, "image"),
@@ -338,12 +322,17 @@ async function main() {
338
322
  }
339
323
  const [{ sol, formatRaw }, { shortKey }, { createTraderSolard }] =
340
324
  await Promise.all([
341
- import("@solard/core/core/amounts.ts"),
342
- import("@solard/core/core/log.ts"),
343
- import("@solard/core/presets/trader.ts"),
325
+ import("@solard/sdk"),
326
+ import("@solard/sdk"),
327
+ import("@solard/sdk"),
344
328
  ]);
345
329
  const slrd = createTraderSolard();
346
330
  try {
331
+ if (command === "wallet" && values[0] === "create") {
332
+ const wallet = slrd.createWallet(values[1]);
333
+ emit(`${OWL} created @${wallet.name} ${wallet.address}\n`);
334
+ return;
335
+ }
347
336
  if (command === "export") {
348
337
  const ref = values[0];
349
338
  if (!ref)
@@ -382,10 +371,12 @@ async function main() {
382
371
  : values[0];
383
372
  if (!input)
384
373
  throw new Error(
385
- "Usage: slrd import <private_key> [name] or cat key.json | slrd import --stdin [name]",
374
+ "Usage: slrd import <private_key> [name] [--force] or cat key.json | slrd import --stdin [name] [--force]",
386
375
  );
387
376
  const name = flags.has("stdin") ? values[0] : values[1];
388
- const wallet = slrd.importWallet(input, name);
377
+ const wallet = slrd.importWallet(input, name, {
378
+ overwrite: flags.has("force") || flags.has("overwrite"),
379
+ });
389
380
  emit(`${OWL} imported @${wallet.name} ${wallet.address}\n`);
390
381
  return;
391
382
  }
@@ -431,8 +422,7 @@ async function main() {
431
422
  throw new Error(
432
423
  "Provide --uri <metadata_uri> or --image <local_path> --description <text>",
433
424
  );
434
- const { uploadPumpMetadata } =
435
- await import("@solard/core/metadata/pump-metadata.ts");
425
+ const { uploadPumpMetadata } = await import("@solard/sdk");
436
426
  uploadedMetadata = await uploadPumpMetadata(
437
427
  {
438
428
  imagePath: need(flags, "image"),
@@ -928,4 +918,4 @@ main().catch((error) => {
928
918
  process.exitCode = 1;
929
919
  });
930
920
 
931
- export { formatCliError } from "@solard/core";
921
+ export { formatCliError } from "@solard/sdk";
@@ -10,5 +10,5 @@ export const workerCommands: Record<string, (args: string[]) => void> = {
10
10
  },
11
11
  help: () => {
12
12
  console.log("Available commands: stats, signals, help");
13
- }
14
- };
13
+ },
14
+ };