Skip to content

Commit

Permalink
yarn format with newer version of prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov authored and pLabarta committed Aug 10, 2023
1 parent f56e769 commit 198e6d0
Show file tree
Hide file tree
Showing 32 changed files with 401 additions and 401 deletions.
4 changes: 2 additions & 2 deletions scripts/cc-cli/src/commands/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ async function balanceAction(options: OptionValues) {
const address = parseAddressOrExit(
requiredInput(
options.address,
"Failed to show balance: Must specify an address"
)
"Failed to show balance: Must specify an address",
),
);

const balance = await getBalance(address, api);
Expand Down
20 changes: 10 additions & 10 deletions scripts/cc-cli/src/commands/bond.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export function makeBondCommand() {
cmd.option("-c, --controller [controller]", "Specify controller address");
cmd.option(
"-r, --reward-destination [reward-destination]",
"Specify reward destination account to use for new account"
"Specify reward destination account to use for new account",
);
cmd.option(
"-x, --extra",
"Bond as extra, adding more funds to an existing bond"
"Bond as extra, adding more funds to an existing bond",
);
cmd.action(bondAction);
return cmd;
Expand Down Expand Up @@ -65,7 +65,7 @@ async function bondAction(options: OptionValues) {
amount,
rewardDestination,
api,
extra
extra,
);

console.log(bondTxResult.info);
Expand All @@ -81,8 +81,8 @@ function checkBalanceAgainstBondAmount(balance: AccountBalance, amount: BN) {
if (balance.transferable.lt(amount)) {
console.error(
`Insufficient funds to bond ${toCTCString(amount)}, only ${toCTCString(
balance.transferable
)} available`
balance.transferable,
)} available`,
);
process.exit(1);
}
Expand All @@ -92,24 +92,24 @@ function parseOptions(options: OptionValues) {
const amount = parseAmountOrExit(
requiredInput(
options.amount,
"Failed to bond: Must specify an amount to bond"
)
"Failed to bond: Must specify an amount to bond",
),
);
checkAmount(amount);

const controller = parseAddressOrExit(
requiredInput(
options.controller,
"Failed to bond: Must specify a controller address"
)
"Failed to bond: Must specify a controller address",
),
);

const rewardDestination = checkRewardDestination(
parseChoiceOrExit(inputOrDefault(options.rewardDestination, "Staked"), [
"Staked",
"Stash",
"Controller",
])
]),
);

const extra = parseBoolean(options.extra);
Expand Down
2 changes: 1 addition & 1 deletion scripts/cc-cli/src/commands/chill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { setInteractivity } from "../utils/interactive";
export function makeChillCommand() {
const cmd = new Command("chill");
cmd.description(
"Signal intention to stop validating from a Controller account"
"Signal intention to stop validating from a Controller account",
);
cmd.action(chillAction);
return cmd;
Expand Down
14 changes: 7 additions & 7 deletions scripts/cc-cli/src/commands/distributeRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function makeDistributeRewardsCommand() {
cmd.description("Distribute all pending rewards for all validators");
cmd.option(
"-v, --validator-id [stash-address]",
"Specify the Stash address of Validator to distribute rewards for"
"Specify the Stash address of Validator to distribute rewards for",
);
cmd.option("-e, --era [era]", "Specify era to distribute rewards for");
cmd.action(distributeRewardsAction);
Expand All @@ -33,7 +33,7 @@ async function distributeRewardsAction(options: OptionValues) {
const eraIsValid = await checkEraIsInHistory(era, api);
if (!eraIsValid) {
console.error(
`Failed to distribute rewards: Era ${era} is not included in history; only the past 84 eras are eligible`
`Failed to distribute rewards: Era ${era} is not included in history; only the past 84 eras are eligible`,
);
process.exit(1);
}
Expand All @@ -56,20 +56,20 @@ function parseOptions(options: OptionValues) {
const validator = parseAddressOrExit(
requiredInput(
options.validatorId,
"Failed to distribute rewards: Must specify a validator address"
)
"Failed to distribute rewards: Must specify a validator address",
),
);

const era = parseIntegerOrExit(
requiredInput(
options.era,
"Failed to distribute rewards: Must specify an era"
)
"Failed to distribute rewards: Must specify an era",
),
);

if (era < 0) {
console.error(
`Failed to distribute rewards: Era ${era} is invalid; must be a positive integer`
`Failed to distribute rewards: Era ${era} is invalid; must be a positive integer`,
);
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/cc-cli/src/commands/newSeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function parseLength(length: string): 12 | 15 | 18 | 21 | 24 {
parsed !== 24
) {
console.error(
"Failed to create new seed phrase: Invalid length, must be one of 12, 15, 18, 21 or 24"
"Failed to create new seed phrase: Invalid length, must be one of 12, 15, 18, 21 or 24",
);
process.exit(1);
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/cc-cli/src/commands/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function makeSendCommand() {
cmd.description("Send CTC from an account");
cmd.option(
"--use-ecdsa",
"Use ECDSA signature scheme and a private key instead of a mnemonic phrase"
"Use ECDSA signature scheme and a private key instead of a mnemonic phrase",
);
cmd.option("-a, --amount [amount]", "Amount to send");
cmd.option("-t, --to [to]", "Specify recipient address");
Expand Down Expand Up @@ -49,11 +49,11 @@ async function sendAction(options: OptionValues) {

function parseOptions(options: OptionValues) {
const amount = parseAmountOrExit(
requiredInput(options.amount, "Failed to send CTC: Must specify an amount")
requiredInput(options.amount, "Failed to send CTC: Must specify an amount"),
);

const recipient = parseAddressOrExit(
requiredInput(options.to, "Failed to send CTC: Must specify a recipient")
requiredInput(options.to, "Failed to send CTC: Must specify a recipient"),
);

const useEcdsa = parseBoolean(options.useEcdsa);
Expand Down
4 changes: 2 additions & 2 deletions scripts/cc-cli/src/commands/setKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ async function setKeysAction(options: OptionValues) {
let keys;
if (!options.keys && !options.rotate) {
console.log(
"Must specify keys to set or generate new ones using the --rotate flag"
"Must specify keys to set or generate new ones using the --rotate flag",
);
process.exit(1);
} else if (options.keys && options.rotate) {
console.error(
"Must either specify keys or rotate to generate new ones, can not do both"
"Must either specify keys or rotate to generate new ones, can not do both",
);
process.exit(1);
} else if (options.rotate) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/cc-cli/src/commands/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function makeStatusCommand() {
cmd.description("Get staking status for an address");
cmd.option(
"--validator [address]",
"Validator stash address to get status for"
"Validator stash address to get status for",
);
cmd.option("--chain", "Show chain status");
cmd.action(statusAction);
Expand Down
8 changes: 4 additions & 4 deletions scripts/cc-cli/src/commands/unbond.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function unbondAction(options: OptionValues) {
const interactive = setInteractivity(options);

const amount = parseAmountOrExit(
requiredInput(options.amount, "Failed to unbond: Must specify an amount")
requiredInput(options.amount, "Failed to unbond: Must specify an amount"),
);

// Build account
Expand All @@ -35,7 +35,7 @@ async function unbondAction(options: OptionValues) {
const controllerStatus = await getValidatorStatus(controller.address, api);
if (!controllerStatus.stash) {
console.error(
`Cannot unbond, ${controller.address} is not a controller account`
`Cannot unbond, ${controller.address} is not a controller account`,
);
process.exit(1);
}
Expand All @@ -59,12 +59,12 @@ async function checkIfUnbodingMax(
address: string,
unbondAmount: BN,
api: ApiPromise,
interactive: boolean
interactive: boolean,
) {
const balance = await getBalance(address, api);
if (balance.bonded.lt(unbondAmount)) {
console.error(
"Warning: amount specified exceeds total bonded funds, will unbond all funds"
"Warning: amount specified exceeds total bonded funds, will unbond all funds",
);
await promptContinue(interactive);
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/cc-cli/src/commands/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export function makeValidateCommand() {
cmd.description("Signal intention to validate from a Controller account");
cmd.option(
"--commission [commission]",
"Specify commission for validator in percent"
"Specify commission for validator in percent",
);
cmd.option(
"--blocked",
"Specify if validator is blocked for new nominations"
"Specify if validator is blocked for new nominations",
);
cmd.action(validateAction);
return cmd;
Expand All @@ -32,7 +32,7 @@ async function validateAction(options: OptionValues) {

// Default commission is 0%
const commission = parsePercentAsPerbillOrExit(
inputOrDefault(options.commission, "0")
inputOrDefault(options.commission, "0"),
);

const blocked = parseBoolean(options.blocked);
Expand Down
6 changes: 3 additions & 3 deletions scripts/cc-cli/src/commands/withdrawUnbonded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function withdrawUnbondedAction(options: OptionValues) {

if (!controllerStatus.stash) {
console.error(
`Could not find stash account associated with the provided controller address: ${controller.address}. Please ensure the address is actually a controller.`
`Could not find stash account associated with the provided controller address: ${controller.address}. Please ensure the address is actually a controller.`,
);
process.exit(1);
}
Expand All @@ -36,11 +36,11 @@ async function withdrawUnbondedAction(options: OptionValues) {
requireStatus(
status,
"canWithdraw",
"Cannot perform action, there are no unlocked funds to withdraw"
"Cannot perform action, there are no unlocked funds to withdraw",
);

const slashingSpans = await api.query.staking.slashingSpans(
controller.address
controller.address,
);
const slashingSpansCount = slashingSpans.isSome
? slashingSpans.unwrap().lastNonzeroSlash
Expand Down
36 changes: 18 additions & 18 deletions scripts/cc-cli/src/commands/wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ import {
export function makeWizardCommand() {
const cmd = new Command("wizard");
cmd.description(
"Run the validator setup wizard. Only requires funded stash and controller accounts."
"Run the validator setup wizard. Only requires funded stash and controller accounts.",
);
cmd.option(
"-r, --reward-destination [reward-destination]",
"Specify reward destination account to use for new account"
"Specify reward destination account to use for new account",
);
cmd.option("-a, --amount [amount]", "Amount to bond");
cmd.option("--commission [commission]", "Specify commission for validator");
cmd.option(
"--blocked",
"Specify if validator is blocked for new nominations"
"Specify if validator is blocked for new nominations",
);
cmd.action(async (options: OptionValues) => {
console.log("🧙 Running staking wizard...");
Expand Down Expand Up @@ -106,20 +106,20 @@ export function makeWizardCommand() {
checkControllerBalance(
controllerAddress,
controllerBalance,
grosslyEstimatedFee
grosslyEstimatedFee,
);
}

const bondExtra: boolean = checkIfAlreadyBonded(stashBalance);

if (bondExtra) {
console.log(
"⚠️ Warning: Stash account already bonded. This will increase the amount bonded."
"⚠️ Warning: Stash account already bonded. This will increase the amount bonded.",
);
if (
await promptContinueOrSkip(
`Continue or skip bonding extra funds?`,
interactive
interactive,
)
) {
checkStashBalance(stashAddress, stashBalance, amount);
Expand All @@ -131,7 +131,7 @@ export function makeWizardCommand() {
amount,
rewardDestination,
api,
bondExtra
bondExtra,
);
console.log(bondTxResult.info);
if (bondTxResult.status === TxStatus.failed) {
Expand All @@ -147,7 +147,7 @@ export function makeWizardCommand() {
controllerAddress,
amount,
rewardDestination,
api
api,
);
console.log(bondTxResult.info);
if (bondTxResult.status === TxStatus.failed) {
Expand Down Expand Up @@ -192,17 +192,17 @@ export function makeWizardCommand() {
function checkControllerBalance(
address: string,
balance: AccountBalance,
amount: BN
amount: BN,
) {
if (balance.transferable.lt(amount)) {
console.log(
"Controller account does not have enough funds to pay transaction fees"
"Controller account does not have enough funds to pay transaction fees",
);
printBalance(balance);
console.log(
`Please send at least ${toCTCString(
amount
)} to controller address ${address} and try again.`
amount,
)} to controller address ${address} and try again.`,
);
process.exit(1);
}
Expand All @@ -211,11 +211,11 @@ function checkControllerBalance(
function checkStashBalance(
address: string,
balance: AccountBalance,
amount: BN
amount: BN,
) {
if (balance.transferable.lt(amount)) {
console.log(
`Stash account does not have enough funds to bond ${toCTCString(amount)}`
`Stash account does not have enough funds to bond ${toCTCString(amount)}`,
);
printBalance(balance);
console.log(`Please send funds to stash address ${address} and try again.`);
Expand All @@ -237,8 +237,8 @@ function parseOptions(options: OptionValues) {
const amount = parseAmountOrExit(
requiredInput(
options.amount,
"Failed to setup wizard: Bond amount required"
)
"Failed to setup wizard: Bond amount required",
),
);
if (amount.lt(new BN(1).mul(MICROUNITS_PER_CTC))) {
console.log("Failed to setup wizard: Bond amount must be at least 1 CTC");
Expand All @@ -250,11 +250,11 @@ function parseOptions(options: OptionValues) {
"Staked",
"Stash",
"Controller",
])
]),
);

const commission = parsePercentAsPerbillOrExit(
inputOrDefault(options.commission, "0")
inputOrDefault(options.commission, "0"),
);

const blocked = parseBoolean(options.blocked);
Expand Down
2 changes: 1 addition & 1 deletion scripts/cc-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ program.commands.forEach((cmd) => {
cmd.option(
"-u, --url [url]",
"URL for the Substrate node",
"ws://localhost:9944"
"ws://localhost:9944",
);
});

Expand Down
Loading

0 comments on commit 198e6d0

Please sign in to comment.