Whoops! 😨 Something unexpected happened...
[Error Code: 1101] error caused by: 1 error occurred:
* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:
--> 2ace58bcf4fb1382bd775a60536ef6ebf72713711005e24ab9704e3f00ef23e4:45:30
|
45 | let leftCollectionDataMap = Utils.getNFTCollectionData(ownerAddress: signer.address, nftIdentifiers: normalizeNfts(leftUserNfts))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> 15f55a75d7843780.Utils:78:8
|
78 | account.forEachPublic(fun (path: PublicPath, type: Type): Bool {
79 |
80 | let capability = account.getCapability<&{NonFungibleToken.CollectionPublic}>(path)
81 |
82 | if (!capability.check()) {
83 |
84 | return true
85 | }
86 |
87 | let collectionPublic = capability.borrow()
88 | if (collectionPublic == nil) {
89 |
90 | return true
91 | }
92 |
93 | let contractType = Utils.getIdentifierContractType(identifier: collectionPublic!.getType().identifier)
94 | let nftIdentifier = contractType.identifier.concat(".NFT")
95 |
96 | var nftId: UInt64? = nil
97 |
98 | for identifier in nftIdentifiers {
99 |
100 | if (!StringUtils.hasPrefix(identifier, nftIdentifier)) {
101 |
102 | continue
103 | }
104 |
105 | normalizedNftIdentifiers.append(nftIdentifier)
106 |
107 | let parts = StringUtils.split(identifier, ".")
108 | if (parts.length == 5) {
109 |
110 | nftId = UInt64.fromString(parts[parts.length - 1])
111 | }
112 |
113 | break
114 | }
115 |
116 | if (!normalizedNftIdentifiers.contains(nftIdentifier) || response.containsKey(nftIdentifier)) {
117 |
118 | return true
119 | }
120 |
121 | if (nftId == nil) {
122 |
123 | let nftIds = collectionPublic!.getIDs()
124 | if (nftIds.length < 1) {
125 |
126 | return true
127 | }
128 |
129 | nftId = nftIds[0]
130 | }
131 |
132 | if (nftId == nil) {
133 |
134 | return true
135 | }
136 |
137 | let nftRef: &{NonFungibleToken.INFT} = collectionPublic!.borrowNFT(id: nftId!) as &{NonFungibleToken.INFT}
138 |
139 | let collectionData = (nftRef.resolveView(Type<MetadataViews.NFTCollectionData>()) as! MetadataViews.NFTCollectionData?) ?? panic("collection lookup failed")
140 |
141 | response.insert(key: nftIdentifier, collectionData)
142 |
143 | return true
144 | })
| ^^
error: pre-condition failed: NFT does not exist in the collection!
--> 1d7e57aa55817448.NonFungibleToken:187:30