Skip to content

Comments

Add txs for NFTStorefrontV2 / TopShotMarketV3#95

Open
bspowell wants to merge 9 commits intomainfrom
seanp/add-listing-storefrontv2
Open

Add txs for NFTStorefrontV2 / TopShotMarketV3#95
bspowell wants to merge 9 commits intomainfrom
seanp/add-listing-storefrontv2

Conversation

@bspowell
Copy link
Contributor

@bspowell bspowell commented Feb 4, 2026

Changes

  • Added list tx for NFTStorefrontV2 with ability to handle multiple listings
  • Renamed delist files to keep naming style
  • Added DelistTopShotMarketV3 transaction
  • Added script tests

@bspowell bspowell requested a review from a team as a code owner February 4, 2026 22:17
@bspowell bspowell changed the title Add list tx for NFTStorefrontV2 Add txs for NFTStorefrontV2 / TopShotMarketV3 Feb 9, 2026

execute {
let listingResourceIDs: [Uint64] = [{{.listingResourceIDs}}]
let listingResourceIDs: [Uint64] = {{.ListingResourceIDs}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you removing the array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because I'm passing in an array, not a string with ids.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListingResourceIDs []uint64


execute {
let listingResourceIDs: [Uint64] = [{{.listingResourceIDs}}]
let listingResourceIDs: [Uint64] = {{.ListingResourceIDs}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

let nftIds: [UInt64]

prepare(acct: auth(Storage, Capabilities) &Account) {
self.nftIds = {{.NftIds}}
Copy link
Collaborator

@Deewai Deewai Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.nftIds = {{.NftIds}}
self.nftIds = [{{.NftIds}}]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though I'm passing in a []uint64? same as above? Or would you rather it be a connected list of ids in a string?

Comment on lines 73 to 87
let PrivateCollectionPath = /storage/{{.NFTProductName}}CollectionProviderForNFTStorefront

// Temporary variable to handle capability assignment
var provider: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>? =
acct.storage.copy<Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>>(from: PrivateCollectionPath)

if provider == nil {
provider = acct.capabilities.storage.issue<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>({{.NFTProductName}}.CollectionStoragePath)
acct.capabilities.storage.getController(byCapabilityID: provider!.id)!.setTag("{{.NFTProductName}}CollectionProviderForNFTStorefront")
// Save the capability to the account storage
acct.storage.save(provider!, to: PrivateCollectionPath)
}

self.nftProvider = provider
assert(self.nftProvider?.borrow() != nil, message: "Missing or mis-typed {{.NFTProductName}}.Collection provider")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use cap controllers https://github.com/onflow/nft-storefront/blob/main/transactions-v1/sell_item.cdc#L23

Suggested change
let PrivateCollectionPath = /storage/{{.NFTProductName}}CollectionProviderForNFTStorefront
// Temporary variable to handle capability assignment
var provider: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>? =
acct.storage.copy<Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>>(from: PrivateCollectionPath)
if provider == nil {
provider = acct.capabilities.storage.issue<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>({{.NFTProductName}}.CollectionStoragePath)
acct.capabilities.storage.getController(byCapabilityID: provider!.id)!.setTag("{{.NFTProductName}}CollectionProviderForNFTStorefront")
// Save the capability to the account storage
acct.storage.save(provider!, to: PrivateCollectionPath)
}
self.nftProvider = provider
assert(self.nftProvider?.borrow() != nil, message: "Missing or mis-typed {{.NFTProductName}}.Collection provider")
var nftProviderCap: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>? = nil
// check if there is an existing capability/capability controller for the storage path
let nftCollectionControllers = acct.capabilities.storage.getControllers(forPath: collectionData.storagePath)
for controller in nftCollectionControllers {
if let maybeProviderCap = controller.capability as? Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>? {
nftProviderCap = maybeProviderCap
break
}
}
// if there are no capabilities created for that storage path
// or if existing capability is no longer valid, issue a new one
if nftProviderCap == nil || nftProviderCap?.check() ?? false {
nftProviderCap = acct.capabilities.storage.issue<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>(
collectionData.storagePath
)
}
assert(nftProviderCap?.check() ?? false, message: "Could not assign Provider Capability")
self.nftProvider = nftProviderCap!

Comment on lines 65 to 71
if !acct.capabilities.get<&{{.NFTProductName}}.Collection>({{.NFTProductName}}.CollectionPublicPath)!.check() {
acct.capabilities.unpublish({{.NFTProductName}}.CollectionPublicPath)
acct.capabilities.publish(
acct.capabilities.storage.issue<&{{.NFTProductName}}.Collection>({{.NFTProductName}}.CollectionStoragePath),
at: {{.NFTProductName}}.CollectionPublicPath
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if !acct.capabilities.get<&{{.NFTProductName}}.Collection>({{.NFTProductName}}.CollectionPublicPath)!.check() {
acct.capabilities.unpublish({{.NFTProductName}}.CollectionPublicPath)
acct.capabilities.publish(
acct.capabilities.storage.issue<&{{.NFTProductName}}.Collection>({{.NFTProductName}}.CollectionStoragePath),
at: {{.NFTProductName}}.CollectionPublicPath
)
}
if !acct.capabilities.get<&{{.NFTProductName}}.Collection>(collectionData.publicPath)!.check() {
acct.capabilities.unpublish(collectionData.publicPath)
acct.capabilities.publish(
acct.capabilities.storage.issue<&{{.NFTProductName}}.Collection>(collectionData.storagePath),
at: collectionData.publicPath
)
}



let collectionRef = acct
.capabilities.borrow<&{{.NFTProductName}}.Collection>({{.NFTProductName}}.CollectionPublicPath)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.capabilities.borrow<&{{.NFTProductName}}.Collection>({{.NFTProductName}}.CollectionPublicPath)
.capabilities.borrow<&{{.NFTProductName}}.Collection>(collectionData.publicPath)

atlas/embed.go Outdated
NFTProductName string
NFTContractAddress string
NFTStorefrontV2ContractAddress string
NFTIDs string // comma-separated, e.g. "123,456"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be an array of uint64, you do the conversion to comma-separated string in ListNFTStorefrontV2TxScript. Same with the prices below. should be an array of integers(price in cents) and you do the conversion in the same function. SaleCommissionAmount should also be an integer(price in cent)

}
}

func TestDelistNFTStorefrontOutput(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests are not actually testing anything. It just logs stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, it helps see what is getting inputted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants