Skip to content

Commit

Permalink
Fix: tags and creators
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Apr 9, 2021
1 parent cc76805 commit c08e184
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions internal/parsers/tzip/tokens/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,14 @@ func (m *TokenMetadata) Merge(second *TokenMetadata) {
func getStringArrayKey(data map[string]interface{}, keyName string) []string {
if val, ok := data[keyName]; ok {
delete(data, keyName)
if s, ok := val.([]string); ok {
return s
if s, ok := val.([]interface{}); ok {
arr := make([]string, 0)
for i := range s {
if data, ok := s[i].(string); ok {
arr = append(arr, data)
}
}
return arr
}
}
return nil
Expand Down
4 changes: 3 additions & 1 deletion internal/parsers/tzip/tokens/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func TestTokenMetadata_UnmarshalJSON(t *testing.T) {
Decimals: int64Ptr(0),
Description: "A most mysterious map has been discovered. Where it leads is uncertain, but an adventure lies ahead.",
DisplayURI: "https://gateway.pinata.cloud/ipfs/QmPkJBaRnb2JwqA1S2sUQayTV9xT3x8MBnsmq7ForBWKuU",
Creators: []string{"test", "author"},
Extras: map[string]interface{}{
"nonTransferable": false,
"symbolPreference": false,
Expand All @@ -233,7 +234,8 @@ func TestTokenMetadata_UnmarshalJSON(t *testing.T) {
"booleanAmount": false,
"displayUri": "https://gateway.pinata.cloud/ipfs/QmPkJBaRnb2JwqA1S2sUQayTV9xT3x8MBnsmq7ForBWKuU",
"defaultPresentation": "large",
"actionLabel": "Send"
"actionLabel": "Send",
"creators": ["test", "author"]
}`),
}, {
name: "test ipfs 2",
Expand Down

0 comments on commit c08e184

Please sign in to comment.