-
Notifications
You must be signed in to change notification settings - Fork 193
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
automatically convert ASCII salt to hex #3257
base: main
Are you sure you want to change the base?
Conversation
|
Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env' | ||
in your contracts directory to use the default anvil private key.`, | ||
Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env' | ||
in your contracts directory to use the default anvil private key.`, |
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.
let's not change the formatting here
// We expect the worlds file to be committed and since local deployments are often | ||
// a consistent address but different block number, we'll ignore the block number. |
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.
let's keep all these comments
function encodeToHex(str: string): Hex { | ||
return ("0x" + Buffer.from(str, "utf8").toString("hex")) as 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.
there is a util from viem
we can use instead: https://viem.sh/docs/utilities/toHex.html
const automine = await enableAutomine(client); | ||
|
||
const startTime = Date.now(); | ||
const worldDeploy = await deploy({ | ||
config, | ||
deployerAddress: opts.deployerAddress as Hex | undefined, | ||
salt, | ||
salt, // Use the new salt variable here |
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.
no need to add a comment here
let salt: `0x${string}` | undefined = opts.salt as `0x${string}` | undefined; | ||
|
||
if (salt != null) { | ||
if (!isHex(salt)) { | ||
salt = encodeToHex(salt) as `0x${string}`; | ||
} |
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.
we can simplify this to const salt = opts.salt && !isHex(opts.salt) ? toHex(opts.salt) : opts.salt;
/** | ||
* Given some CLI arguments, finds and resolves a MUD config, foundry profile, and runs a deploy. | ||
* This is used by the deploy, test, and dev-contracts CLI commands. | ||
*/ |
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.
why were these comments removed?
@AyushSagar99 just checking if you plan to finish up this PR or not! |
@holic yes i would finish but i am encountering some problem and want to ask some questions is their a way we can connect |
we're always on discord in the #mud-help channel: https://lattice.xyz/discord |
No description provided.