Unable to call withdrawAll function though Relay

:computer: Environment
I am using mainnet because I already tested it though Goerli with same setup

:memo: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".

:1234: 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.

1 Like

all of the codes seem fine. I guess you need to check more about Relay and how to call it.

I tested many times but still it is giving me "UNPREDICTABLE_GAS_LIMIT" issue, even relay having enough ETH for Gas

1 Like

Please help me on this