From a68c4d5cd3a3f31e2f0fe7a0b5e5719365517dde Mon Sep 17 00:00:00 2001 From: Abdullah Raza <42661870+AlmostEfficient@users.noreply.github.com> Date: Fri, 24 Jun 2022 05:46:53 +1200 Subject: [PATCH] prep for launch --- package-lock.json | 4 +- src/cadence/scripts/getID.cdc | 6 +- src/cadence/scripts/getID_script.js | 2 +- src/cadence/scripts/getMetadata.cdc | 2 +- src/cadence/scripts/getMetadata_script.js | 2 +- src/cadence/scripts/getTotalSupply_script.js | 5 +- src/cadence/transactions/mintNFT.cdc | 83 ++++++++++---------- src/cadence/transactions/mintNFT_tx.js | 83 ++++++++++---------- 8 files changed, 95 insertions(+), 92 deletions(-) diff --git a/package-lock.json b/package-lock.json index cbac849..69fdc15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "flow-nft-dapp", + "name": "flow-nft-starter", "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "flow-nft-dapp", + "name": "flow-nft-starter", "version": "0.1.0", "dependencies": { "@onflow/fcl": "^1.0.2", diff --git a/src/cadence/scripts/getID.cdc b/src/cadence/scripts/getID.cdc index 404324f..25bda8f 100644 --- a/src/cadence/scripts/getID.cdc +++ b/src/cadence/scripts/getID.cdc @@ -1,11 +1,11 @@ -import MetadataViews from 0x631e88ae7f1d7c20; +import MetadataViews from 0x631e88ae7f1d7c20 pub fun main(address: Address): [UInt64] { let account = getAccount(address) - + let collection = account - .getCapability(/public/BuildspaceNFTCollection) + .getCapability(/public/BottomShotCollectionPublic) .borrow<&{MetadataViews.ResolverCollection}>() ?? panic("Could not borrow a reference to the collection") diff --git a/src/cadence/scripts/getID_script.js b/src/cadence/scripts/getID_script.js index 3627a90..bf1ae4c 100644 --- a/src/cadence/scripts/getID_script.js +++ b/src/cadence/scripts/getID_script.js @@ -7,7 +7,7 @@ pub fun main(address: Address): [UInt64] { let account = getAccount(address) let collection = account - .getCapability(/public/BuildspaceNFTCollection) + .getCapability(/public/BottomShotCollection) .borrow<&{MetadataViews.ResolverCollection}>() ?? panic("Could not borrow a reference to the collection") diff --git a/src/cadence/scripts/getMetadata.cdc b/src/cadence/scripts/getMetadata.cdc index d65f523..30643b2 100644 --- a/src/cadence/scripts/getMetadata.cdc +++ b/src/cadence/scripts/getMetadata.cdc @@ -5,7 +5,7 @@ pub fun main(address: Address, id: UInt64): NFTResult { let account = getAccount(address) let collection = account - .getCapability(/public/BuildspaceNFTCollection) + .getCapability(/public/BottomShotCollection) .borrow<&{MetadataViews.ResolverCollection}>() ?? panic("Could not borrow a reference to the collection") diff --git a/src/cadence/scripts/getMetadata_script.js b/src/cadence/scripts/getMetadata_script.js index 1b54297..f660241 100644 --- a/src/cadence/scripts/getMetadata_script.js +++ b/src/cadence/scripts/getMetadata_script.js @@ -7,7 +7,7 @@ pub fun main(address: Address, id: UInt64): NFTResult { let account = getAccount(address) let collection = account - .getCapability(/public/BuildspaceNFTCollection) + .getCapability(/public/BottomShotCollection) .borrow<&{MetadataViews.ResolverCollection}>() ?? panic("Could not borrow a reference to the collection") diff --git a/src/cadence/scripts/getTotalSupply_script.js b/src/cadence/scripts/getTotalSupply_script.js index f761a28..a7913a5 100644 --- a/src/cadence/scripts/getTotalSupply_script.js +++ b/src/cadence/scripts/getTotalSupply_script.js @@ -1,10 +1,11 @@ export const getTotalSupply = +// REPLACE THIS WITH YOUR CONTRACT NAME + ADDRESS ` -import BuildspaceNFT from 0xb25c3b0e6ed6d79a; +import BottomShot from 0x7b6adb682517f137; pub fun main(): UInt64 { - return BuildspaceNFT.totalSupply; + return BottomShot.totalSupply; } ` \ No newline at end of file diff --git a/src/cadence/transactions/mintNFT.cdc b/src/cadence/transactions/mintNFT.cdc index 4f872a5..2b40fd9 100644 --- a/src/cadence/transactions/mintNFT.cdc +++ b/src/cadence/transactions/mintNFT.cdc @@ -1,47 +1,48 @@ -import NonFungibleToken from 0x631e88ae7f1d7c20; -import MetadataViews from 0x631e88ae7f1d7c20; -import BuildspaceNFT from 0xb25c3b0e6ed6d79a; +// REPLACE THIS WITH YOUR CONTRACT NAME + ADDRESS +import BottomShot from 0x7b6adb682517f137 +// This remains the same +import NonFungibleToken from 0x631e88ae7f1d7c20 transaction( - recipient: Address, - name: String, - description: String, - thumbnail: String, + recipient: Address, + name: String, + description: String, + thumbnail: String, ) { - - prepare(signer: AuthAccount) { - if signer.borrow<&BuildspaceNFT.Collection>(from: BuildspaceNFT.CollectionStoragePath) != nil { - return - } - - // Create a new empty collection - let collection <- BuildspaceNFT.createEmptyCollection() - - // save it to the account - signer.save(<-collection, to: BuildspaceNFT.CollectionStoragePath) - - // create a public capability for the collection - signer.link<&{NonFungibleToken.CollectionPublic, MetadataViews.ResolverCollection}>( - BuildspaceNFT.CollectionPublicPath, - target: BuildspaceNFT.CollectionStoragePath - ) + prepare(signer: AuthAccount) { + if signer.borrow<&BottomShot.Collection>(from: BottomShot.CollectionStoragePath) != nil { + return } - execute { - // Borrow the recipient's public NFT collection reference - let receiver = getAccount(recipient) - .getCapability(BuildspaceNFT.CollectionPublicPath) - .borrow<&{NonFungibleToken.CollectionPublic}>() - ?? panic("Could not get receiver reference to the NFT Collection") - - // Mint the NFT and deposit it to the recipient's collection - BuildspaceNFT.mintNFT( - recipient: receiver, - name: name, - description: description, - thumbnail: thumbnail, - ) - - log("Minted an NFT") - } + // Create a new empty collection + let collection <- BottomShot.createEmptyCollection() + + // save it to the account + signer.save(<-collection, to: BottomShot.CollectionStoragePath) + + // create a public capability for the collection + signer.link<&{NonFungibleToken.CollectionPublic}>( + BottomShot.CollectionPublicPath, + target: BottomShot.CollectionStoragePath + ) + } + + + execute { + // Borrow the recipient's public NFT collection reference + let receiver = getAccount(recipient) + .getCapability(BottomShot.CollectionPublicPath) + .borrow<&{NonFungibleToken.CollectionPublic}>() + ?? panic("Could not get receiver reference to the NFT Collection") + + // Mint the NFT and deposit it to the recipient's collection + BottomShot.mintNFT( + recipient: receiver, + name: name, + description: description, + thumbnail: thumbnail, + ) + + log("Minted an NFT and stored it into the collection") + } } \ No newline at end of file diff --git a/src/cadence/transactions/mintNFT_tx.js b/src/cadence/transactions/mintNFT_tx.js index 4533de2..ca979fd 100644 --- a/src/cadence/transactions/mintNFT_tx.js +++ b/src/cadence/transactions/mintNFT_tx.js @@ -1,50 +1,51 @@ export const mintNFT = ` -import NonFungibleToken from 0x631e88ae7f1d7c20; -import MetadataViews from 0x631e88ae7f1d7c20; -import BuildspaceNFT from 0xb25c3b0e6ed6d79a; +// REPLACE THIS WITH YOUR CONTRACT NAME + ADDRESS +import BottomShot from 0x7b6adb682517f137 +// This remains the same +import NonFungibleToken from 0x631e88ae7f1d7c20 transaction( - recipient: Address, - name: String, - description: String, - thumbnail: String, + recipient: Address, + name: String, + description: String, + thumbnail: String, ) { - - prepare(signer: AuthAccount) { - if signer.borrow<&BuildspaceNFT.Collection>(from: BuildspaceNFT.CollectionStoragePath) != nil { - return - } - - // Create a new empty collection - let collection <- BuildspaceNFT.createEmptyCollection() - - // save it to the account - signer.save(<-collection, to: BuildspaceNFT.CollectionStoragePath) - - // create a public capability for the collection - signer.link<&{NonFungibleToken.CollectionPublic, MetadataViews.ResolverCollection}>( - BuildspaceNFT.CollectionPublicPath, - target: BuildspaceNFT.CollectionStoragePath - ) + prepare(signer: AuthAccount) { + if signer.borrow<&BottomShot.Collection>(from: BottomShot.CollectionStoragePath) != nil { + return } - execute { - // Borrow the recipient's public NFT collection reference - let receiver = getAccount(recipient) - .getCapability(BuildspaceNFT.CollectionPublicPath) - .borrow<&{NonFungibleToken.CollectionPublic}>() - ?? panic("Could not get receiver reference to the NFT Collection") - - // Mint the NFT and deposit it to the recipient's collection - BuildspaceNFT.mintNFT( - recipient: receiver, - name: name, - description: description, - thumbnail: thumbnail, - ) - - log("Minted an NFT") - } + // Create a new empty collection + let collection <- BottomShot.createEmptyCollection() + + // save it to the account + signer.save(<-collection, to: BottomShot.CollectionStoragePath) + + // create a public capability for the collection + signer.link<&{NonFungibleToken.CollectionPublic}>( + BottomShot.CollectionPublicPath, + target: BottomShot.CollectionStoragePath + ) + } + + + execute { + // Borrow the recipient's public NFT collection reference + let receiver = getAccount(recipient) + .getCapability(BottomShot.CollectionPublicPath) + .borrow<&{NonFungibleToken.CollectionPublic}>() + ?? panic("Could not get receiver reference to the NFT Collection") + + // Mint the NFT and deposit it to the recipient's collection + BottomShot.mintNFT( + recipient: receiver, + name: name, + description: description, + thumbnail: thumbnail, + ) + + log("Minted an NFT and stored it into the collection") + } } ` \ No newline at end of file