- Install packages with
yarn
,npm i
,pnpm i
or your favorite package manager. This example usespnpm
. - Test contracts compile:
pnpm hardhat compile
- Check contract size:
pnpm hardhat size-contracts
- Run tests:
pnpm test
- Run prettier:
pnpm prettier
- Copy
.env.example
into.env
and set your variables - Use
contracts/
,tests/
andscripts/
to build your code.
- On a separate terminal, start a local hardhat node:
pnpm hardhat node
- Deploy:
pnpm hardhat run scripts/deploy.ts --network localhost
- Optionally deploy utils, to do tests locally.
pnpm hardhat run scripts/deployUtils.ts --network localhost
- Deploy on testnet:
pnpm hardhat run scripts/deploy.ts --network NETWORK
- If you did not verify the contracts in the script, you can do it using the contract address and arguments you used to deploy previous step:
pnpm hardhat verify YOUR_CONTRACT_ADDRESS --network NETWORK --contract contracts/YOUR_CONTRACT_NAME.sol:YOUR_CONTRACT_NAME [ARGUMENTS_HERE]
// Example:
pnpm hardhat verify 0x5FbDB2315678afecb367f032d93F642f64180aa3 --network sepolia --contract contracts/SimpleEquippable.sol:SimpleEquippable 'ipfs://collectionMeta.json', 'ipfs://baseURI/' ...
Remember to give credit to RMRK if you're using it's technology. Check the license and notice for more details.
You can emote to an NFT from the account that you have configured in your .env
file with the PRIVATE_KEY
variable. To do so you must simply call:
pnpm hardhat emotes:emote CONTRACT_ADDRESS TOKEN_ID EMOTE [ENABLE] --network NETWORK
For example, to send a π emote to the token Id 15
on collection 0x5FbDB2315678afecb367f032d93F642f64180aa3
and sepolia network, you would call:
pnpm hardhat emotes:emote 0x5FbDB2315678afecb367f032d93F642f64180aa3 15 'π' --network sepolia
To remove it you would call:
pnpm hardhat emotes:emote 0x5FbDB2315678afecb367f032d93F642f64180aa3 15 π false --network sepolia
You can also send emotes in bulk, the collection and enable parameters are used for all emotes, the token ids and emotes must be comma separated and have the same length. To do so you must simply call:
pnpm hardhat emotes:bulkEmote CONTRACT_ADDRESS TOKEN_IDS EMOTES [ENABLE] --network NETWORK
For example, to send a π emote to the token Id 15
and a π emote to the token Id 16
on collection 0x5FbDB2315678afecb367f032d93F642f64180aa3
and sepolia network, you would call:
pnpm hardhat emotes:bulkEmote 0x5FbDB2315678afecb367f032d93F642f64180aa3 '15,16' 'π,π' --network sepolia
To remove it you would call:
pnpm hardhat emotes:bulkEmote 0x5FbDB2315678afecb367f032d93F642f64180aa3 '15,16' 'π,π' false --network sepolia
You can use token repository to store your tokens's attributes. This is a draft feature so the final address will change, for now it is only deployed on a few test networks. Contact us through our implementers telegram group if you want us to deploy in another network.
To use it, you must first configure the attribute, you can do so by calling:
pnpm hardhat attributes:configure CONTRACT_ADDRESS ATTRIBUTE_NAME ACCESS_TYPE [SPECIFIC_ADDRESS] [--first-time true] --network NETWORK
Access type defines who can write to the attribute:
- 0: Issuer
- 1: Collaborator
- 2: IssuerOrCollaborator
- 3: TokenOwner
- 4: SpecificAddress. In this case you must specify in the fourth argument.
The first time you configure an attribute you will also need to register access control. This might removed from the final version, but for now you can do so by adding the --first-time
flag to the command.
If we want to configure the name attribute on collection 0x5FbDB2315678afecb367f032d93F642f64180aa3
to be written by the token owner, we would call (with the collection owner account):
pnpm hardhat attributes:configure 0xd536FC5918117776064AEF0b2e7b126D63d697F3 name 3 --first-time true --network baseSepolia
Then, to set the attribute, you can call:
pnpm hardhat attributes:set CONTRACT_ADDRESS TOKEN_ID TYPE ATTRIBUTE_NAME ATTRIBUTE_VALUE --network NETWORK
Type is the type of the attribute, options are: 'boolean', 'uint', 'int', 'string', 'address', 'bytes'. For example, to set the name of the token 15
on collection 0x5FbDB2315678afecb367f032d93F642f64180aa3
to be "My Token" you would call, in this case with the token holder account:
pnpm hardhat attributes:set 0x5FbDB2315678afecb367f032d93F642f64180aa3 15 string name 'My Token' --network sepolia
To get the attribute, you can call:
pnpm hardhat attributes:get CONTRACT_ADDRESS TOKEN_ID TYPE ATTRIBUTE_NAME --network NETWORK
For example, to get the name of the token 15
on collection 0x5FbDB2315678afecb367f032d93F642f64180aa3
you would call:
pnpm hardhat attributes:get 0x5FbDB2315678afecb367f032d93F642f64180aa3 15 string name --network sepolia
This package provides a way to generate metadata for collections, tokens, assets, catalogs, fixed parts and slot parts. For not it is individual but we plan to add a way to generate them from a csv file where needed.
The scripts will generate all the metadata under a metadata directory on the root of the project, and subfolders per collection. Some scripts include a COLLECTION_SLUG argument, this is used to create a subfolder for the collection metadata.
You do not need to create any folder, the scripts will do it for you. You can use the following commands to generate metadata.
Basic usage:
pnpm hardhat metadata:collection COLLECTION_SLUG NAME DESCRIPTION MEDIA_URI [--animation-uri <STRING>] [--external-uri <STRING>] [--license <STRING>] [--license-uri <STRING>] [--tags <STRING>] [--thumbnail-uri <STRING>]
Example:
pnpm hardhat metadata:collection backgrounds "Kanaria Community Backgrounds" "Created by 3 artists" "ipfs://collection-image-uri" --thumbnail-uri "ipfs://collection-image-thumb-uri"
See pnpm hardhat metadata:collection --help
for a detailed description of each parameter.
You can also create the metadata for multiple collections using a csv file. See 'metadata/collections.csv' for an example. This file is used by default but you can also pass a different path as an argument.
Basic usage:
pnpm hardhat metadata:collections-csv [CSV_FILE_PATH] [--base-uri <STRING>] [--external-uri <STRING>] [--license <STRING>] [--license-uri <STRING>]
Example:
pnpm hardhat metadata:collections-csv metadata/collections.csv
See pnpm hardhat metadata:collections-csv --help
for a detailed list of arguments.
Basic usage:
pnpm hardhat metadata:token COLLECTION_SLUG FILE_NAME NAME DESCRIPTION MEDIA_URI [--animation-uri <STRING>] [--attributes <STRING>] [--external-uri <STRING>] [--license <STRING>] [--license-uri <STRING>] [--thumbnail-uri <STRING>]
Example:
pnpm hardhat metadata:token backgrounds 1 "Mystical Background" "A mystical background" "ipfs://token-image-uri" --attributes "Max units:number:1,Artist:string:winner"
See pnpm hardhat metadata:token --help
for a detailed list of arguments.
You can also create the metadata for multiple tokens using a csv file. See 'metadata/tokens.csv' for an example. This file is used by default but you can also pass a different path as an argument.
Basic usage:
pnpm hardhat metadata:tokens-csv COLLECTION_SLUG [CSV_FILE_PATH] [--base-uri <STRING>] [--external-uri <STRING>] [--license <STRING>] [--license-uri <STRING>]
Example:
pnpm hardhat metadata:tokens-csv backgrounds metadata/tokens.csv
See pnpm hardhat metadata:tokens-csv --help
for a detailed list of arguments.
Basic usage:
pnpm hardhat metadata:asset COLLECTION_SLUG FILE_NAME NAME DESCRIPTION MEDIA_URI [--attributes <STRING>] [--external-uri <STRING>] [--license <STRING>] [--license-uri <STRING>] [--thumbnail-uri <STRING>]
Example:
pnpm hardhat metadata:asset backgrounds 001 "Mystical Background" "A mystical background" "ipfs://token-image-uri" --attributes "Max units:number:1,Artist:string:winner"
See pnpm hardhat metadata:asset --help
for a detailed list of arguments.
You can also create the metadata for multiple assets using a csv file. See 'metadata/assets.csv' for an example. This file is used by default but you can also pass a different path as an argument.
Basic usage:
pnpm hardhat metadata:assets-csv COLLECTION_SLUG [CSV_FILE_PATH] [--base-uri <STRING>] [--external-uri <STRING>] [--license <STRING>] [--license-uri <STRING>]
Example:
pnpm hardhat metadata:assets-csv backgrounds metadata/assets.csv
See pnpm hardhat metadata:assets-csv --help
for a detailed list of arguments.
Basic usage:
pnpm hardhat metadata:catalog NAME DESCRIPTION
Example:
pnpm hardhat metadata:catalog "Kanaria Catalog" "A catalog with assets of mystical creatures"
See pnpm hardhat metadata:catalog --help
for a detailed list of arguments.
Basic usage:
pnpm hardhat metadata:fixed-part NAME MEDIA_URI [DESCRIPTION]
Example:
pnpm hardhat metadata:fixed-part "Left Fire Wing" "ipfs://fixedpart-image-uri"
See pnpm hardhat metadata:fixed-part --help
for a detailed list of arguments.
You can also create the metadata for multiple fixed parts using a csv file. See 'metadata/fixed-parts.csv' for an example. This file is used by default but you can also pass a different path as an argument.
Basic usage:
pnpm hardhat metadata:fixed-parts-csv [CSV_FILE_PATH] [--base-uri <STRING>]
Example:
pnpm hardhat metadata:fixed-parts-csv metadata/fixed-parts.csv
See pnpm hardhat metadata:fixed-parts-csv --help
for a detailed list of arguments.
Basic usage:
pnpm hardhat metadata:slot-part NAME [--description <STRING>] [--fallback-media-uri <STRING>]
Example with no fallback:
pnpm hardhat metadata:slot-part "Left Wing Item" --description "A slot on the left wing to hold items"
Example with fallback, rendered if nothing is equipped in the slot:
pnpm hardhat metadata:slot-part "Background" --fallback-media-uri "ipfs://fallback-image-uri"
See pnpm hardhat metadata:slot-part --help
for a detailed list of arguments.
You can also create the metadata for multiple slot parts using a csv file. See 'metadata/slot-parts.csv' for an example. This file is used by default but you can also pass a different path as an argument.
Basic usage:
pnpm hardhat metadata:slot-parts-csv [CSV_FILE_PATH] [--base-uri <STRING>]
Example:
pnpm hardhat metadata:slot-parts-csv metadata/slot-parts.csv
See pnpm hardhat metadata:slot-parts-csv --help
for a detailed list of arguments.