Im getting the abi of a smart contract from bscscan like this
let url = bscUrl+moduleUrl+module+actionUrl+action+addressUrl+address+bscApiKey;
async function getJson(url) {
let response = await fetch(url);
let data = await response.json()
return data['result'];
}
async function buyAndSellFee(){
let abi = await getJson(url)
console.log(abi);
const contract = new web3.eth.Contract(abi, address);
console.log(contract);
}
However when I use the abi to create a new contract
const contract = new web3.eth.Contract(abi, address);
console.log(contract);
I keep getting an error saying
Uncaught (in promise) Error: You must provide the json interface of the contract when instantiating a contract object.
How do I fix this?