@kadena/kadena-cli
Version:
Kadena CLI tool to interact with the Kadena blockchain (manage keys, transactions, etc.)
77 lines • 2.59 kB
JavaScript
import { input } from '../utils/prompts.js';
export async function numberOfAccountsPrompt() {
const noAccounts = await input({
message: 'Enter the amount of accounts to be created in the simulation:',
default: '6',
validate: (value) => {
const valid = !isNaN(parseInt(value));
return valid || 'Please enter a number';
},
});
return parseInt(noAccounts);
}
export async function transferIntervalPrompt() {
const transferInterval = await input({
message: 'Enter the transfer interval in milliseconds:',
default: '100',
validate: (value) => {
const valid = !isNaN(parseInt(value));
return valid || 'Please enter a number';
},
});
return parseInt(transferInterval);
}
export async function maxTransferAmountPrompt() {
const maxAmount = await input({
message: 'Enter the max transfer amount per single transaction (coin):',
default: '25',
validate: (value) => {
const valid = !isNaN(parseInt(value));
return valid || 'Please enter a number';
},
});
return parseInt(maxAmount);
}
export async function tokenPoolPrompt() {
const tokenPool = await input({
message: 'Enter the total token pool (coin):',
default: '1000000',
validate: (value) => {
const valid = !isNaN(parseInt(value));
return valid || 'Please enter a number';
},
});
return parseInt(tokenPool);
}
export function seedPrompt() {
return input({
message: 'Enter the seed for the simulation:',
default: Date.now().toString(),
});
}
export function defaultChainIdPrompt() {
return input({
message: 'Specify the default chain for the simulation (0-19):',
default: '0',
validate: (value) => {
const valid = !isNaN(parseInt(value)) &&
parseInt(value) >= 0 &&
parseInt(value) <= 19;
return valid || 'Please enter a valid chain id';
},
});
}
export async function maxTimePrompt() {
const maxTime = await input({
message: 'Specify the maximum time in miliseconds for the simulation:',
default: (86400000 * 7).toString(), // 7 days
validate: (value) => {
if (value === null || value === '')
return true;
const valid = !isNaN(parseFloat(value));
return valid || 'Please enter a number';
},
});
return parseInt(maxTime);
}
//# sourceMappingURL=simulate.js.map