{ "transactions": { "link_views_collections": "import MetadataViews from 0xMetadataViews\n\ntransaction(collectionPublicPath: String, collectionStoragePath: String) {\n    prepare(acct: AuthAccount) {\n        pre {\n            acct.borrow<&AnyResource>(from: StoragePath(identifier: collectionStoragePath)!) != nil: \"No Collection On Provided Storage Path.\"\n        }\n        let publicPath = PublicPath(identifier: collectionPublicPath)!\n        let storagePath = StoragePath(identifier: collectionStoragePath)!\n        if acct.getCapability<&AnyResource{MetadataViews.ResolverCollection}>(publicPath).borrow() == nil {\n            acct.link<&AnyResource{MetadataViews.ResolverCollection}>(publicPath, target: storagePath)\n        }\n    }\n\n    execute {\n    }\n}" }, "scripts": { "check_for_links": "import MetadataViews from 0xMetadataViews\n\n/*\n    Script to check for the implementation of all recommended MetadataViews.\n */\npub fun main(ownerAddress: Address, collectionPublicPath: String): {String: Bool} {\n    let owner = getAccount(ownerAddress)\n    return { \n        \"MetadataViews\": owner.getCapability<&AnyResource{MetadataViews.ResolverCollection}>(PublicPath(identifier: collectionPublicPath)!).check(),\n        \"AnyResource\": owner.getCapability<&AnyResource>(PublicPath(identifier: collectionPublicPath)!).check()\n    }\n}", "check_for_recommended_v1_views": "import MetadataViews from 0xMetadataViews\nimport NFTRetrieval from 0xNFTRetrieval\n\n/*\n    Script to check for the implementation of all recommended MetadataViews.\n */\npub fun main(ownerAddress: Address, collectionPublicPath: PublicPath): {String: Bool} {\n    let owner = getAccount(ownerAddress)\n    let collectionCap = owner.getCapability<&AnyResource{MetadataViews.ResolverCollection}>(collectionPublicPath)\n    assert(collectionCap.check(), message: \"MetadataViews Collection is not set up properly, ensure the Capability was created/linked correctly.\")\n    let collection = collectionCap.borrow()!\n    assert(collection.getIDs().length > 0, message: \"No NFTs exist in this collection, ensure the provided account has at least 1 NFTs.\")\n    let testNftId = collection.getIDs()[0]\n    let nftResolver = collection.borrowViewResolver(id: testNftId)\n    let views: {String: Bool} = {}\n    // Initialize map to all falses for recommended views.\n    for view in NFTRetrieval.getRecommendedViewsTypes(version: \"v1\") {\n        views.insert(key: view.identifier, false)\n    }\n    // Set to true if supported.\n    for view in nftResolver.getViews() {\n        if views.containsKey(view.identifier) {\n            views.insert(key: view.identifier, true)\n        }\n    }\n    return views\n}", "get_current_views": "import MetadataViews from 0xMetadataViews\n\n/*\n    Script to check all currently implemented MetadataViews.\n    In addition, it will ensure if the Public Collection is setup and linked correctly for consumption.\n    Returns all View Types.\n */\npub fun main(ownerAddress: Address, collectionPublicPath: PublicPath): [Type] {\n    let owner = getAccount(ownerAddress)\n    let collectionCap = owner.getCapability<&AnyResource{MetadataViews.ResolverCollection}>(collectionPublicPath)\n    assert(collectionCap.check(), message: \"MetadataViews Collection is not set up properly, ensure the Capability was created/linked correctly.\")\n    let collection = collectionCap.borrow()!\n    assert(collection.getIDs().length > 0, message: \"No NFTs exist in this collection, ensure the provided account has at least 1 NFTs.\")\n    let testNftId = collection.getIDs()[0]\n    let nftResolver = collection.borrowViewResolver(id: testNftId)\n    return nftResolver.getViews()\n}", "get_recommended_v1_views": "import MetadataViews from 0xMetadataViews\nimport NFTRetrieval from 0xNFTRetrieval\n\n/*\n    Script to get all currently recommended MetadataViews.\n */\npub fun main(): [Type] {\n    return NFTRetrieval.getRecommendedViewsTypes(version: \"v1\")\n}" }, "vars": { "emulator": { "0xMetadataViews": null, "0xNFTCatalog": null, "0xNFTRetrieval": null }, "testnet": { "0xMetadataViews": "0x631e88ae7f1d7c20", "0xNFTCatalog": "0x324c34e1c517e4db", "0xNFTRetrieval": "0x324c34e1c517e4db" }, "mainnet": { "0xMetadataViews": "0x1d7e57aa55817448", "0xNFTCatalog": "0x49a7cda3a1eecc29", "0xNFTRetrieval": "0x49a7cda3a1eecc29" } } }
