crypto-dappy icon indicating copy to clipboard operation
crypto-dappy copied to clipboard

【mission-2】Error Type mismatch

Open mashharuki opened this issue 2 years ago • 1 comments

Describe the bug Error Type mismatch occured in mission-2. it's LIST_DAPPY_TEMPLATE script.

To Reproduce Steps to reproduce the behavior:

  1. 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()
    }
`;
  1. execute a command sh run.sh
  2. Go to dappies page.
  3. 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 スクリーンショット 2022-11-09 22 54 24

Desktop (please complete the following information):

  • OS: Mac OS (M1)
  • Browser chrome
  • Version 107.0.5304.87

mashharuki avatar Nov 09 '22 13:11 mashharuki

My confif.jsfile 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,
});

mashharuki avatar Nov 09 '22 13:11 mashharuki