Near Protocol FunctionCallError(MethodResolveError(MethodNotFound))
Asked Answered
E

1

5

I'm new in blockchain, smart contract and near protocol. I'm trying to learn from https://near.academy/ . There's a sample contract on testnet : museum.testnet.

I'm using windows and i installed wsl2.

I can login with near login command. But after that, when i called near view museum.testnet getmemecount command its giving me error below. Can anyone help me on this?

View call: museum.testnet.getmemecount()
An error occured
Error: Querying [object Object] failed: wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound)).
{
  "block_hash": "SZv8UsCeNXLkhjPa9KeZY6xJXmKNb6MLyKXqHVddiT5",
  "block_height": 65109663,
  "error": "wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound))",
  "logs": []
}

    at JsonRpcProvider.query (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:116:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Account.viewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:351:24)
    at async exports.callViewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/index.js:75:48)
    at async Object.handler (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/utils/exit-on-error.js:52:9)
TypedError: Querying [object Object] failed: wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound)).
{
  "block_hash": "SZv8UsCeNXLkhjPa9KeZY6xJXmKNb6MLyKXqHVddiT5",
  "block_height": 65109663,
  "error": "wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound))",
  "logs": []
}
    at JsonRpcProvider.query (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:116:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Account.viewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:351:24)
    at async exports.callViewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/index.js:75:48)
    at async Object.handler (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/utils/exit-on-error.js:52:9) {
  type: 'UntypedError',
  context: undefined
}
Erethism answered 28/9, 2021 at 20:13 Comment(0)
R
6

The method name is get_meme_count, not getmemecount. See the source code of the museum here.

$ near view museum.testnet get_meme_count
View call: museum.testnet.get_meme_count()
67

Does some part of near academy mention it as getmemecount?

Ricoriki answered 28/9, 2021 at 21:8 Comment(1)
Thanks very much. I realized this in transaction after 1 day. And yes academy document says : , 4. Now the contract name is "museum.testnet" and the method is called getmemecount. So type: near view museum.testnet getmemecount. This will return you the amount of memes that are registered in the museum. 5. Congratulations. You just called a contract on NEAR. near.academy/near101/chapter-4Moldy

© 2022 - 2024 — McMap. All rights reserved.