Environment
I am using mainnet because I already tested it though Goerli with same setup
Details
I given Minter role to relay so that I am able to call withdrawAll function using relay package. But while executing it, it is giving me "UNPREDICTABLE_GAS_LIMIT".
Code to reproduce
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
function withdrawAll() public payable onlyRole(MINTER_ROLE) {
payable(address(x)).transfer(address(this).balance);
}
backend:
const credentials = { apiKey: API_KEY, apiSecret: API_SECRET };
const provider = new DefenderRelayProvider(credentials);
const signer = new DefenderRelaySigner(credentials, provider, { speed: 'fast' });
const contract = new ethers.Contract('0x5F581b3F61bE3ee721533bE96fAF8c795236a1f2', contractABI, signer);
const withdraw = await contract.withdraw();
Where Signer is relay address.