Formatting
This commit is contained in:
@@ -12,7 +12,7 @@ import { resolveTemplate } from "../utils.js";
|
||||
*/
|
||||
export const printReceiveHelp = (io: CommandIO): void => {
|
||||
io.out(
|
||||
`
|
||||
`
|
||||
${bold("Usage:")} xo-cli receive <template-file> <output-identifier> [role-identifier]
|
||||
|
||||
${bold("Description:")}
|
||||
@@ -25,7 +25,8 @@ ${bold("Arguments:")}
|
||||
|
||||
${bold("Options:")}
|
||||
-h --help ${dim("Show this help message")}
|
||||
`);
|
||||
`,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -47,12 +48,17 @@ export const handleReceiveCommand = async (
|
||||
const outputIdentifier = args[1];
|
||||
const roleIdentifier = args[2];
|
||||
|
||||
deps.io.verbose(`Receive args - template: ${templateQuery}, output: ${outputIdentifier}, role: ${roleIdentifier}`);
|
||||
deps.io.verbose(
|
||||
`Receive args - template: ${templateQuery}, output: ${outputIdentifier}, role: ${roleIdentifier}`,
|
||||
);
|
||||
|
||||
if (!templateQuery || !outputIdentifier) {
|
||||
deps.io.verbose("Missing required arguments");
|
||||
printReceiveHelp(deps.io);
|
||||
throw new CommandError("receive.arguments.missing", "Missing required arguments");
|
||||
throw new CommandError(
|
||||
"receive.arguments.missing",
|
||||
"Missing required arguments",
|
||||
);
|
||||
}
|
||||
|
||||
// Resolve and read the template file
|
||||
@@ -69,11 +75,17 @@ export const handleReceiveCommand = async (
|
||||
deps.io.verbose(`Locking bytecode hex: ${lockingBytecodeHex}`);
|
||||
|
||||
// Convert the locking bytecode to a BCH cash address
|
||||
const result = lockingBytecodeToCashAddress({ bytecode: hexToBin(lockingBytecodeHex), prefix: 'bitcoincash' });
|
||||
const result = lockingBytecodeToCashAddress({
|
||||
bytecode: hexToBin(lockingBytecodeHex),
|
||||
prefix: "bitcoincash",
|
||||
});
|
||||
|
||||
if (typeof result === 'string') {
|
||||
if (typeof result === "string") {
|
||||
deps.io.err(`Failed to encode address: ${result}`);
|
||||
throw new CommandError("receive.address.encode_failed", `Failed to encode address: ${result}`);
|
||||
throw new CommandError(
|
||||
"receive.address.encode_failed",
|
||||
`Failed to encode address: ${result}`,
|
||||
);
|
||||
}
|
||||
|
||||
deps.io.out(result.address);
|
||||
|
||||
Reference in New Issue
Block a user