The command in the question above uses the JSON-Cadence object specified in the docs:
https://docs.onflow.org/cadence/json-cadence-spec/#type
Currently (2022/3/31) the docs are incorrect, as indicated by this issue here:
https://github.com/onflow/cadence/issues/1511
The solution is to include an key/value in the JSON object, as demonstrated by the above issue:
{ "type" : "Type", "value" : { "staticType" : { "kind" : "Int" } } }
Notice the addition of { "kind": "Int" }
If you need to pass in more complex types to the Flow CLI, then refer to this link, where the resource type is highlighted:
https://github.com/onflow/cadence/blob/314f5fa8a5da8c452d23a42148a1d7927915d613/encoding/json/encoding_test.go#L1180-L1193
You will see that passing in more complex types to Flow CLI quickly becomes protracted and error prone for anything but the simplest types. There is currently no simple solution for passing in complex types to Flow CLI.
If your script/tx can accommodate values hardcoded in the body, then there is a solution.
Assuming you have a contract that has a resource called NFT
, and the contract is called MyNFT
, and MyNFT
has been deployed to 0x1234567890
on Testnet, then:
import MyNFT from 0x1234567890
pub fun main(): Type {
let type = Type<@MyNFT.NFT>()
return type
}