Near 协议 FunctionCallError(MethodResolveError(MethodNotFound))
Posted
技术标签:
【中文标题】Near 协议 FunctionCallError(MethodResolveError(MethodNotFound))【英文标题】:Near Protocol FunctionCallError(MethodResolveError(MethodNotFound)) 【发布时间】:2021-11-20 20:44:30 【问题描述】:我是区块链、智能合约和近乎协议的新手。我正在尝试向 https://near.academy/ 学习。 testnet 上有一个示例合约:museum.testnet。
我使用的是 windows 并安装了 wsl2。
我可以登录
near login
命令。但在那之后,当我调用near view museum.testnet getmemecount
命令时,它给了我下面的错误。谁能帮我解决这个问题?
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
【问题讨论】:
【参考方案1】:方法名称是get_meme_count
,而不是getmemecount
。见博物馆源代码here。
$ near view museum.testnet get_meme_count
View call: museum.testnet.get_meme_count()
67
附近学院的某些部分是否将其称为getmemecount
?
【讨论】:
非常感谢。 1天后我在交易中意识到了这一点。是的,学院文件说:,4。现在合同名称是“museum.testnet”,方法称为getmemecount。所以输入:near view museum.testnet getmemecount。这将返回您在博物馆中注册的模因数量。 5. 恭喜。你刚刚在 NEAR 上调用了一个合约。 near.academy/near101/chapter-4以上是关于Near 协议 FunctionCallError(MethodResolveError(MethodNotFound))的主要内容,如果未能解决你的问题,请参考以下文章