crypto-dappy
crypto-dappy copied to clipboard
【mission-2】Error Type mismatch
Describe the bug Error Type mismatch occured in mission-2. it's LIST_DAPPY_TEMPLATE script.
To Reproduce Steps to reproduce the behavior:
- add this scripts to
list-dappy-templates.script.js
export const LIST_DAPPY_TEMPLATE = `
import DappyContract from 0xDappy
pub fun main(): { UInt32: DappyContract.Template } {
return DappyContract.listTemplates()
}
`;
- execute a command
sh run.sh
- Go to dappies page.
- error occured
Expected behavior console
{
"code": 400,
"message": "Invalid Flow argument: failed to execute the script on the execution node execution-5f6c73a22445d7d958c6a37c1f3be99c72cacd39894a3e46d6647a9adb007b4d@execution-001.devnet38.nodes.onflow.org:3569=100: rpc error: code = InvalidArgument desc = failed to execute script: failed to execute script at block (39e392a18fe68ade2fc4a1a4461f48472bd0c0a36c1e3bd71ea78f0927b0bb4c): [Error Code: 1101] error caused by: [Error Code: 1101] cadence runtime error: Execution failed:\nerror: mismatched types\n --\u003e db3d539e48a805b7.DappyContract:225:21\n |\n225 | let familyRef = \u0026self.families[familyID] as! \u0026Family\n | ^^^^^^^^^^^^^^^^^^^^^^^ expected `DappyContract.Family`, got `DappyContract.Family?`\n\nerror: mismatched types\n --\u003e db3d539e48a805b7.DappyContract:240:21\n |\n240 | let familyRef = \u0026self.families[familyID] as! \u0026Family\n | ... find type in this scope: `DappyContract`\n --\u003e 89f4de94e0a12e080f0d2facf1e3ff0213e4dc5001a93b5f94b2ec3454194088:4:30\n |\n4 | pub fun main(): { UInt32: DappyContract.Template } {\n | ^^^^^^^^^^^^^ not found in this scope\n\nerror: cannot find variable in this scope: `DappyContract`\n --\u003e 89f4de94e0a12e080f0d2facf1e3ff0213e4dc5001a93b5f94b2ec3454194088:5:15\n |\n5 | return DappyContract.listTemplates()\n | ^^^^^^^^^^^^^ not found in this scope\n"
}
Screenshots
Desktop (please complete the following information):
- OS: Mac OS (M1)
- Browser chrome
- Version 107.0.5304.87
My confif.js
file is here
import { config } from "@onflow/fcl";
config({
"accessNode.api": process.env.REACT_APP_ACCESS_NODE,
"discovery.wallet": process.env.REACT_APP_WALLET_DISCOVERY,
"0xDappy": process.env.REACT_APP_DAPPY_CONTRACT,
});