-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Updated Metadata Upload feature with compatible format
- Loading branch information
Showing
7 changed files
with
108 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace NFTPort.Internal | ||
{ | ||
|
||
/// <summary> | ||
/// To Process custom field attributes list | ||
/// </summary> | ||
public static class ProcessMetadataToUpload | ||
{ | ||
public static Storage_MetadataToUpload_processedModel ConvertCustomFieldsListToDict(Storage_MetadataToUpload_model metadata) | ||
{ | ||
Dictionary<string, string> dctn = new Dictionary<string, string>(); | ||
Storage_MetadataToUpload_processedModel processedModel = new Storage_MetadataToUpload_processedModel(); | ||
foreach (var custom_field in metadata.custom_fields) | ||
{ | ||
dctn.Add(custom_field.key, custom_field.value); | ||
} | ||
|
||
processedModel.animation_url = metadata.animation_url; | ||
processedModel.attributes = metadata.attributes; | ||
processedModel.custom_fields = dctn; | ||
processedModel.description = metadata.description; | ||
processedModel.external_url = metadata.external_url; | ||
processedModel.name = metadata.name; | ||
processedModel.file_url = metadata.file_url; | ||
|
||
return processedModel; | ||
} | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
Runtime/Internal/Storage_MetadataToUpload_processedModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using UnityEngine; | ||
|
||
namespace NFTPort.Internal | ||
{ | ||
[Serializable] | ||
public class Storage_MetadataToUpload_processedModel | ||
{ | ||
[Tooltip("URL of the file that you wish to link with the metadata and turn into an NFT., use 'Storage File Upload' to get url")] | ||
public string file_url = "Required Field"; | ||
public string name = "Required Field"; | ||
public string description = "Required Field"; | ||
|
||
[DefaultValue("")][Tooltip("URL that will appear below the NFT on some of the NFT marketplaces such as OpenSea.")] | ||
public string external_url; | ||
|
||
[DefaultValue("")][Tooltip("URL to a multimedia attachment with all filetypes supported. If you want to make sure the file is supported by OpenSea, then see their docs. When using animation_url, set the file_url as the multimedia preview which will be displayed on the NFT marketplaces e.g. if your animation_url is a video then set file_url as the preview image for it.")] | ||
public string animation_url; | ||
|
||
[DefaultValue(null)] | ||
[Tooltip( | ||
"Allows you to extend the metadata schema with your own arbitrary fields. You can pass anything here as long as it is follows “key”: “value” format inside a dictionary. All of the fields will be flattened and added to the top-level namespace e.g. like name, description, etc. ")] | ||
public Dictionary<string, string> custom_fields; | ||
|
||
[DefaultValue(null)] | ||
public List<Attribute> attributes; | ||
|
||
} | ||
} | ||
|
3 changes: 3 additions & 0 deletions
3
Runtime/Internal/Storage_MetadataToUpload_processedModel.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
42 changes: 21 additions & 21 deletions
42
Runtime/Internal/models/Storage_MetadataToUpload_model.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
using System.Collections; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Dynamic; | ||
using Newtonsoft.Json; | ||
using UnityEngine; | ||
|
||
namespace NFTPort | ||
{ | ||
[System.Serializable] | ||
[Serializable] | ||
public class Storage_MetadataToUpload_model | ||
{ | ||
[Tooltip("Main NFT File URL, use 'Storage File Upload' to get url")] | ||
[Tooltip("URL of the file that you wish to link with the metadata and turn into an NFT., use 'Storage File Upload' to get url")] | ||
public string file_url = "Required Field"; | ||
public string name = "Required Field"; | ||
public string description = "Required Field"; | ||
[DefaultValue("-99")][Tooltip("Set to -99 to exclude in metadata")] | ||
public int edition; | ||
[DefaultValue(null)] | ||
public List<Trait> traits; | ||
[DefaultValue(null)] | ||
public List<Attribute> attributes; | ||
[DefaultValue("")] | ||
public string compiler; | ||
[DefaultValue("")] | ||
public string background_color; | ||
[DefaultValue("")] | ||
|
||
[DefaultValue("")][Tooltip("URL that will appear below the NFT on some of the NFT marketplaces such as OpenSea.")] | ||
public string external_url; | ||
[DefaultValue("")] | ||
|
||
[DefaultValue("")][Tooltip("URL to a multimedia attachment with all filetypes supported. If you want to make sure the file is supported by OpenSea, then see their docs. When using animation_url, set the file_url as the multimedia preview which will be displayed on the NFT marketplaces e.g. if your animation_url is a video then set file_url as the preview image for it.")] | ||
public string animation_url; | ||
[DefaultValue("")] | ||
public string dna; | ||
[DefaultValue("")] | ||
public string id; | ||
|
||
[DefaultValue(null)][Tooltip("Allows you to extend the metadata schema with your own arbitrary fields. You can pass anything here as long as it is follows “key”: “value” format inside a dictionary. All of the fields will be flattened and added to the top-level namespace e.g. like name, description, etc. ")] | ||
public List<custom_fields> custom_fields; | ||
|
||
[DefaultValue(null)] | ||
public List<Attribute> attributes; | ||
|
||
} | ||
|
||
[Serializable] | ||
public class custom_fields | ||
{ | ||
public string key; | ||
public string value; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters