mobilestacks 0.1.22 → 0.1.23

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/dist/cli/index.js CHANGED
@@ -11,10 +11,8 @@ const runtime_environment_1 = require("../core/runtime-environment");
11
11
  const tasks_definitions_1 = require("../core/tasks-definitions");
12
12
  const init_1 = require("./init");
13
13
  const inquirer_1 = __importDefault(require("inquirer"));
14
- // Import all user tasks
15
14
  const fs_1 = __importDefault(require("fs"));
16
15
  const path_1 = __importDefault(require("path"));
17
- // Auto-load all tasks in src/tasks
18
16
  const tasksDir = path_1.default.join(__dirname, '../tasks');
19
17
  fs_1.default.readdirSync(tasksDir)
20
18
  .filter(f => (f.endsWith('.ts') || f.endsWith('.js')) && !f.endsWith('.d.ts') && !f.includes('.test.'))
@@ -26,7 +24,6 @@ program
26
24
  .name('mobilestacks')
27
25
  .description('Professional Task Runner for Stacks')
28
26
  .version('0.1.0');
29
- // Init command for project scaffolding
30
27
  program
31
28
  .command('init')
32
29
  .description('Scaffold a new mobilestacks project and config')
@@ -34,7 +31,6 @@ program
34
31
  await (0, init_1.runInit)();
35
32
  process.exit(0);
36
33
  });
37
- // List all tasks if no command is given
38
34
  program.action(() => {
39
35
  console.log(chalk_1.default.bold.blue('\nMobilestacks - Professional Task Runner for Stacks\n'));
40
36
  console.log(chalk_1.default.white('USAGE: ') + chalk_1.default.green('mobilestacks <task> [options]\n'));
@@ -50,7 +46,6 @@ program.action(() => {
50
46
  console.log(chalk_1.default.white('\nDocs: ') + chalk_1.default.underline('https://github.com/your-org/mobilestacks#readme'));
51
47
  program.help({ error: false });
52
48
  });
53
- // Dynamically add all registered tasks
54
49
  tasks_definitions_1.TaskDefinitions.getInstance().getAllTasks().forEach(task => {
55
50
  const cmd = program.command(task.name)
56
51
  .description(task.description);
@@ -76,7 +71,6 @@ tasks_definitions_1.TaskDefinitions.getInstance().getAllTasks().forEach(task =>
76
71
  })));
77
72
  Object.assign(opts, answers);
78
73
  }
79
- // Type conversion
80
74
  task.params.forEach(p => {
81
75
  if (opts[p.name] && p.type === 'number')
82
76
  opts[p.name] = Number(opts[p.name]);
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAIA,wBAAsB,OAAO,kBAoF5B"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAIA,wBAAsB,OAAO,kBA6E5B"}
package/dist/cli/init.js CHANGED
@@ -35,7 +35,6 @@ async function runInit() {
35
35
  default: "m/44'/5757'/0'/0/0",
36
36
  },
37
37
  ]);
38
- // ── Config file: references env vars, never embeds secrets ──
39
38
  const config = `import 'dotenv/config';
40
39
 
41
40
  export default {
@@ -45,7 +44,6 @@ export default {
45
44
  },
46
45
  defaultNetwork: 'testnet',
47
46
  wallet: {
48
- // Secrets are read from environment variables — never hard-code them here.
49
47
  privateKey: process.env.MOBILESTACKS_PRIVATE_KEY || '',
50
48
  seedPhrase: process.env.MOBILESTACKS_SEED_PHRASE || '',
51
49
  derivationPath: ${JSON.stringify(answers.derivationPath)},
@@ -53,23 +51,19 @@ export default {
53
51
  };
54
52
  `;
55
53
  fs_1.default.writeFileSync(path_1.default.join(process.cwd(), 'mobilestacks.config.ts'), config);
56
- // ── .env file (if it doesn't exist yet) ──
57
54
  const envPath = path_1.default.join(process.cwd(), '.env');
58
55
  if (!fs_1.default.existsSync(envPath)) {
59
56
  const envContent = `# Mobilestacks secrets — NEVER commit this file!\nMOBILESTACKS_PRIVATE_KEY=\nMOBILESTACKS_SEED_PHRASE=\nSTACKS_MAINNET_URL=${answers.mainnetUrl}\nSTACKS_TESTNET_URL=${answers.testnetUrl}\n`;
60
- fs_1.default.writeFileSync(envPath, envContent, { mode: 0o600 }); // owner-only permissions
57
+ fs_1.default.writeFileSync(envPath, envContent, { mode: 0o600 });
61
58
  }
