-
Notifications
You must be signed in to change notification settings - Fork 0
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
all Uint8Array output in base64 #163
Conversation
if (typeof rawConfig !== 'string') return rawConfig | ||
if (!rawConfig.startsWith('0x')) return rawConfig | ||
|
||
const hex = rawConfig.slice(2) | ||
const utf8 = Buffer.from(hex, 'hex').toString() | ||
const output = JSON.parse(utf8) | ||
Object.keys(output).forEach(key => { | ||
output[key] = output[key].map(base64toHex) | ||
}) | ||
|
||
return output | ||
} | ||
|
||
function base64toHex (base64: string): string { | ||
return Buffer.from(base64, 'base64').toString('hex') | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new feature.
NOTE: the program_config
by default stores the addresses as base64
, y'all asked for hex
to make comparisons easier, so I've added that
@@ -14,7 +20,7 @@ export function replacer (key, value) { | |||
} | |||
|
|||
export function print (...args) { | |||
console.log(...args) | |||
console.log(...args.map(arg => stringify(arg))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the core change
by default, print
now converts UInt8Array
=> base64
so that output is not spammed with walls of Ints
@mixmix fix conflict then bump Frankie |
@frankiebee ready for a review. This PR changed a little over time cos of other PRs 🤷 |
@rh0delta can you final review this |
Addresses: #162 - all Uint8Array output should be in base64