Skip to content

Commit

Permalink
Add getNftCollectionContent function to
Browse files Browse the repository at this point in the history
NftCollection trait
  • Loading branch information
d0rich committed Nov 12, 2023
1 parent 10f152d commit f93e0ef
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions contracts/contracts/lib/trait_nft_collection.tact
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ trait NftCollection with Deployable, Accounting {

// ===== Customizable functions ===== //

virtual fun getNftCollectionContent(): Cell {
let b: StringBuilder = beginString();
let collectionDataString: String = self.collection_content.asSlice().asString();
b.append(collectionDataString);
b.append("meta.json");
return b.toCell();
}

virtual fun getNftItemInit(item_index: Int): StateInit {
require(false, "Not implemented");
}
Expand All @@ -20,13 +28,9 @@ trait NftCollection with Deployable, Accounting {
// https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md#get-methods-1

get fun get_collection_data(): CollectionData {
let b: StringBuilder = beginString();
let collectionDataString: String = self.collection_content.asSlice().asString();
b.append(collectionDataString);
b.append("meta.json"); // You can changed this your self.
return CollectionData{
next_item_index: self.next_item_index,
collection_content: b.toCell(),
collection_content: self.getNftCollectionContent(),
owner_address: self.owner_address
};
}
Expand Down

0 comments on commit f93e0ef

Please sign in to comment.