Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TheFabricant transactions #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions transactions/TheFabricant/delist_item.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import TheFabricantMarketplace from 0xTheFabricantMarketplace

transaction(listingID: String) {

let listingRef: &TheFabricantMarketplace.Listings

prepare(acct: AuthAccount) {

// borrow a reference to the owner's listing collection
self.listingRef = acct.borrow<&TheFabricantMarketplace.Listings>(from: TheFabricantMarketplace.ListingsStoragePath)
?? panic("Could not borrow from listings in storage")
}

execute {

// de-listing item
self.listingRef.removeListing(listingID: listingID)

}
}
8 changes: 8 additions & 0 deletions transactions/TheFabricant/delist_item.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arguments": [
"listingID"
],
"messages": {
"en": "Remove NFT from sale."
}
}
223 changes: 223 additions & 0 deletions transactions/TheFabricant/initialize_account.cdc

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions transactions/TheFabricant/initialize_account.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"messages": {
"en": "Initilize your account to store The Fabricant NFTs."
}
}
72 changes: 72 additions & 0 deletions transactions/TheFabricant/list_highsnobietynotinparisItem.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import FungibleToken from 0xFungibleToken
import NonFungibleToken from 0xNonFungibleToken
import FlowToken from 0xFlowToken
import TheFabricantMarketplace from 0xTheFabricantMarketplace
import TheFabricantMarketplaceHelper from 0xTheFabricantMarketplaceHelper
import HighsnobietyNotInParis from 0xHighsnobietyNotInParis

transaction(itemID: UInt64, price: UFix64) {
let itemCollectionRef: &HighsnobietyNotInParis.Collection
let listingRef: &TheFabricantMarketplace.Listings
let flowReceiver: Capability<&FlowToken.Vault{FungibleToken.Receiver}>
let itemNFTProvider: Capability<&HighsnobietyNotInParis.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>

prepare(acct: AuthAccount) {

// borrow a reference to self's item collection
self.itemCollectionRef = acct.borrow<&HighsnobietyNotInParis.Collection>(from: HighsnobietyNotInParis.${collectionStoragePathPrefix}CollectionStoragePath)
?? panic("Could not borrow item in storage")

// get listings Capability
let listingCap = acct.getCapability<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath)

// get flow token Capability
self.flowReceiver = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)
assert(self.flowReceiver.check(), message: "Missing or mis-typed FlowToken receiver")

// initialize private path to withdraw your nft once it is purchased
let NFTCollectionProviderPrivatePath = ${providerPrivatePath}
if !acct.getCapability<&HighsnobietyNotInParis.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath).check() {
acct.unlink(NFTCollectionProviderPrivatePath)
acct.link<&HighsnobietyNotInParis.Collection{HighsnobietyNotInParis.${publicCollPrefix}CollectionPublic, NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath, target: HighsnobietyNotInParis.${collectionStoragePathPrefix}CollectionStoragePath)
}

// get nft provider capability
self.itemNFTProvider = acct.getCapability<&HighsnobietyNotInParis.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath)
assert(self.itemNFTProvider.check(), message: "Missing or mis-typed HighsnobietyNotInParis.Collection provider")

if !listingCap.check() {

// get own flow token capability
let wallet = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)

// create listings
let listings <- TheFabricantMarketplace.createListings()

// store an empty listings
acct.save<@TheFabricantMarketplace.Listings>(<- listings, to: TheFabricantMarketplace.ListingsStoragePath)

// publish a public capability to the Listings in storage
acct.link<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath, target: TheFabricantMarketplace.ListingsStoragePath)
}

self.listingRef=acct.borrow<&TheFabricantMarketplace.Listings>(from: TheFabricantMarketplace.ListingsStoragePath)!
}

execute {

let itemRef = self.itemCollectionRef.borrow${borrowName}(id: itemID)! as &HighsnobietyNotInParis.NFT

//list the item
TheFabricantMarketplaceHelper.${mpHelper}(
itemRef: itemRef,
${listingsRefKey}: self.listingRef,
nftProviderCapability: self.itemNFTProvider,
nftType: Type<@HighsnobietyNotInParis.NFT>(),
nftID: itemID,
paymentCapability: self.flowReceiver,
salePaymentVaultType: Type<@FlowToken.Vault>(),
price: price
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"arguments": [
"itemID",
"price"
],
"messages": {
"en": "List NFT for sale."
}
}
72 changes: 72 additions & 0 deletions transactions/TheFabricant/list_kapersItem.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import FungibleToken from 0xFungibleToken
import NonFungibleToken from 0xNonFungibleToken
import FlowToken from 0xFlowToken
import TheFabricantMarketplace from 0xTheFabricantMarketplace
import TheFabricantMarketplaceHelper from 0xTheFabricantMarketplaceHelper
import TheFabricantKapers from 0xTheFabricantKapers

transaction(itemID: UInt64, price: UFix64) {
let itemCollectionRef: &TheFabricantKapers.Collection
let listingRef: &TheFabricantMarketplace.Listings
let flowReceiver: Capability<&FlowToken.Vault{FungibleToken.Receiver}>
let itemNFTProvider: Capability<&TheFabricantKapers.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>

prepare(acct: AuthAccount) {

// borrow a reference to self's item collection
self.itemCollectionRef = acct.borrow<&TheFabricantKapers.Collection>(from: TheFabricantKapers.${collectionStoragePathPrefix}CollectionStoragePath)
?? panic("Could not borrow item in storage")

// get listings Capability
let listingCap = acct.getCapability<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath)

// get flow token Capability
self.flowReceiver = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)
assert(self.flowReceiver.check(), message: "Missing or mis-typed FlowToken receiver")

// initialize private path to withdraw your nft once it is purchased
let NFTCollectionProviderPrivatePath = ${providerPrivatePath}
if !acct.getCapability<&TheFabricantKapers.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath).check() {
acct.unlink(NFTCollectionProviderPrivatePath)
acct.link<&TheFabricantKapers.Collection{TheFabricantKapers.${publicCollPrefix}CollectionPublic, NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath, target: TheFabricantKapers.${collectionStoragePathPrefix}CollectionStoragePath)
}

// get nft provider capability
self.itemNFTProvider = acct.getCapability<&TheFabricantKapers.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath)
assert(self.itemNFTProvider.check(), message: "Missing or mis-typed TheFabricantKapers.Collection provider")

if !listingCap.check() {

// get own flow token capability
let wallet = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)

// create listings
let listings <- TheFabricantMarketplace.createListings()

// store an empty listings
acct.save<@TheFabricantMarketplace.Listings>(<- listings, to: TheFabricantMarketplace.ListingsStoragePath)

// publish a public capability to the Listings in storage
acct.link<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath, target: TheFabricantMarketplace.ListingsStoragePath)
}

self.listingRef=acct.borrow<&TheFabricantMarketplace.Listings>(from: TheFabricantMarketplace.ListingsStoragePath)!
}

execute {

let itemRef = self.itemCollectionRef.borrow${borrowName}(id: itemID)! as &TheFabricantKapers.NFT

//list the item
TheFabricantMarketplaceHelper.${mpHelper}(
itemRef: itemRef,
${listingsRefKey}: self.listingRef,
nftProviderCapability: self.itemNFTProvider,
nftType: Type<@TheFabricantKapers.NFT>(),
nftID: itemID,
paymentCapability: self.flowReceiver,
salePaymentVaultType: Type<@FlowToken.Vault>(),
price: price
)
}
}
9 changes: 9 additions & 0 deletions transactions/TheFabricant/list_kapersItem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"arguments": [
"itemID",
"price"
],
"messages": {
"en": "List NFT for sale."
}
}
72 changes: 72 additions & 0 deletions transactions/TheFabricant/list_primalraveItem.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import FungibleToken from 0xFungibleToken
import NonFungibleToken from 0xNonFungibleToken
import FlowToken from 0xFlowToken
import TheFabricantMarketplace from 0xTheFabricantMarketplace
import TheFabricantMarketplaceHelper from 0xTheFabricantMarketplaceHelper
import TheFabricantPrimalRave from 0xTheFabricantPrimalRave

transaction(itemID: UInt64, price: UFix64) {
let itemCollectionRef: &TheFabricantPrimalRave.Collection
let listingRef: &TheFabricantMarketplace.Listings
let flowReceiver: Capability<&FlowToken.Vault{FungibleToken.Receiver}>
let itemNFTProvider: Capability<&TheFabricantPrimalRave.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>

prepare(acct: AuthAccount) {

// borrow a reference to self's item collection
self.itemCollectionRef = acct.borrow<&TheFabricantPrimalRave.Collection>(from: TheFabricantPrimalRave.${collectionStoragePathPrefix}CollectionStoragePath)
?? panic("Could not borrow item in storage")

// get listings Capability
let listingCap = acct.getCapability<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath)

// get flow token Capability
self.flowReceiver = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)
assert(self.flowReceiver.check(), message: "Missing or mis-typed FlowToken receiver")

// initialize private path to withdraw your nft once it is purchased
let NFTCollectionProviderPrivatePath = ${providerPrivatePath}
if !acct.getCapability<&TheFabricantPrimalRave.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath).check() {
acct.unlink(NFTCollectionProviderPrivatePath)
acct.link<&TheFabricantPrimalRave.Collection{TheFabricantPrimalRave.${publicCollPrefix}CollectionPublic, NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath, target: TheFabricantPrimalRave.${collectionStoragePathPrefix}CollectionStoragePath)
}

// get nft provider capability
self.itemNFTProvider = acct.getCapability<&TheFabricantPrimalRave.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath)
assert(self.itemNFTProvider.check(), message: "Missing or mis-typed TheFabricantPrimalRave.Collection provider")

if !listingCap.check() {

// get own flow token capability
let wallet = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)

// create listings
let listings <- TheFabricantMarketplace.createListings()

