Hardhat TypeError: etherWallet.ownerAddress is not a function

Im making a simple ether wallet smart contract. When i try to deploy the contract with deploy script in hardhat, im getting this error. Following is my deploy.js code

const { ethers } = require("hardhat");

async function main() {
  const etherWalletFactory = await ethers.getContractFactory("wallet");
  console.log("Deploying, Please wait...");
  const etherWallet = etherWalletFactory.deploy();
  (await etherWallet).waitForDeployment();
  console.log("Contract Deployed");
  console.log(`Contract address: ${etherWallet.address}`);
  const owner = await etherWallet.ownerAddress();
  const balance = await etherWallet.getBalance();
  console.log(`Current Balance: ${balance}`);

  .then(() => process.exit(0))
  .catch((error) => {

And this is my Solidity code (wallet.sol) :

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract wallet {
    address payable private owner;

    constructor() {
        owner = payable(msg.sender);

    receive() external payable {}

    function ownerAddress() public view returns (address) {
        return owner;

    function getBalance() public view returns (uint) {
        return address(this).balance;

    function sendEth(uint _amount, address payable _recipient) public payable {
        require(_amount < address(this).balance, "Insufficient funds");

    function withdraw(uint _amount) public {
        require(msg.sender == owner, "You are not the owner");

This is the error im getting on running deploy.js

Contract Deployed
Contract address: undefined
TypeError: etherWallet.ownerAddress is not a function
    at main (/home/yash/Codes/ether-wallet/scripts/deploy.js:10:35)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
error Command failed with exit code 1.

Im using yarn hardhat run scripts/deploy.js command to run the script

I tried deleting artifacts and cache files manually and by using yarn hardhat clean command multiple times but im still getting this error.

>Solution :

You can try with this steps:

  • In your deployment script, you’re deploying the contract and then immediately trying to interact with it. However, the deployment is asynchronous, and you need to await the deployment process.
    Change this:
const etherWallet = etherWalletFactory.deploy();


const etherWallet = await etherWalletFactory.deploy();
  • You’re calling (await etherWallet).waitForDeployment();. This is not a standard function for a contract deployment. It’s likely that this function does not exist.

Change this:

(await etherWallet).waitForDeployment();


await etherWallet.deployed();

Leave a Reply