62
- // ── Scaffold example contract ──
63
59
  const contractsDir = path_1.default.join(process.cwd(), 'contracts');
64
60
  if (!fs_1.default.existsSync(contractsDir))
65
61
  fs_1.default.mkdirSync(contractsDir);
66
62
  fs_1.default.writeFileSync(path_1.default.join(contractsDir, 'sample-contract.clar'), '(define-public (hello-world)\n (ok "Hello, Stacks!"))\n');
67
- // ── Scaffold example user task ──
68
63
  const tasksDir = path_1.default.join(process.cwd(), 'src', 'tasks');
69
64
  if (!fs_1.default.existsSync(tasksDir))
70
65
  fs_1.default.mkdirSync(tasksDir, { recursive: true });
71
66
  fs_1.default.writeFileSync(path_1.default.join(tasksDir, 'example-task.ts'), "import { task } from 'mobilestacks';\n\ntask('example', 'An example user task for onboarding')\n .addParam('name', 'Your name', { type: 'string', required: false, defaultValue: 'World' })\n .setAction(async (args: Record<string, string>) => {\n return `Hello, ${args.name}! Welcome to mobilestacks.`;\n });\n");
72
- // ── Security notice ──
73
67
  console.log('\n✅ Created:');
74
68
  console.log(' • mobilestacks.config.ts (reads secrets from env vars)');
75
69
  console.log(' • .env (store your secrets here)');
