Setting nonce upon deployment in Hardhat

I created an ERC1155 with Hardhat v2.15 and deployed it to the mainnet. However, it got stuck in mempool due to very low gas price. I didn't notice I set it to 35 gwei when the network gas price was about ~200 gwei.

Now I want to set the same nonce and re-deploy the contract with a higher gas price. I couldn't find a way to set the nonce upon deployment though, unlike sending transactions via web3js where I can just add { nonce: 123 }.

Here is my current deploy.ts

import { ethers, network } from "hardhat";
import * as dotenv from "dotenv";
dotenv.config({ path: __dirname+'/.env' });

// Types
import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";

async function main() {
  // Provider
  const provider = ethers.provider;

  let deployer: any;
  let ownerAddress: string;

  // Wallets & addresses
  if ( === "localhost") {
    let owner: HardhatEthersSigner;
    [deployer, owner] = await ethers.getSigners();
    ownerAddress = owner.address;
  } else {
    deployer = new ethers.Wallet(process.env.PRIVATE_KEY || "private-key", provider);
    ownerAddress = process.env.OWNER_ADDRESS || "owner-address";

  console.log("Network name: ",;
  console.log("Deployer: ", deployer.address);
  console.log("Deployer balance: ", (await provider.getBalance(deployer)).toString());
  console.log("Nonce (latest): ", await provider.getTransactionCount(deployer, 'latest'));
  console.log("Nonce (pending): ", await provider.getTransactionCount(deployer, 'pending'));
  // Deploy contract
  const token = await ethers.deployContract("Token", ['some-args']);
  await tokenizedBond.waitForDeployment(); // Something I can add here to set nonce?

  console.log("Deployed at ",;

main().catch((error) => {
  process.exitCode = 1;

I'm thinking of using web3js instead, but I wouldn't be able to verify the contract easily...

Try this instead:

const factory = new ethers.ContractFactory(TokenContractABI, TokenContractByteCode);
const contract = await factory.deploy(arg1, arg2, arg3, {nonce: some_nonce});

Since your contract takes construction input arguments, the ABI that you create the factory with, must include the constructor, for example:

const TokenContractABI = [
    "inputs": [
        "internalType": "string",
        "name": "name_",
        "type": "string"
        "internalType": "string",
        "name": "symbol_",
        "type": "string"
    "stateMutability": "nonpayable",
    "type": "constructor"
    "inputs": [],
    "name": "decimals",
    "outputs": [
        "internalType": "uint8",
        "name": "",
        "type": "uint8"
    "stateMutability": "view",
    "type": "function"

See ethers.js official documentation for more info.