Hi everyone,
I deployed this token on binance smart chain testnet. I’m trying to call changeAdmin function of this contract using etherjs but getting an error.
the command that I execute
yarn hardhat run --network testnet scripts/bypass.js
hardhat.config.js
.....testnet: {
url: "https://data-seed-prebsc-1-s1.binance.org:8545",
chainId: 97,
gasPrice: 20000000000,
},......
the script
const ethers = require(‘ethers’)
async function main() {
let network = ‘https://data-seed-prebsc-1-s1.binance.org:8545/’
let provider = ethers.getDefaultProvider(network)let privKey = PRIVATE_KEY_OF_THE_CREATOR_OF_THE_CONTRACT let wallet = new ethers.Wallet(privKey, provider) let contractAddr = ADDRESS_OF_THE_CONTRACT let contractABI = ABI_OF_THE_CONTRACT let contract = new ethers.Contract(contractAddr, contractABI, wallet) let newOwnerAddr = "0xCc2c513ef320db14f......" let txResponse= await contract.methods.changeAdmin(newOwnerAddr) let txReceipt = await txResponse.wait() console.log(txReceipt)
}
main()
.catch((error) => {
console.error(error)
process.exit(1)
})
the error i encountered
TypeError: Cannot read properties of undefined (reading ‘changeAdmin’)
Thanks in advance, have a nice day