diff --git a/packages-ts/starknet-gauntlet-oz/src/commands/account/deploy.ts b/packages-ts/starknet-gauntlet-oz/src/commands/account/deploy.ts index 662764667..d650c0a46 100644 --- a/packages-ts/starknet-gauntlet-oz/src/commands/account/deploy.ts +++ b/packages-ts/starknet-gauntlet-oz/src/commands/account/deploy.ts @@ -25,7 +25,7 @@ const makeUserInput = async (flags, _, env): Promise => { const keypair = ec.starkCurve.utils.randomPrivateKey() const generatedPK = '0x' + Buffer.from(keypair).toString('hex') const pubkey = flags.publicKey || env.publicKey || ec.starkCurve.getStarkKey(keypair) - const salt: number = flags.salt ? +flags.salt : undefined + const salt: number = !isNaN(flags.salt) ? +flags.salt : undefined return { publicKey: pubkey, privateKey: (!flags.publicKey || !env.account) && generatedPK, @@ -64,7 +64,7 @@ const beforeExecute: BeforeExecute = ( ) => async () => { deps.logger.info(`About to deploy an OZ 0.x Account Contract with: public key: ${input.contract[0]} - salt: ${input.user.salt || 'randomly generated'} + salt: ${!isNaN(input.user.salt) ? input.user.salt : 'randomly generated'} action: ${context.action}`) if (input.user.privateKey) { await deps.prompt(`The generated private key will be shown next, continue?`) diff --git a/packages-ts/starknet-gauntlet/src/provider/index.ts b/packages-ts/starknet-gauntlet/src/provider/index.ts index b895ed1de..ddb2a965d 100644 --- a/packages-ts/starknet-gauntlet/src/provider/index.ts +++ b/packages-ts/starknet-gauntlet/src/provider/index.ts @@ -128,7 +128,7 @@ class Provider implements IStarknetProvider { const tx = await this.account.declareAndDeploy({ contract, compiledClassHash, - salt: salt ? '0x' + salt.toString(16) : salt, // convert number to hex or leave undefined + salt: !isNaN(salt) ? '0x' + salt.toString(16) : salt, // convert number to hex or leave undefined // unique: false, ...(!!input && input.length > 0 && { constructorCalldata: input }), }) @@ -162,7 +162,7 @@ class Provider implements IStarknetProvider { deployContract = async (classHash: string, input: any = [], wait = true, salt = undefined) => { const tx = await this.account.deployContract({ classHash: classHash, - salt: salt ? '0x' + salt.toString(16) : salt, + salt: !isNaN(salt) ? '0x' + salt.toString(16) : salt, ...(!!input && input.length > 0 && { constructorCalldata: input }), }) const response = wrapResponse(this, tx)