janezpodhostnik / flow-py-sdk

Unofficial flow blockchain python sdk
MIT License
35 stars 26 forks source link

how to Import the type `*.cdc` from a local file #45

Closed youxiawar closed 2 years ago

youxiawar commented 2 years ago

code:

setup_account_tx_code = ''' import NonFungibleToken from "/contracts/NonFungibleToken.cdc" import Ezy3dItems from "/contracts/Ezy3dItems.cdc"

transaction { prepare(signer: AuthAccount) { if signer.borrow<&Ezy3dItems.Collection>(from: Ezy3dItems.CollectionStoragePath) == nil {

        let collection <- Ezy3dItems.createEmptyCollection()

        signer.save(<-collection, to: Ezy3dItems.CollectionStoragePath)
 ...

'''

error info:

[Error Code: 1101] cadence runtime error Execution failed: error: [Error Code: 1054] location (/contracts/NonFungibleToken.cdc) is not a valid location: expecting an AddressLocation, but other location types are passed --> /contracts/NonFungibleToken.cdc

error: [Error Code: 1054] location (/contracts/Ezy3dItems.cdc) is not a valid location: expecting an AddressLocation, but other location types are passed --> /contracts/Ezy3dItems.cdc

youxiawar commented 2 years ago

我把引用的合约先部署到账户里面,然后从账户再引用