-
Notifications
You must be signed in to change notification settings - Fork 19
/
nft.go
52 lines (46 loc) · 1.47 KB
/
nft.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package types
type InscriptionMigrationData struct {
Header []string `json:"header"`
Rows [][]string `json:"rows"`
Collection string `json:"collection"`
}
type Trait struct {
TraitType string `json:"trait_type"`
Value string `json:"value"`
}
type NftMetadata struct {
Name string `json:"name"`
Description string `json:"description"`
Mime string `json:"mime"`
Attributes []Trait `json:"attributes"`
}
type CollectionMetadata struct {
Name string `json:"name"`
Description string `json:"description"`
Mime string `json:"mime"`
Symbol string `json:"symbol"`
Minter string `json:"minter,omitempty"`
RoyaltyPercentage float32 `json:"royalty_percentage,omitempty"`
PaymentAddress string `json:"payment_address,omitempty"`
Twitter string `json:"twitter,omitempty"`
Telegram string `json:"telegram,omitempty"`
Discord string `json:"discord,omitempty"`
Website string `json:"website,omitempty"`
}
type InscriptionNftMetadata struct {
Parent InscriptionMetadataParent `json:"parent"`
Metadata NftMetadata `json:"metadata"`
}
func GetTraits(attributeNames []string, row []string) []Trait {
traits := make([]Trait, 0)
for i, attribute := range attributeNames {
if attribute != "" && row[i] != "" {
trait := Trait{
TraitType: attribute,
Value: row[i],
}
traits = append(traits, trait)
}
}
return traits
}