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

Incorrect usage of "call" instead of "read" in Reading Data from a Smart Contract Example #372

Open
abregand opened this issue Nov 20, 2024 · 0 comments
Labels

Comments

@abregand
Copy link

Example incorrectly uses the call method instead of read to fetch data from the contract. Link to docs

Here is the incorrect snippet from the example:

const result = await contract.call('balanceOf', args);
const balance = U256.fromBytes(result);

Correct Approach:

const result = await contract.read('balanceOf', args);
const balance = U256.fromBytes(result.value);
@damip damip added the p3 label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants