@@ -60,6 +60,7 @@ To make a `Collection` with a fixed supply you can use `collection::create_fixed
6060``` move filename="example.move"
6161use aptos_token_objects::collection;
6262use std::option::{Self, Option};
63+ use aptos_framework::string;
6364
6465public entry fun create_collection(creator: &signer) {
6566 let max_supply = 1000;
@@ -68,11 +69,11 @@ public entry fun create_collection(creator: &signer) {
6869 // Maximum supply cannot be changed after collection creation
6970 collection::create_fixed_collection(
7071 creator,
71- "My Collection Description",
72+ string::utf8(b "My Collection Description") ,
7273 max_supply,
73- "My Collection",
74+ string::utf8(b "My Collection") ,
7475 royalty,
75- "https://mycollection.com",
76+ string::utf8(b "https://mycollection.com") ,
7677 );
7778}
7879```
@@ -82,16 +83,17 @@ To create a `Collection` with unlimited supply you can use `collection::create_u
8283
8384``` move filename="example.move"
8485use std::option::{Self, Option};
86+ use aptos_framework::string;
8587
8688public entry fun create_collection(creator: &signer) {
8789 let royalty = option::none();
8890
8991 collection::create_unlimited_collection(
9092 creator,
91- "My Collection Description",
92- "My Collection",
93+ string::utf8(b "My Collection Description") ,
94+ string::utf8(b "My Collection") ,
9395 royalty,
94- "https://mycollection.com",
96+ string::utf8(b "https://mycollection.com") ,
9597 );
9698}
9799```
@@ -106,15 +108,16 @@ Since each `Collection` is a [Move Object](objects.mdx), you can customize it by
106108
107109``` move filename="example.move"
108110use std::option::{Self, Option};
111+ use aptos_framework::string;
109112
110113public entry fun create_collection(creator: &signer) {
111114 let royalty = option::none();
112115 let collection_constructor_ref = &collection::create_unlimited_collection(
113116 creator,
114- "My Collection Description",
115- "My Collection",
117+ string::utf8(b "My Collection Description") ,
118+ string::utf8(b "My Collection") ,
116119 royalty,
117- "https://mycollection.com",
120+ string::utf8(b "https://mycollection.com") ,
118121 );
119122 let mutator_ref = collection::get_mutator_ref(collection_constructor_ref);
120123 // Store the mutator ref somewhere safe
@@ -129,6 +132,7 @@ You can further customize your `Collection` by adding more resources or function
129132
130133``` move filename="example.move"
131134use std::option::{Self, Option};
135+ use aptos_framework::string;
132136
133137struct MyCollectionMetadata has key {
134138 creation_timestamp_secs: u64,
@@ -139,11 +143,11 @@ public entry fun create_collection(creator: &signer) {
139143 // Constructor ref is a non-storable struct returned when creating a new object.
140144 // It can generate an object signer to add resources to the collection object.
141145 let collection_constructor_ref = &collection::create_unlimited_collection(
142- creator,
143- "My Collection Description",
144- "My Collection",
146+ creator,
147+ string::utf8(b "My Collection Description") ,
148+ string::utf8(b "My Collection") ,
145149 royalty,
146- "https://mycollection.com",
150+ string::utf8(b "https://mycollection.com") ,
147151 );
148152 // Constructor ref can be exchanged for signer to add resources to the collection object.
149153 let collection_signer = &object::generate_signer(collection_constructor_ref);
@@ -194,16 +198,17 @@ You can derive the address for named tokens by:
194198``` move filename="example.move"
195199use aptos_token_objects::token;
196200use std::option::{Self, Option};
201+ use aptos_framework::string;
197202
198203public entry fun mint_token(creator: &signer) {
199204 let royalty = option::none();
200205 token::create(
201206 creator,
202- "Collection Name",
203- "Description",
204- "Token Name",
207+ string::utf8(b "Collection Name") ,
208+ string::utf8(b "Description") ,
209+ string::utf8(b "Token Name") ,
205210 royalty,
206- "https://mycollection.com/my-named-token.jpeg",
211+ string::utf8(b "https://mycollection.com/my-named-token.jpeg") ,
207212 );
208213}
209214```
0 commit comments