@@ -1 +1 @@
1
- {"version":3,"file":"config-loading.d.ts","sourceRoot":"","sources":["../../src/config/config-loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK/E,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,kBAAkB,CAyB9G"}
1
+ {"version":3,"file":"config-loading.d.ts","sourceRoot":"","sources":["../../src/config/config-loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK/E,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,kBAAkB,CAuB9G"}
@@ -18,14 +18,12 @@ function loadConfig(configPath, cliOverrides = {}) {
18
18
  // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
19
19
  const userConfig = require(configFile);
20
20
  let config = userConfig.default || userConfig;
21
- // .env override
22
21
  if (env_1.env.privateKey)
23
22
  config.wallet.privateKey = env_1.env.privateKey;
24
23
  if (env_1.env.mainnetUrl)
25
24
  config.networks.mainnet.url = env_1.env.mainnetUrl.replace(/\/$/, "");
26
25
  if (env_1.env.testnetUrl)
27
26
  config.networks.testnet.url = env_1.env.testnetUrl.replace(/\/$/, "");
28
- // CLI overrides
29
27
  config = { ...config, ...cliOverrides };
30
28
  const parsed = config_1.MobilestacksConfigSchema.safeParse(config);
31
29
  if (!parsed.success) {
@@ -1 +1 @@
1
- {"version":3,"file":"dsl.d.ts","sourceRoot":"","sources":["../../src/core/dsl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAa,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;wBAI9B,MAAM,aACN,MAAM,YACP;QAAE,IAAI,CAAC,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAE;sBAYlF,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC;EAuBjG;AAED,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;wBAvC1D,MAAM,aACN,MAAM,YACP;QAAE,IAAI,CAAC,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAE;sBAYlF,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC;EAkCjG;AAGD,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAChF,MAAM,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;AAEtC,wBAAsB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,kBAAkB,iBAO5E;AAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"dsl.d.ts","sourceRoot":"","sources":["../../src/core/dsl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAa,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;wBAI9B,MAAM,aACN,MAAM,YACP;QAAE,IAAI,CAAC,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAE;sBAYlF,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC;EAsBjG;AAED,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;wBAtC1D,MAAM,aACN,MAAM,YACP;QAAE,IAAI,CAAC,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAE;sBAYlF,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC;EA+BjG;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAChF,MAAM,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;AAEtC,wBAAsB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,kBAAkB,iBAO5E;AAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
package/dist/core/dsl.js CHANGED
@@ -27,7 +27,6 @@ function task(name, description) {
27
27
  description,
28
28
  params,
29
29
  action: async (args, env) => {
30
- // Validate args against schemas if present
31
30
  for (const param of params) {
32
31
  if (param.schema && args[param.name] !== undefined) {
33
32
  try {
@@ -47,10 +46,8 @@ function task(name, description) {
47
46
  };
48
47
  }
49
48
  function subtask(name, description, parentTaskName) {
50
- // Register as a subtask with a parent if provided
51
49
  const sub = task(name, description);
52
50
  if (parentTaskName) {
53
- // Attach parent info for future use (e.g., dependency graph, CLI grouping)
54
51
  const def = tasks_definitions_1.TaskDefinitions.getInstance().getTask(name);
55
52
  if (def)
56
53
  def.parent = parentTaskName;
@@ -7,7 +7,6 @@ const zod_1 = require("zod");
7
7
  const extender_1 = require("./extender");
8
8
  (0, vitest_1.describe)('DSL', () => {
9
9
  (0, vitest_1.beforeEach)(() => {
10
- // Clear tasks before each test
11
10
  tasks_definitions_1.TaskDefinitions.getInstance()._tasks = [];
12
11
  });
13
12
  (0, vitest_1.it)('should register a task with generic parameters', () => {
@@ -27,16 +26,12 @@ const extender_1 = require("./extender");
27
26
  });
28
27
  const def = tasks_definitions_1.TaskDefinitions.getInstance().getTask('zod-task');
29
28
  (0, vitest_1.expect)(def).toBeDefined();
30
- // Mock environment
31
29
  const env = {};
32
- // Valid call
33
30
  const result = await def?.action({ age: 20 }, env);
34
31
  (0, vitest_1.expect)(result).toBe(20);
35
- // Invalid call
36
32
  await (0, vitest_1.expect)(def?.action({ age: 10 }, env)).rejects.toThrow('Invalid value for parameter \'age\'');
37
33
  });
38
34
  (0, vitest_1.it)('should support environment extensions', () => {
39
- // Clear extensions
40
35
  extender_1.Extender.getInstance()._extensions = [];
41
36
  (0, extender_1.extendEnvironment)((env) => {
42
37
  env['foo'] = 'bar';
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-environment.d.ts","sourceRoot":"","sources":["../../src/core/runtime-environment.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAiB,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAG/D,qBAAa,kBAAkB;IACtB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAG;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;gBAEX,MAAM,EAAE,kBAAkB;CAkEvC"}
1
+ {"version":3,"file":"runtime-environment.d.ts","sourceRoot":"","sources":["../../src/core/runtime-environment.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAiB,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAG/D,qBAAa,kBAAkB;IACtB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAG;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;gBAEX,MAAM,EAAE,kBAAkB;CA6DvC"}
@@ -14,7 +14,6 @@ class RuntimeEnvironment {
14
14
  if (!networkConfig) {
15
15
  throw new Error(`Network config not found for: ${networkName}`);
16
16
  }
17
- // Instantiate proper StacksNetwork
18
17
  if (networkName === 'mainnet' || networkName === 'testnet') {
19
18
  this.network = (0, network_1.createNetwork)({
20
19
  network: networkName,
@@ -22,13 +21,11 @@ class RuntimeEnvironment {
22
21
  });
23
22
  }
24
23
  else {
25
- // Default to testnet structure for custom networks
26
24
  this.network = (0, network_1.createNetwork)({
27
25
  network: 'testnet',
28
26
  client: { baseUrl: networkConfig.url }
29
27
  });
30
28
  }
31
- // ── Resolve wallet secrets (env vars take priority over config) ──
32
29
  const privateKey = process.env.MOBILESTACKS_PRIVATE_KEY ||
33
30
  process.env.STACKS_PRIVATE_KEY ||
34
31
  config.wallet.privateKey ||
@@ -59,11 +56,9 @@ class RuntimeEnvironment {
59
56
  });
60
57
  }
61
58
  else {
62
- // No secrets anywhere — warn but don't crash (devnet may not need a wallet)
63
59
  console.warn('⚠️ No wallet secret found. Set MOBILESTACKS_PRIVATE_KEY or MOBILESTACKS_SEED_PHRASE in your .env file.');
64
60
  }
65
61
  this.stacks = {};
66
- // Apply extensions
67
62
  for (const extension of extender_1.Extender.getInstance().getExtensions()) {
68
63
  extension(this);
69
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"simnet.d.ts","sourceRoot":"","sources":["../../src/core/simnet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,KAAK,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAE7D,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAS;IAC1B,MAAM,EAAG,cAAc,CAAC;IACxB,QAAQ,EAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC,OAAO;WAEa,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAiBpC,WAAW,IAAI,MAAM;IAMrB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMhC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM;IAI/E,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM;IAI3E,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAGvE"}
1
+ {"version":3,"file":"simnet.d.ts","sourceRoot":"","sources":["../../src/core/simnet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,KAAK,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAE7D,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAS;IAC1B,MAAM,EAAG,cAAc,CAAC;IACxB,QAAQ,EAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC,OAAO;WAEa,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAepC,WAAW,IAAI,MAAM;IAMrB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMhC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM;IAI/E,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM;IAI3E,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAGvE"}
@@ -7,11 +7,9 @@ class Simnet {
7
7
  static async init() {
8
8
  if (!Simnet._instance) {
9
9
  Simnet._instance = new Simnet();
10
- // Initialize SDK - auto-detects Clarinet.toml from CWD
11
10
  try {
12
11
  console.log('Initializing Simnet...');
13
12
  Simnet._instance.simnet = await (0, clarinet_sdk_1.initSimnet)();
14
- // Get accounts
15
13
  Simnet._instance.accounts = Simnet._instance.simnet.getAccounts();
16
14
  }
17
15
  catch (error) {
@@ -12,9 +12,8 @@ function maskAddress(address) {
12
12
  }
13
13
  function containsSecret(obj) {
14
14
  const str = JSON.stringify(obj);
15
- return /[A-Za-z0-9]{32,}/.test(str); // crude check for long secrets
15
+ return /[A-Za-z0-9]{32,}/.test(str);
16
16
  }
17
- // Deploy a Clarity contract to Stacks mainnet or testnet
18
17
  (0, dsl_1.task)('deploy-contract', 'Deploy a Clarity smart contract to Stacks blockchain')
19
18
  .addParam('contractName', 'Name of the contract', { type: 'string', required: true })
20
19
  .addParam('file', 'Path to Clarity contract file', { type: 'string', required: true })
@@ -49,7 +48,6 @@ function containsSecret(obj) {
49
48
  if (containsSecret(result)) {
50
49
  console.warn('[mobilestacks] Warning: Output may contain sensitive data.');
51
50
  }
52
- // Mask any address fields if present
53
51
  if (result && result.txid) {
54
52
  const resObj = result;
55
53
  resObj.explorerUrl = network === 'mainnet'
@@ -72,6 +72,5 @@ function containsSecret(obj) {
72
72
  : `https://explorer.hiro.so/txid/${result.txid}?chain=testnet`;
73
73
  resObj.txid = maskAddress(result.txid);
74
74
  }
75
- // Broadcast transaction returns txid or error details
76
75
  return result;
77
76
  });
@@ -8,14 +8,13 @@ const node_fetch_1 = __importDefault(require("node-fetch"));
8
8
  const transactions_1 = require("@stacks/transactions");
9
9
  function containsSecret(obj) {
10
10
  const str = JSON.stringify(obj);
11
- return /[A-Za-z0-9]{32,}/.test(str); // crude check for long secrets
11
+ return /[A-Za-z0-9]{32,}/.test(str);
12
12
  }
13
13
  (0, dsl_1.task)('get-balance', 'Get STX balance for the configured wallet address or a provided address')
14
14
  .addParam('address', 'STX address to check (optional, defaults to wallet main address)', { type: 'string', required: false })
15
15
  .addParam('network', 'Network (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
16
16
  .setAction(async (args, env) => {
17
17
  const networkName = args.network;
18
- // dynamically derive address if not provided
19
18
  let address = args.address;
20
19
  if (!address) {
21
20
  if (!env.wallet.privateKey)
@@ -16,7 +16,6 @@ const node_fetch_1 = __importDefault(require("node-fetch"));
16
16
  const apiUrl = network === 'mainnet'
17
17
  ? env.config.networks.mainnet.url
18
18
  : env.config.networks.testnet.url;
19
- // Hiro API expects the full Contract Principal ID (Address.Name)
20
19
  const fullContractId = contractAddress.includes('.')
21
20
  ? contractAddress
22
21
  : `${contractAddress}.${contractName}`;
@@ -11,7 +11,7 @@ function maskAddress(address) {
11
11
  }
12
12
  function containsSecret(obj) {
13
13
  const str = JSON.stringify(obj);
14
- return /[A-Za-z0-9]{32,}/.test(str); // crude check for long secrets
14
+ return /[A-Za-z0-9]{32,}/.test(str);
15
15
  }
16
16
  (0, dsl_1.task)('get-tx-history', 'Get transaction history for the configured wallet address')
17
17
  .addParam('limit', 'Number of transactions to fetch', { type: 'number', required: false, defaultValue: 10 })
@@ -39,7 +39,6 @@ function containsSecret(obj) {
39
39
  fee_rate: tx.fee_rate,
40
40
  block_height: tx.block_height
41
41
  }));
42
- // Mask address in logs and warn if secrets detected
43
42
  if (containsSecret(txs)) {
44
43
  console.warn('[mobilestacks] Warning: Output may contain sensitive data.');
45
44
  }
@@ -5,7 +5,7 @@ const wallet_sdk_1 = require("@stacks/wallet-sdk");
5
5
  const transactions_1 = require("@stacks/transactions");
6
6
  function containsSecret(obj) {
7
7
  const str = JSON.stringify(obj);
8
- return /[A-Za-z0-9]{32,}/.test(str); // crude check for long secrets
8
+ return /[A-Za-z0-9]{32,}/.test(str);
9
9
  }
10
10
  (0, dsl_1.task)('list-accounts', 'List all accounts derived from the configured seed phrase')
11
11
  .addParam('network', 'Network (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
@@ -8,9 +8,8 @@ function maskAddress(address) {
8
8
  }
9
9
  function containsSecret(obj) {
10
10
  const str = JSON.stringify(obj);
11
- return /[A-Za-z0-9]{32,}/.test(str); // crude check for long secrets
11
+ return /[A-Za-z0-9]{32,}/.test(str);
12
12
  }
13
- // This task sends STX to an address using the loaded SRE (env)
14
13
  (0, dsl_1.task)('send-stx', 'Sends STX to an address')
15
14
  .addParam('to', 'Recipient STX address', { type: 'string', required: true })
16
15
  .addParam('amount', 'Amount in STX (e.g. 10.5)', { type: 'number', required: true })
@@ -31,7 +30,6 @@ function containsSecret(obj) {
31
30
  network: networkName,
32
31
  client: { baseUrl: networkUrl }
33
32
  });
34
- // Convert STX to microSTX (1 STX = 1,000,000 microSTX)
35
33
  const amountMicroStx = BigInt(Math.floor(amountSTX * 1_000_000));
36
34
  const txOptions = {
37
35
  recipient: to,
@@ -48,7 +46,6 @@ function containsSecret(obj) {
48
46
  if (containsSecret(result)) {
49
47
  console.warn('[mobilestacks] Warning: Output may contain sensitive data.');
50
48
  }
51
- // Mask any address fields if present
52
49
  if (result && result.txid) {
53
50
  const resObj = result;
54
51
  resObj.explorerUrl = networkName === 'mainnet'
@@ -23,7 +23,6 @@ const fs_1 = __importDefault(require("fs"));
23
23
  const fullContractId = contractAddress.includes('.')
24
24
  ? contractAddress
25
25
  : `${contractAddress}.${contractName}`;
26
- // Fetch contract source from chain using full principal ID
27
26
  const url = `${apiUrl}/extended/v1/contract/${fullContractId}`;
28
27
  const res = await (0, node_fetch_1.default)(url);
29
28
  if (!res.ok)
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAKH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -8,8 +8,6 @@ exports.NetworkConfigSchema = zod_1.z.object({
8
8
  explorerUrl: zod_1.z.string().url().optional(),
9
9
  faucetUrl: zod_1.z.string().url().nullable().optional(),
10
10
  });
11
- // Wallet config: secrets are resolved at runtime from env vars.
12
- // Config values are optional fallbacks.
13
11
  exports.WalletConfigSchema = zod_1.z.object({
14
12
  privateKey: zod_1.z.string().optional(),
15
13
  seedPhrase: zod_1.z.string().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobilestacks",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Task Runner & CLI for the Stacks Blockchain",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",