Mappings do not store their keys, only the value which is stored at the state memory address. To get the list of data use an array.
address[] public addresses;
now define a function to get the length of this array:
function getAddressCount() public view returns(uint){
return addresses.length;
}
Also define a function to get the element by index:
function getAddressByIndex(uint index) public view returns(address){
return addresses[index]
}
now u need to write code to pull the get the array one by oen. This is how it is done in javascript with web3
library:
let addresses,addressCount;
try {
addressesCount = await ContractName.methods.getCampaignCounts().call();
addresses = await Promise.all(
Array(parseInt(addressesCount))
.fill()
.map((element, index) => {
return ContractName.methods.getAddressByIndex(index).call();
})
);
} catch (e) {
console.log("error in pulling array list", e);
}