Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.
Merged
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
39 changes: 22 additions & 17 deletions apps/nextra/pages/en/build/smart-contracts/digital-asset.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ To make a `Collection` with a fixed supply you can use `collection::create_fixed
```move filename="example.move"
use aptos_token_objects::collection;
use std::option::{Self, Option};
use aptos_framework::string;

public entry fun create_collection(creator: &signer) {
let max_supply = 1000;
Expand All @@ -68,11 +69,11 @@ public entry fun create_collection(creator: &signer) {
// Maximum supply cannot be changed after collection creation
collection::create_fixed_collection(
creator,
"My Collection Description",
string::utf8(b"My Collection Description"),
max_supply,
"My Collection",
string::utf8(b"My Collection"),
royalty,
"https://mycollection.com",
string::utf8(b"https://mycollection.com"),
);
}
```
Expand All @@ -82,16 +83,17 @@ To create a `Collection` with unlimited supply you can use `collection::create_u

```move filename="example.move"
use std::option::{Self, Option};
use aptos_framework::string;

public entry fun create_collection(creator: &signer) {
let royalty = option::none();

collection::create_unlimited_collection(
creator,
"My Collection Description",
"My Collection",
string::utf8(b"My Collection Description"),
string::utf8(b"My Collection"),
royalty,
"https://mycollection.com",
string::utf8(b"https://mycollection.com"),
);
}
```
Expand All @@ -106,15 +108,16 @@ Since each `Collection` is a [Move Object](objects.mdx), you can customize it by

```move filename="example.move"
use std::option::{Self, Option};
use aptos_framework::string;

public entry fun create_collection(creator: &signer) {
let royalty = option::none();
let collection_constructor_ref = &collection::create_unlimited_collection(
creator,
"My Collection Description",
"My Collection",
string::utf8(b"My Collection Description"),
string::utf8(b"My Collection"),
royalty,
"https://mycollection.com",
string::utf8(b"https://mycollection.com"),
);
let mutator_ref = collection::get_mutator_ref(collection_constructor_ref);
// Store the mutator ref somewhere safe
Expand All @@ -129,6 +132,7 @@ You can further customize your `Collection` by adding more resources or function

```move filename="example.move"
use std::option::{Self, Option};
use aptos_framework::string;

struct MyCollectionMetadata has key {
creation_timestamp_secs: u64,
Expand All @@ -139,11 +143,11 @@ public entry fun create_collection(creator: &signer) {
// Constructor ref is a non-storable struct returned when creating a new object.
// It can generate an object signer to add resources to the collection object.
let collection_constructor_ref = &collection::create_unlimited_collection(
creator,
"My Collection Description",
"My Collection",
creator,
string::utf8(b"My Collection Description"),
string::utf8(b"My Collection"),
royalty,
"https://mycollection.com",
string::utf8(b"https://mycollection.com"),
);
// Constructor ref can be exchanged for signer to add resources to the collection object.
let collection_signer = &object::generate_signer(collection_constructor_ref);
Expand Down Expand Up @@ -194,16 +198,17 @@ You can derive the address for named tokens by:
```move filename="example.move"
use aptos_token_objects::token;
use std::option::{Self, Option};
use aptos_framework::string;

public entry fun mint_token(creator: &signer) {
let royalty = option::none();
token::create(
creator,
"Collection Name",
"Description",
"Token Name",
string::utf8(b"Collection Name"),
string::utf8(b"Description"),
string::utf8(b"Token Name"),
royalty,
"https://mycollection.com/my-named-token.jpeg",
string::utf8(b"https://mycollection.com/my-named-token.jpeg"),
);
}
```
Expand Down