Skip to content

abstract testnet call mainnet rpc when executes eth_call #6426

@howdyfrom2019

Description

@howdyfrom2019

Hi there.
I'm trying to sendTransaction method using thirdweb and AGW in abstract testnet.
But i find out the fact that chainId mismatch error occurs when after I connect AGW wallet with thirdweb, and send transaction to contract.

Issue description

After connecting agw in abstract testnet with thirdweb auth, I'm trying the interaction with thirdweb contract. but I faced chainid is mismatch in agw typed signature error through viem BaseError.

Suspected Cause

Through chrome developer tools inspection, I founded the rpc of eth_call method is api.mainnet.abs.xyz, even though I connected with abstractTestnet. like below:

cURL for `eth_call`
curl 'https://api.mainnet.abs.xyz/' \
  -H 'accept: */*' \
  -H 'accept-language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7' \
  -H 'content-type: application/json' \
  -H 'origin: http://localhost:3000' \
  -H 'priority: u=1, i' \
  -H 'referer: http://localhost:3000/' \
  -H 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: cross-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
  --data-raw '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"data":"0x7603cc8627c052c995b045cda1fc166ae8b37f64ce54cf250193db7205548917ea2feb7e","to":"0x9B947df68D35281C972511B3E7BC875926f26C1A"},"latest"]}'

Steps to reproduce

  1. Set up wallet connection through agw with thirdweb (related reference: Making signature has an issue when using abstract wallet #6357)
  2. Send transaction with smart contract.
  3. Check the chainId error occurs or not.

Code Snippet

import {
  type Chain,
  getContract,
  sendTransaction,
  ThirdwebContract,
  waitForReceipt,
} from 'thirdweb';
import { abstractTestnet } from 'thirdweb/chains';
import { claimTo } from 'thirdweb/extensions/erc721';

interface Params {
  contractAddress: `0x${string}`;
  supportedChain?: Chain;
}
export default function useNFTClaim({ contracrtAddress, supportedChain }: Params) {
  const account = useActiveAccount();

  const contract: ThirdwebContract = getContract({
    client,
    address: contractAddress,
    chain: abstractTestnet,
  });


const claimNFT = async (count = 1n) => {
    try {
      const transaction = claimTo({
        contract,
        to: account?.address!,
        quantity: count,
      });

      const { transactionHash } = await sendTransaction({ // < error occurs in here
        transaction,
        account: account!,
      });

      const recipt = await waitForReceipt({
        client,
        chain: supportedChain,
        transactionHash: transactionHash,
      });

      return recipt.transactionHash;
    } catch (e) {
     console.log(e);
    }
  };

  return { claimNFT };
}

Environment

  • Node.js version: v22.12.0
  • package
"@abstract-foundation/agw-client": "^1.4.2",
"@abstract-foundation/agw-react": "^1.5.4",
"viem": "^2.23.5",
"wagmi": "^2.14.12",
"thirdweb": "^5.88.7",

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions