(mint-single-token (data {price: uint, for-sale: bool}) (metadata (string-ascii 256)) (royalties (optional (list 5 {address: principal, percentage: uint}))))
- data: tuple: {price: uint, for-sale: bool}
- metadata: string-ascii 256
- royalties: optional: list of tuples (max len 5): {address: principal, percentage: uint}
- On success:
token-id
- On error:
error-id
Mints a single NFT. token-id
defined in contract as 1 + last-token-id
.
Range of possible token-id
s for single tokens is u10000000001
to u19999999999
.
Note: minimum token price is u10000
- Token with 2 royalties:
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main mint-single-token {price: u100, for-sale: true} "ipfs://abcalsjdhf" (some (list {address: 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA, percentage: u1000} {address: 'STEB8ZW46YZJ40E3P7A287RBJFWPHYNQ2AB5ECT8, percentage: u2000})))
- Token with no royalties:
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main mint-single-token {price: u100, for-sale: true} "ipfs://abcalsjdhf" none)
(mint-collection (files (optional (list 100 {metadata: (string-ascii 256), data: {price: uint, for-sale: bool}}))) (royalties (optional (list 5 {address: principal, percentage: uint}))))
- files: optional: list of tuples (max len 100): {metadata: (string-ascii 256), data: {price: uint, for-sale: bool}, royalties: optional: list of tuples (max len 5): {address: principal, percentage: uint}}
- On success:
collection-id
- On error:
error-id
Creates a new Collection of NFTs. Automatically generates a collection-id
defined as 1 + last-collection-id
.
Range of possible collection-id
s is u200001
to u999999
.
Automatically generates file-id
s for each file passed in defined as 1 + last-file-id
.
Range of possible file-id
s is u00001
to u99999
.
Finally, for each file, a unique token-id
is generated defined as collection-id * u100000 + file-id
.
E.g token-id: u20004800087
refers to the 87th file in the 48th collection.
Note: minimum token price is u10000
- Initialize empty collection
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main mint-collection none)
- Collection with 3 files:
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main mint-collection (some (list {data: {price: u100000, for-sale: true}, metadata: "ipfs://first", royalties: (some (list {address: 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA, percentage: u1000}))} {data: {price: u100, for-sale: true}, metadata: "ipfs://second", royalties: (some (list {address: 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA, percentage: u2000}))} {data: {price: u10000, for-sale: false}, metadata: "ipfs://third", royalties: (some (list {address: 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA, percentage: u3000}))})))
(mint-to-collection (collection-id uint) (data {price: uint, for-sale: bool}) (metadata (string-ascii 256)) (royalties (optional (list 5 {address: principal, percentage: uint}))))
- collection-id: uint
- data: tuple: {price: uint, for-sale: bool}
- metadata: string-ascii 256
- royalties: optional: list of tuples (max len 5): {address: principal, percentage: uint}
- On success:
token-id
- On error:
error-id
Mints NFT and adds it to Collection. Only succeeds if invoked by the creator of Collection. Note: minimum token price is u10000
- Mint NFT to collection with
collection-id: u200021
, without royalties:
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main mint-to-collection u200021 {price: u500, for-sale: true} "ipfs://fourth" none)
- Mint two NFTs to collection with
collection-id: u200123
, with two royalties:
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main mint-to-collection u200021 (list { metadata: "ipfs://fourth", data: { price: u500, for-sale: true }, royalties: (some (list {address: 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA, percentage: u1000} {address: 'STEB8ZW46YZJ40E3P7A287RBJFWPHYNQ2AB5ECT8, percentage: u2000})) } { metadata: "ipfs://fourth", data: { price: u500, for-sale: true }, royalties: (some (list {address: 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA, percentage: u1000} {address: 'STEB8ZW46YZJ40E3P7A287RBJFWPHYNQ2AB5ECT8, percentage: u2000})) } ))
(purchase (token-id uint))
- token-id: uint
- On success:
true
- On error:
error-id
Allows a user to purchase another user's NFT. Executes only if purchaser is not owner and if NFT is set as for sale.
- Purchase NFT with token ID u10000000123
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main purchase u10000000123)
(complete-sale (token-id uint) (new-owner-address principal) (old-owner-address principal) (token-price uint))
- token-id: uint
- new-owner-address: principal
- old-owner-address: principal
- token-price: uint
- On success:
true
- On error:
error-id
Admin only functionality that enables USD purchasing and auction flows. Allows admin to manually set sale price, old owner and new owner to distribute royalties, STX transfers and NFT transfer to the right users. Ownership of NFT must first be transferred to admin.
- Complete sale for NFT with token-id u10000000001 with sale price of 2 STX
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main complete-sale u10000000001 'ST3DG3R65C9TTEEW5BC5XTSY0M1JM7NBE7GVWKTVJ 'STEB8ZW46YZJ40E3P7A287RBJFWPHYNQ2AB5ECT8 u2000000)
(set-token-price-data (token-id uint) (price uint) (for-sale bool))
- token-id: uint
- price: uint
- for-sale: bool
- On success:
true
- On error:
error-id
Allows owner of NFT to change price and toggle whether the NFT is available for purchase.
- Set price of NFT with token-id u20002100003 to 3 STX and make NFT available for sale.
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main set-token-price-data u20002100003 u3000000 true)
(transfer (token-id uint) (owner principal) (recipient principal))
- token-id: uint
- owner: principal
- recipient: principal
- On success:
true
- On error:
error-id
SIP-009 function. Allows owner of NFT to transfer ownership of NFT to another address.
- Trasnfer ownership of NFT with token id u20002100003 from 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA to 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE
(contract-call? 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.main transfer u20002100003 'STFCVYY1RJDNJHST7RRTPACYHVJQDJ7R1DWTQHQA 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE)
(get-all-token-data (token-id uint))
(get-collection-data (collection-id uint))
(get-owner (token-id uint))
(get-last-token-id)
(get-token-uri (token-id uint))