// store an empty listings
acct.save<@TheFabricantMarketplace.Listings>(<- listings, to: TheFabricantMarketplace.ListingsStoragePath)

// publish a public capability to the Listings in storage
acct.link<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath, target: TheFabricantMarketplace.ListingsStoragePath)
}

self.listingRef=acct.borrow<&TheFabricantMarketplace.Listings>(from: TheFabricantMarketplace.ListingsStoragePath)!
}

execute {

let itemRef = self.itemCollectionRef.borrow${borrowName}(id: itemID)! as &TheFabricantPrimalRave.NFT

//list the item
TheFabricantMarketplaceHelper.${mpHelper}(
itemRef: itemRef,
${listingsRefKey}: self.listingRef,
nftProviderCapability: self.itemNFTProvider,
nftType: Type<@TheFabricantPrimalRave.NFT>(),
nftID: itemID,
paymentCapability: self.flowReceiver,
salePaymentVaultType: Type<@FlowToken.Vault>(),
price: price
)
}
}
9 changes: 9 additions & 0 deletions transactions/TheFabricant/list_primalraveItem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"arguments": [
"itemID",
"price"
],
"messages": {
"en": "List NFT for sale."
}
}
72 changes: 72 additions & 0 deletions transactions/TheFabricant/list_s2item.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import FungibleToken from 0xFungibleToken
import NonFungibleToken from 0xNonFungibleToken
import FlowToken from 0xFlowToken
import TheFabricantMarketplace from 0xTheFabricantMarketplace
import TheFabricantMarketplaceHelper from 0xTheFabricantMarketplaceHelper
import TheFabricantS2ItemNFT from 0xTheFabricantS2ItemNFT

transaction(itemID: UInt64, price: UFix64) {
let itemCollectionRef: &TheFabricantS2ItemNFT.Collection
let listingRef: &TheFabricantMarketplace.Listings
let flowReceiver: Capability<&FlowToken.Vault{FungibleToken.Receiver}>
let itemNFTProvider: Capability<&TheFabricantS2ItemNFT.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>

prepare(acct: AuthAccount) {

// borrow a reference to self's item collection
self.itemCollectionRef = acct.borrow<&TheFabricantS2ItemNFT.Collection>(from: TheFabricantS2ItemNFT.${collectionStoragePathPrefix}CollectionStoragePath)
?? panic("Could not borrow item in storage")

// get listings Capability
let listingCap = acct.getCapability<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath)

// get flow token Capability
self.flowReceiver = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)
assert(self.flowReceiver.check(), message: "Missing or mis-typed FlowToken receiver")

// initialize private path to withdraw your nft once it is purchased
let NFTCollectionProviderPrivatePath = ${providerPrivatePath}
if !acct.getCapability<&TheFabricantS2ItemNFT.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath).check() {
acct.unlink(NFTCollectionProviderPrivatePath)
acct.link<&TheFabricantS2ItemNFT.Collection{TheFabricantS2ItemNFT.${publicCollPrefix}CollectionPublic, NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath, target: TheFabricantS2ItemNFT.${collectionStoragePathPrefix}CollectionStoragePath)
}

// get nft provider capability
self.itemNFTProvider = acct.getCapability<&TheFabricantS2ItemNFT.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Provider}>(NFTCollectionProviderPrivatePath)
assert(self.itemNFTProvider.check(), message: "Missing or mis-typed TheFabricantS2ItemNFT.Collection provider")

if !listingCap.check() {

// get own flow token capability
let wallet = acct.getCapability<&FlowToken.Vault{FungibleToken.Receiver}>(/public/flowTokenReceiver)

// create listings
let listings <- TheFabricantMarketplace.createListings()

// store an empty listings
acct.save<@TheFabricantMarketplace.Listings>(<- listings, to: TheFabricantMarketplace.ListingsStoragePath)

// publish a public capability to the Listings in storage
acct.link<&{TheFabricantMarketplace.ListingsPublic}>(TheFabricantMarketplace.ListingsPublicPath, target: TheFabricantMarketplace.ListingsStoragePath)
}

self.listingRef=acct.borrow<&TheFabricantMarketplace.Listings>(from: TheFabricantMarketplace.ListingsStoragePath)!
}

execute {

let itemRef = self.itemCollectionRef.borrow${borrowName}(id: itemID)! as &TheFabricantS2ItemNFT.NFT

//list the item
TheFabricantMarketplaceHelper.${mpHelper}(
itemRef: itemRef,
${listingsRefKey}: self.listingRef,
nftProviderCapability: self.itemNFTProvider,
nftType: Type<@TheFabricantS2ItemNFT.NFT>(),
nftID: itemID,
paymentCapability: self.flowReceiver,
salePaymentVaultType: Type<@FlowToken.Vault>(),
price: price
)
}
}
9 changes: 9 additions & 0 deletions transactions/TheFabricant/list_s2item.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"arguments": [
"itemID",
"price"
],
"messages": {
"en": "List NFT for sale."
}
}
Loading