The Data Import plugin allows users to batch-create a single schema and any number of templates by starting with a basic spreadsheet and adding a data formatting pattern.
The benefits of this approach:
- Speed: Schemas and templates do not have to be created one-at-a-time, thus making it much faster to launch collections
- Accuracy: The use of a spreadsheet app allows for easier bulk editing when preparing a collection, and automated imports remove the possibility of manual data entry errors.
- Automation: By using a portable file format (CSV), schema/template definitions can also be created programmatically, and/or passed through any number of intermediate tools/apps.
- Integrity: Optional "validator hints" provided by the plugin can help catch mistakes such as empty or non-unique entries before the schema and templates are created.
To start, we assume you have a spreadsheet where the first row contains desired schema attribute names, and each successive row is a template to be created.
It is recommended that (at the very least) you include a name
and img
field.
This spreadsheet consists of 4 columns and 5 rows, from which 1 schema and 4 templates will be created.
name | img | points | description |
---|---|---|---|
Apple | QmY2yFqDmSPWiFbzsMeREHXyCkY5LdY62WWyYUhe5ogpmT | 5 | Crunchy round fruit |
Banana | bafkreidullbimqjiob2apauxv3tj23kupb5em3c4i5soks2svsbqrvasce | 2 | Mushy yellow fruit |
Kiwi | bafkreichwf6uollkwe55bmrvnt3744rnmn5g3boekoh62krgu2umv4qpgu | 3 | Hairy green fruit |
Cherry | QmeciM9AtHdCycNAwtWh6bAsLCaKnWjgFAg95pFuP63AGW | 8 | Red stone fruit |
There are 4 columns that must be present when importing a CSV file:
max_supply
: (whole number) the maximum number of NFTs which can be minted from the template. (set to0
for unlimited)burnable
: (TRUE
orFALSE
) recommended set toTRUE
to allow users the option to burn their NFTs.transferable
: (TRUE
orFALSE
) recommended set toTRUE
to allow users to trade their NFTs.sysflag
: leave this column blank for now.
Note: ❌ indicates cells which are to be left blank.
name | img | points | description | max_supply | burnable | transferable | sysflag |
---|---|---|---|---|---|---|---|
Apple | QmY2yFqDmSPWiFbzsMeREHXyCkY5LdY62WWyYUhe5ogpmT | 5 | Crunchy round fruit | 100 | TRUE | TRUE | ❌ |
Banana | bafkreidullbimqjiob2apauxv3tj23kupb5em3c4i5soks2svsbqrvasce | 2 | Mushy yellow fruit | 100 | TRUE | TRUE | ❌ |
Kiwi | bafkreichwf6uollkwe55bmrvnt3744rnmn5g3boekoh62krgu2umv4qpgu | 3 | Hairy green fruit | 100 | TRUE | TRUE | ❌ |
Cherry | QmeciM9AtHdCycNAwtWh6bAsLCaKnWjgFAg95pFuP63AGW | 8 | Red stone fruit | 100 | TRUE | TRUE | ❌ |
- Insert a single row between rows 1 and 2.
- In the
sysflag
column, enterdatatype
. - For each of your original columns, enter the desired datatype in this row (ignore
max_supply
,burnable
, andtransferable
).
Example data types:
string
: any text contentuint8
: whole numbers from0
to255
int16
: whole numbers from-32,768
to32,767
float
: decimal numbersimage
: IPFS image hash or URLipfs
: IPFS file hash or URLbool
: boolean values:TRUE
orFALSE
For a full list of allowed types, see Data Types.
Note: ❌ indicates cells which are to be left blank.
name | img | points | description | max_supply | burnable | transferable | sysflag |
---|---|---|---|---|---|---|---|
string | image | uint8 | string | ❌ | ❌ | ❌ | datatype |
Apple | QmY2yFqDmSPWiFbzsMeREHXyCkY5LdY62WWyYUhe5ogpmT | 5 | Crunchy round fruit | 100 | TRUE | TRUE | ❌ |
Banana | bafkreidullbimqjiob2apauxv3tj23kupb5em3c4i5soks2svsbqrvasce | 2 | Mushy yellow fruit | 100 | TRUE | TRUE | ❌ |
Kiwi | bafkreichwf6uollkwe55bmrvnt3744rnmn5g3boekoh62krgu2umv4qpgu | 3 | Hairy green fruit | 100 | TRUE | TRUE | ❌ |
Cherry | QmeciM9AtHdCycNAwtWh6bAsLCaKnWjgFAg95pFuP63AGW | 8 | Red stone fruit | 100 | TRUE | TRUE | ❌ |
mutable
:TRUE
,FALSE
- if set toTRUE
for a column, this field will not be added to the template. By default, all fields are assumed to be immutable. Ifmutable
is not added, all data will be considered immutable.
Validators are optional but recommended as they will help you capture any potential issues or mistakes in your data (e.g. missing or repeated values). Any failed validations will be reported by the Importer before anything is written to the blockchain. Futute validators may include features like "spellcheck".
required
:TRUE
orFALSE
- if set toTRUE
, the data import will fail if any values for this field are blank.unique
:TRUE
orFALSE
- if set toTRUE
, the data import will verify that all templates to be created have no duplicate values for this field.
The process of adding properties or validators is similar to adding the
required datatype
sysflag:
- Insert a new header row (e.g. after the
datatype
row but before the templates start. in the example below, two validators were added). - Enter the desired values, ignoring
max_supply
,burnable
, andtransferable
.
At this point, the spreadsheet will look something like this:
Note: ❌ indicates cells which are to be left blank.
name | img | points | description | max_supply | burnable | transferable | sysflag |
---|---|---|---|---|---|---|---|
string | image | uint8 | string | ❌ | ❌ | ❌ | datatype |
TRUE | TRUE | TRUE | TRUE | ❌ | ❌ | ❌ | required |
TRUE | TRUE | FALSE | TRUE | ❌ | ❌ | ❌ | unique |
Apple | QmY2yFqDmSPWiFbzsMeREHXyCkY5LdY62WWyYUhe5ogpmT | 5 | Crunchy round fruit | 100 | TRUE | TRUE | ❌ |
Banana | bafkreidullbimqjiob2apauxv3tj23kupb5em3c4i5soks2svsbqrvasce | 2 | Mushy yellow fruit | 100 | TRUE | TRUE | ❌ |
Kiwi | bafkreichwf6uollkwe55bmrvnt3744rnmn5g3boekoh62krgu2umv4qpgu | 3 | Hairy green fruit | 100 | TRUE | TRUE | ❌ |
Cherry | QmeciM9AtHdCycNAwtWh6bAsLCaKnWjgFAg95pFuP63AGW | 8 | Red stone fruit | 100 | TRUE | TRUE | ❌ |
The file name will determine schema name. For example, fruits.csv
would
create a schema named fruits
.
Exported to fruits.csv:
name,img,points,description,max_supply,burnable,transferable,sysflag
string,image,uint8,string,,,,datatype
TRUE,TRUE,TRUE,TRUE,,,,required
TRUE,TRUE,FALSE,TRUE,,,,unique
Apple,QmY2yFqDmSPWiFbzsMeREHXyCkY5LdY62WWyYUhe5ogpmT,5,Crunchy round fruit,100,TRUE,TRUE,
Banana,bafkreidullbimqjiob2apauxv3tj23kupb5em3c4i5soks2svsbqrvasce,2,Mushy yellow fruit,100,TRUE,TRUE,
Kiwi,bafkreichwf6uollkwe55bmrvnt3744rnmn5g3boekoh62krgu2umv4qpgu,3,Hairy green fruit,100,TRUE,TRUE,
Cherry,QmeciM9AtHdCycNAwtWh6bAsLCaKnWjgFAg95pFuP63AGW,8,Red stone fruit,100,TRUE,TRUE,
This CSV file can now be uploaded in the UI.
- In the app, navigate to your collection and click the "Plugins" tab.
- Click "Import" to bring up the data import form.
- Click "Select File" and use the CSV file you saved in the last step.
If there are any data or validation errors, the app will let you know which line numbers triggered the errors and what needs to be done to fix them.
If there were no errors detected, you will be asked to sign the transactions for creating the shema and templates.