Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: padded printing for e2e-cli #2106

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions yarn-project/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command {
publicKey = await generatePublicKey(key);
} else {
const key = GrumpkinScalar.random();
privKey = key.toString();
privKey = key.toString(true);
publicKey = await generatePublicKey(key);
}
log(`\nPrivate Key: ${privKey}\nPublic Key: ${publicKey.toString()}\n`);
Expand Down Expand Up @@ -144,7 +144,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command {
log(`\nCreated new account:\n`);
log(`Address: ${address.toString()}`);
log(`Public key: ${publicKey.toString()}`);
if (!options.privateKey) log(`Private key: ${privateKey.toString()}`);
if (!options.privateKey) log(`Private key: ${privateKey.toString(true)}`);
log(`Partial address: ${partialAddress.toString()}`);
});

Expand Down
5 changes: 3 additions & 2 deletions yarn-project/foundation/src/fields/grumpkin_scalar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ export class GrumpkinScalar {
* The resulting string is prefixed with '0x' and contains the exact number of hex characters required
* to represent the numeric value of this instance.
*
* @param padTo32 - Whether to pad the resulting string to 32 bytes.
* @returns A hexadecimal string representing the GrumpkinScalar value.
*/
toString() {
return toHex(this.value);
toString(padTo32 = false) {
return toHex(this.value, padTo32);
}

/**
Expand Down