I am trying to interact with a simple solidity contract using MetaMask. I can run truffle migrate and run the front-end with no trouble but when I try to interact I get the error:
Unhandled Rejection (Error): This contract object doesn't have address set yet, please set an address first.
I was told I need to change my network as the issue relates to chain id or network id with Ganache. I've tried changing the network ID in Ganache and setting up the network in MetaMask, but then I can't migrate my contracts in truffle anymore error message:
Error: The network id specified in the truffle config (5777) does not match the one returned by the network (1337). Ensure that both the network and the provider are properly configured.
I tried then to add some configuration settings in the truffle-config file, including specifying the correct network and creating a new network and specifying it when migrating, but also no luck.
Another potential solution I have found was to run ganache-cli with specific network and chain Id, which I have tried however I don't know how to migrate my contracts to that network.
When I run truffle migrate it looks for 5777 every time but I need it to deploy to 1337. No idea how to change it. This is all very new to me so I hope it is something simple that I don't understand yet.
Any advice would be great, thanks