mobilestacks 0.1.15 → 0.1.17
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
|
@@ -65,14 +65,14 @@ tasks_definitions_1.TaskDefinitions.getInstance().getAllTasks().forEach(task =>
|
|
|
65
65
|
});
|
|
66
66
|
cmd.action(async (opts) => {
|
|
67
67
|
try {
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
const answers = await inquirer_1.default.prompt(
|
|
68
|
+
const argsString = process.argv.slice(3).join(' ');
|
|
69
|
+
const unprovided = task.params.filter(p => !argsString.includes(`--${p.name}`));
|
|
70
|
+
if (unprovided.length > 0 && process.stdout.isTTY) {
|
|
71
|
+
const answers = await inquirer_1.default.prompt(unprovided.map(p => ({
|
|
72
72
|
type: p.type === 'boolean' ? 'confirm' : 'input',
|
|
73
73
|
name: p.name,
|
|
74
74
|
message: p.description,
|
|
75
|
-
default: p.defaultValue
|
|
75
|
+
default: opts[p.name] !== undefined ? opts[p.name] : p.defaultValue
|
|
76
76
|
})));
|
|
77
77
|
Object.assign(opts, answers);
|
|
78
78
|
}
|
|
@@ -14,12 +14,15 @@ function containsSecret(obj) {
|
|
|
14
14
|
}
|
|
15
15
|
(0, dsl_1.task)('get-balance', 'Get STX balance for the configured wallet address or a provided address')
|
|
16
16
|
.addParam('address', 'STX address to check (optional, defaults to wallet main address)', { type: 'string', required: false })
|
|
17
|
+
.addParam('network', 'Network (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
|
|
17
18
|
.setAction(async (args, env) => {
|
|
18
19
|
const address = args.address || env.wallet.address;
|
|
20
|
+
const networkName = args.network;
|
|
19
21
|
if (!address)
|
|
20
22
|
throw new Error('No wallet address found.');
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
+
const apiUrl = networkName === 'mainnet'
|
|
24
|
+
? env.config.networks.mainnet.url
|
|
25
|
+
: env.config.networks.testnet.url;
|
|
23
26
|
const url = `${apiUrl}/extended/v1/address/${address}/balances`;
|
|
24
27
|
const res = await (0, node_fetch_1.default)(url);
|
|
25
28
|
if (!res.ok)
|
|
@@ -14,12 +14,15 @@ function containsSecret(obj) {
|
|
|
14
14
|
}
|
|
15
15
|
(0, dsl_1.task)('get-tx-history', 'Get transaction history for the configured wallet address')
|
|
16
16
|
.addParam('limit', 'Number of transactions to fetch', { type: 'number', required: false, defaultValue: 10 })
|
|
17
|
+
.addParam('network', 'Network (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
|
|
17
18
|
.setAction(async (args, env) => {
|
|
18
19
|
const address = env.wallet.address;
|
|
20
|
+
const networkName = args.network;
|
|
19
21
|
if (!address)
|
|
20
22
|
throw new Error('No wallet address found.');
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
+
const apiUrl = networkName === 'mainnet'
|
|
24
|
+
? env.config.networks.mainnet.url
|
|
25
|
+
: env.config.networks.testnet.url;
|
|
23
26
|
const url = `${apiUrl}/extended/v1/address/${address}/transactions?limit=${args.limit}`;
|
|
24
27
|
const res = await (0, node_fetch_1.default)(url);
|
|
25
28
|
if (!res.ok)
|
package/dist/tasks/send-stx.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const dsl_1 = require("../core/dsl");
|
|
4
4
|
const transactions_1 = require("@stacks/transactions");
|
|
5
|
+
const network_1 = require("@stacks/network");
|
|
5
6
|
function maskAddress(address) {
|
|
6
7
|
return address ? address.slice(0, 6) + '...' + address.slice(-4) : '';
|
|
7
8
|
}
|
|
@@ -14,11 +15,20 @@ function containsSecret(obj) {
|
|
|
14
15
|
.addParam('to', 'Recipient STX address', { type: 'string', required: true })
|
|
15
16
|
.addParam('amount', 'Amount in STX (e.g. 10.5)', { type: 'number', required: true })
|
|
16
17
|
.addParam('memo', 'Optional memo', { type: 'string', required: false, defaultValue: '' })
|
|
18
|
+
.addParam('network', 'Network (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
|
|
17
19
|
.setAction(async (args, env) => {
|
|
18
20
|
const to = args.to;
|
|
19
21
|
const amountSTX = args.amount;
|
|
20
22
|
const memo = args.memo;
|
|
21
|
-
const
|
|
23
|
+
const networkName = args.network;
|
|
24
|
+
const wallet = env.wallet;
|
|
25
|
+
const networkUrl = networkName === 'mainnet'
|
|
26
|
+
? env.config.networks.mainnet.url
|
|
27
|
+
: env.config.networks.testnet.url;
|
|
28
|
+
const network = (0, network_1.createNetwork)({
|
|
29
|
+
network: networkName,
|
|
30
|
+
client: { baseUrl: networkUrl }
|
|
31
|
+
});
|
|
22
32
|
// Convert STX to microSTX (1 STX = 1,000,000 microSTX)
|
|
23
33
|
const amountMicroStx = BigInt(Math.floor(amountSTX * 1_000_000));
|
|
24
34
|
const tx = await (0, transactions_1.makeSTXTokenTransfer)({
|