Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got problem with mock multiple requests #39

Open
zealgt opened this issue Dec 19, 2024 · 0 comments
Open

I got problem with mock multiple requests #39

zealgt opened this issue Dec 19, 2024 · 0 comments

Comments

@zealgt
Copy link

zealgt commented Dec 19, 2024

From the example code below

const foo = async () => {
  const contract = new ethers.Contract('0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb', abi, provider);
  
  const name = await contract.name()
  const balance = await contract.balanceOf('0x5Af489c8786A018EC4814194dC8048be1007e390')
  
  return { name, balance }
}

I also mock like this, but it only work at first call

mock({
  blockchain: 'ethereum',
  request: {
    to: '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb',
    api,
    method: 'name',
    return: 'DePay',
  },
})

mock({
  blockchain: 'ethereum',
  request: {
    to: '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb',
    api,
    method: 'balanceOf',
    params: '0x5Af489c8786A018EC4814194dC8048be1007e390',
    return: '1000',
  },
})

Is it possible to mock request for two method call with same smart contract address at the same time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant