Skip to content

Commit

Permalink
prep for launch
Browse files Browse the repository at this point in the history
  • Loading branch information
AlmostEfficient committed Jun 23, 2022
1 parent b0a29d9 commit a68c4d5
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 92 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/cadence/scripts/getID.cdc
Original file line number Diff line number Diff line change
@@ -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")

Expand Down
2 changes: 1 addition & 1 deletion src/cadence/scripts/getID_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/cadence/scripts/getMetadata.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion src/cadence/scripts/getMetadata_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions src/cadence/scripts/getTotalSupply_script.js
Original file line number Diff line number Diff line change
@@ -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;
}
`
83 changes: 42 additions & 41 deletions src/cadence/transactions/mintNFT.cdc
Original file line number Diff line number Diff line change
@@ -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")
}
}
83 changes: 42 additions & 41 deletions src/cadence/transactions/mintNFT_tx.js
Original file line number Diff line number Diff line change
@@ -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")
}
}
`

0 comments on commit a68c4d5

Please sign in to comment.