mobilestacks 0.1.20 → 0.1.22
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.
|
@@ -19,10 +19,14 @@ function containsSecret(obj) {
|
|
|
19
19
|
.addParam('contractName', 'Name of the contract', { type: 'string', required: true })
|
|
20
20
|
.addParam('file', 'Path to Clarity contract file', { type: 'string', required: true })
|
|
21
21
|
.addParam('network', 'Network to deploy to (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
|
|
22
|
+
.addParam('clarityVersion', 'Version of Clarity to use (1|2|3|4)', { type: 'number', required: false, defaultValue: 2 })
|
|
23
|
+
.addParam('fee', 'Custom fee in microSTX', { type: 'number', required: false })
|
|
22
24
|
.setAction(async (args, env) => {
|
|
23
25
|
const contractName = args.contractName;
|
|
24
26
|
const file = args.file;
|
|
25
27
|
const network = args.network;
|
|
28
|
+
const clarityVersion = args.clarityVersion;
|
|
29
|
+
const fee = args.fee;
|
|
26
30
|
let codeBody = fs_1.default.readFileSync(file, 'utf8');
|
|
27
31
|
codeBody = codeBody.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
28
32
|
codeBody = codeBody.replace(/^\uFEFF/, '').replace(/[^\x20-\x7E\n\t]/g, '');
|
|
@@ -32,12 +36,15 @@ function containsSecret(obj) {
|
|
|
32
36
|
else {
|
|
33
37
|
env.network = (0, network_1.createNetwork)({ network: 'testnet', client: { baseUrl: env.config.networks.testnet.url } });
|
|
34
38
|
}
|
|
35
|
-
const
|
|
39
|
+
const txOptions = {
|
|
36
40
|
contractName,
|
|
37
41
|
codeBody,
|
|
42
|
+
clarityVersion,
|
|
43
|
+
fee: fee !== undefined ? fee : undefined,
|
|
38
44
|
senderKey: env.wallet.privateKey,
|
|
39
45
|
network: env.network,
|
|
40
|
-
}
|
|
46
|
+
};
|
|
47
|
+
const tx = await (0, transactions_1.makeContractDeploy)(txOptions);
|
|
41
48
|
const result = await (0, transactions_1.broadcastTransaction)({ transaction: tx, network: env.network });
|
|
42
49
|
if (containsSecret(result)) {
|
|
43
50
|
console.warn('[mobilestacks] Warning: Output may contain sensitive data.');
|
|
@@ -30,12 +30,14 @@ function containsSecret(obj) {
|
|
|
30
30
|
.addParam('functionName', 'Function name', { type: 'string', required: true })
|
|
31
31
|
.addParam('args', 'Comma-separated args e.g. u1,"hello",ST...', { type: 'string', required: false, defaultValue: '' })
|
|
32
32
|
.addParam('network', 'Network (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
|
|
33
|
+
.addParam('fee', 'Custom fee in microSTX', { type: 'number', required: false })
|
|
33
34
|
.setAction(async (args, env) => {
|
|
34
35
|
const contractAddress = args.contractAddress;
|
|
35
36
|
const contractName = args.contractName;
|
|
36
37
|
const functionName = args.functionName;
|
|
37
38
|
const fnArgs = args.args;
|
|
38
39
|
const networkName = args.network;
|
|
40
|
+
const fee = args.fee;
|
|
39
41
|
const wallet = env.wallet;
|
|
40
42
|
const networkUrl = networkName === 'mainnet'
|
|
41
43
|
? env.config.networks.mainnet.url
|
|
@@ -53,6 +55,7 @@ function containsSecret(obj) {
|
|
|
53
55
|
contractName,
|
|
54
56
|
functionName,
|
|
55
57
|
functionArgs: parsedArgs,
|
|
58
|
+
fee: fee !== undefined ? fee : undefined,
|
|
56
59
|
senderKey: wallet.privateKey,
|
|
57
60
|
validateWithAbi: false,
|
|
58
61
|
network,
|
package/dist/tasks/send-stx.js
CHANGED
|
@@ -16,11 +16,13 @@ function containsSecret(obj) {
|
|
|
16
16
|
.addParam('amount', 'Amount in STX (e.g. 10.5)', { type: 'number', required: true })
|
|
17
17
|
.addParam('memo', 'Optional memo', { type: 'string', required: false, defaultValue: '' })
|
|
18
18
|
.addParam('network', 'Network (mainnet|testnet)', { type: 'string', required: false, defaultValue: 'testnet' })
|
|
19
|
+
.addParam('fee', 'Custom fee in microSTX', { type: 'number', required: false })
|
|
19
20
|
.setAction(async (args, env) => {
|
|
20
21
|
const to = args.to;
|
|
21
22
|
const amountSTX = args.amount;
|
|
22
23
|
const memo = args.memo;
|
|
23
24
|
const networkName = args.network;
|
|
25
|
+
const fee = args.fee;
|
|
24
26
|
const wallet = env.wallet;
|
|
25
27
|
const networkUrl = networkName === 'mainnet'
|
|
26
28
|
? env.config.networks.mainnet.url
|
|
@@ -31,13 +33,17 @@ function containsSecret(obj) {
|
|
|
31
33
|
});
|
|
32
34
|
// Convert STX to microSTX (1 STX = 1,000,000 microSTX)
|
|
33
35
|
const amountMicroStx = BigInt(Math.floor(amountSTX * 1_000_000));
|
|
34
|
-
const
|
|
36
|
+
const txOptions = {
|
|
35
37
|
recipient: to,
|
|
36
38
|
amount: amountMicroStx,
|
|
37
39
|
senderKey: wallet.privateKey,
|
|
38
40
|
network,
|
|
39
41
|
memo: memo || undefined
|
|
40
|
-
}
|
|
42
|
+
};
|
|
43
|
+
if (fee !== undefined) {
|
|
44
|
+
txOptions.fee = fee;
|
|
45
|
+
}
|
|
46
|
+
const tx = await (0, transactions_1.makeSTXTokenTransfer)(txOptions);
|
|
41
47
|
const result = await (0, transactions_1.broadcastTransaction)({ transaction: tx, network });
|
|
42
48
|
if (containsSecret(result)) {
|
|
43
49
|
console.warn('[mobilestacks] Warning: Output may contain sensitive data.');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobilestacks",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.22",
|
|
4
|
+
"description": "Task Runner & CLI for the Stacks Blockchain",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@stacks/network": "latest",
|
|
62
|
-
"@stacks/transactions": "
|
|
62
|
+
"@stacks/transactions": "^7.3.1",
|
|
63
63
|
"@stacks/wallet-sdk": "latest",
|
|
64
64
|
"chalk": "^4.1.2",
|
|
65
65
|
"commander": "^11.0.0",
|