@@ -98,12 +98,98 @@ func convertProtobufToClaim(protobuf map[int]any, transactions map[string]any) m
9898
9999 claimValue := map [string ]any {}
100100
101+ streamValue , streamOk := decodedProtobufClaimData [1 ]
102+ if streamOk {
103+ stream := streamValue .(map [int ]any )
104+
105+ sourceValue , sourceOk := stream [1 ]
106+ if sourceOk {
107+ source := map [string ]any {}
108+
109+ hashValue , hashOk := (sourceValue .(map [int ]any ))[1 ]
110+ if hashOk {
111+ hash := hex .EncodeToString (hashValue .([]uint8 ))
112+ source ["hash" ] = hash
113+ }
114+
115+ nameValue , nameOk := (sourceValue .(map [int ]any ))[2 ]
116+ if nameOk {
117+ name := string (nameValue .([]uint8 ))
118+ source ["name" ] = name
119+ }
120+
121+ mediaTypeValue , mediaTypeOk := (sourceValue .(map [int ]any ))[4 ]
122+ if mediaTypeOk {
123+ mediaType := string (mediaTypeValue .([]uint8 ))
124+ source ["media_type" ] = mediaType
125+ }
126+
127+ urlValue , urlOk := (sourceValue .(map [int ]any ))[5 ]
128+ if urlOk {
129+ url := string (urlValue .([]uint8 ))
130+ source ["url" ] = url
131+ }
132+
133+ sdHashValue , sdHashOk := (sourceValue .(map [int ]any ))[6 ]
134+ if sdHashOk {
135+ sdHash := hex .EncodeToString (sdHashValue .([]uint8 ))
136+ source ["sd_hash" ] = sdHash
137+ }
138+
139+ claimValue ["source" ] = source
140+ }
141+
142+ authorValue , authorOk := stream [2 ]
143+ if authorOk {
144+ author := string (authorValue .([]uint8 ))
145+ claimValue ["author" ] = author
146+ }
147+
148+ licenseValue , licenseOk := stream [3 ]
149+ if licenseOk {
150+ license := string (licenseValue .([]uint8 ))
151+ claimValue ["license" ] = license
152+ }
153+
154+ licenseURLValue , licenseURLOk := stream [4 ]
155+ if licenseURLOk {
156+ licenseURL := string (licenseURLValue .([]uint8 ))
157+ claimValue ["license_url" ] = licenseURL
158+ }
159+
160+ // Temporary
161+ claimValue ["stream_type" ] = "document"
162+
163+ _ , hasStreamTypeImage := stream [10 ]
164+ if hasStreamTypeImage {
165+ claimValue ["stream_type" ] = "image"
166+ }
167+ _ , hasStreamTypeVideo := stream [11 ]
168+ if hasStreamTypeVideo {
169+ claimValue ["stream_type" ] = "video"
170+ }
171+ _ , hasStreamTypeAudio := stream [11 ]
172+ if hasStreamTypeAudio {
173+ claimValue ["stream_type" ] = "audio"
174+ }
175+ _ , hasStreamTypeSoftware := stream [13 ]
176+ if hasStreamTypeSoftware {
177+ claimValue ["stream_type" ] = "software"
178+ }
179+ }
180+
101181 titleValue , titleOk := decodedProtobufClaimData [8 ]
102182 if titleOk {
103183 title := string (titleValue .([]uint8 ))
104184 claimValue ["title" ] = title
105185 }
106186
187+ descriptionValue , descriptionOk := decodedProtobufClaimData [9 ]
188+ if descriptionOk {
189+ description := string (descriptionValue .([]uint8 ))
190+ claimValue ["description" ] = description
191+ }
192+
107193 thumbnailValue , thumbnailOk := decodedProtobufClaimData [10 ]
108194 if thumbnailOk {
109195 thumbnail := map [string ]any {}
@@ -128,5 +214,25 @@ func convertProtobufToClaim(protobuf map[int]any, transactions map[string]any) m
128214
129215 claim ["value" ] = claimValue
130216
217+ _ , hasClaimTypeStream := decodedProtobufClaimData [1 ]
218+ if hasClaimTypeStream {
219+ claim ["value_type" ] = "stream"
220+ }
221+ _ , hasClaimTypeChannel := decodedProtobufClaimData [2 ]
222+ if hasClaimTypeChannel {
223+ claim ["value_type" ] = "channel"
224+ }
225+ _ , hasClaimTypeCollection := decodedProtobufClaimData [3 ]
226+ if hasClaimTypeCollection {
227+ claim ["value_type" ] = "collection"
228+ }
229+ _ , hasClaimTypeRepost := decodedProtobufClaimData [4 ]
230+ if hasClaimTypeRepost {
231+ claim ["value_type" ] = "repost"
232+ }
233+
234+ // claim["_1"] = protobuf
235+ // claim["_2"] = decodedProtobufClaimData
236+
131237 return claim
132238}
0 commit comments