Error: not supported blockchain eth_sepolia

Hello i try to interact with a smart contract already deployed on sepolia. But i’m facing the issue “not supported blockchain eth_sepolia” with my config

 Web3AuthOptions options = Web3AuthOptions(
        clientId: clientId,
        // network: Network.sapphire_mainnet,
        network: Network.sapphire_devnet,
        redirectUrl: redirectUrl,
        // 259200 allows user to stay authenticated for 3 days with Web3Auth.
        // Default is 86400, which is 1 day.
        sessionTime: 259200,
      );
  Future<void> readFromContract() async {
    try {
      final client = Web3Client("https://rpc.ankr.com/eth_sepolia ", Client());

      final contract = DeployedContract(
          // ContractAbi.fromJson(jsonEncode(simpleStorageAbi), ''),
          ContractAbi.fromJson(simpleStorageAbi, ''),
          EthereumAddress.fromHex(
              "0x1EA80a5CFB09aC48a12962376769355D72E30792"));

      final messageFunction = contract.function('get');

      var message = await client
          .call(contract: contract, function: messageFunction, params: []);

      log("Contract Read Message, $message");
    } catch (e) {
    }
  }

Is it still possible to interact with deployed contract on sepolia ?
If it’s not possible anymore, where do i have to deploy my contract to use sapphire_devnet ? I cannot deploy it on the mainnet

When asking for help in this category, please make sure to provide the following details:

Thanks

hi @scottealexandre

Thank you for bringing this issue to our attention. I will contact our team of Flutter specialists to address and resolve the problem promptly.

Thank you for your patience.

Hey @scottealexandre, you can definitely interact with contracts deployed on Ethereum Sepolia. Sapphire Mainnet is the Web3Auth network used to manage the shares of the key.

Can you share the github repo if possible? If not possible, can you share the simpleStorageAbi?

Hello everyone and thanks for your answers

I cannot share the entire repo, so here is the abi of the simple storage contract
I stored it in the a constant like that:

const simpleStorageAbi = """[
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_initialOwner",
          "type": "address"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "constructor"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "owner",
          "type": "address"
        }
      ],
      "name": "OwnableInvalidOwner",
      "type": "error"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "OwnableUnauthorizedAccount",
      "type": "error"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "previousOwner",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "newOwner",
          "type": "address"
        }
      ],
      "name": "OwnershipTransferred",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "oldValue",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "newValue",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "who",
          "type": "address"
        }
      ],
      "name": "valueChanged",
      "type": "event"
    },
    {
      "inputs": [],
      "name": "get",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "owner",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "renounceOwnership",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "value",
          "type": "uint256"
        }
      ],
      "name": "set",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "newOwner",
          "type": "address"
        }
      ],
      "name": "transferOwnership",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }
  ]""";

It’s deployed here: https://sepolia.etherscan.io/address/0x1ea80a5cfb09ac48a12962376769355d72e30792

the contract loading seems to work, but it crashes on client.call

Haha, it’s just a silly tpyo, your code works fine. I just realized there’s extra space at the end of RPC Url you are using to create Web3Client.
Current

Web3Client("https://rpc.ankr.com/eth_sepolia ", Client())

Fix

Web3Client("https://rpc.ankr.com/eth_sepolia", Client())

If you will remove extra space, it’ll work fine.

Damn sorry for this stupid error it works perfectly now thank you!

I take this opportunity to ask a question, from what you told me previously the Network.sapphire_devnet is used just for authentication,
But who determines which chain I am on. In my example here, who determines the chain where to find the contract? Because I never specified it except with the RPC
Thanks again

The RPC you used defines the chain you are using. Web3Client can internally use theeth_chainId to get the chain id which is used to determine the chain.

Thank you for the informations :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.