cryptopunks 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +4 -0
- data/Rakefile +1 -0
- data/lib/cryptopunks/contract/punksdata-assets.rb +338 -0
- data/lib/cryptopunks/contract/punksdata-contract.rb +55 -0
- data/lib/cryptopunks/contract/punksdata-meta.rb +2107 -0
- data/lib/cryptopunks/generator.rb +3 -0
- data/lib/cryptopunks/tool.rb +264 -0
- data/lib/cryptopunks/version.rb +2 -2
- data/lib/cryptopunks.rb +13 -78
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d5d23ce2a1fab0409c2c0e673aba9beeede74e54bb63eb0099d101d818b0911
|
4
|
+
data.tar.gz: fa35f796d658dcccd75b61ed156c63a60530c3a43b9117bc8607b7b297736559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad3b33c1b0ddea2bc64f98ff14c4e8d3ffac2d541026d4b473bfbf3f99a97dd29157e5d424bcdff27f59748fa75ae6910c06ba6366d6e69fa8210bbacdf75a8
|
7
|
+
data.tar.gz: 1b08e99c346d5f14b6f7c70325a253f79f2d02d558039a617367181e96c52a8ee7731491f84081b903cf001f48a6449c4fdb01403b9aad12020cf231aaef8dc8
|
data/Manifest.txt
CHANGED
@@ -10,8 +10,12 @@ lib/cryptopunks.rb
|
|
10
10
|
lib/cryptopunks/attributes.rb
|
11
11
|
lib/cryptopunks/colors.rb
|
12
12
|
lib/cryptopunks/composite.rb
|
13
|
+
lib/cryptopunks/contract/punksdata-assets.rb
|
14
|
+
lib/cryptopunks/contract/punksdata-contract.rb
|
15
|
+
lib/cryptopunks/contract/punksdata-meta.rb
|
13
16
|
lib/cryptopunks/dataset.rb
|
14
17
|
lib/cryptopunks/generator.rb
|
15
18
|
lib/cryptopunks/image.rb
|
16
19
|
lib/cryptopunks/structs.rb
|
20
|
+
lib/cryptopunks/tool.rb
|
17
21
|
lib/cryptopunks/version.rb
|
data/Rakefile
CHANGED
@@ -0,0 +1,338 @@
|
|
1
|
+
|
2
|
+
class CryptopunksData
|
3
|
+
|
4
|
+
|
5
|
+
ASSETS_ENCODED = [
|
6
|
+
|
7
|
+
####################
|
8
|
+
## 11 archetypes - 4 (human) male, 4 (human) female,
|
9
|
+
## 1 zombie (male),
|
10
|
+
## 1 ape (male),
|
11
|
+
## 1 alien (male)
|
12
|
+
{ id: 1, name: "Male 1" },
|
13
|
+
{ id: 2, name: "Male 2" },
|
14
|
+
{ id: 3, name: "Male 3" },
|
15
|
+
{ id: 4, name: "Male 4" },
|
16
|
+
|
17
|
+
{ id: 5, name: "Female 1" },
|
18
|
+
{ id: 6, name: "Female 2" },
|
19
|
+
{ id: 7, name: "Female 3" },
|
20
|
+
{ id: 8, name: "Female 4" },
|
21
|
+
|
22
|
+
{ id: 9, name: "Zombie" },
|
23
|
+
{ id: 10, name: "Ape" },
|
24
|
+
{ id: 11, name: "Alien" },
|
25
|
+
|
26
|
+
#####################
|
27
|
+
## 122 attributes
|
28
|
+
##
|
29
|
+
|
30
|
+
## note: all female attributes start with attribute 75 to 133
|
31
|
+
## 75,76,77,78,79,
|
32
|
+
## 80,81,82,83,84,85,86,87,88,89,
|
33
|
+
## 90,91,92,93,94,95,96,97,98,99,
|
34
|
+
## 100,101,102,103,104,105,106,107,108,109,
|
35
|
+
## 110,111,112,113,114,115,116,117,118,119,
|
36
|
+
## 120,121,122,123,124,125,126,127,128,129,
|
37
|
+
## 130,131,132,133]
|
38
|
+
|
39
|
+
|
40
|
+
## Rosy Cheeks | 128 ( 1.28 %) | Male (67) · Female (60) · Zombie (1)
|
41
|
+
{ id: 12, name: "Rosy Cheeks" },
|
42
|
+
{ id: 128, name: "Rosy Cheeks" },
|
43
|
+
|
44
|
+
## Luxurious Beard | 286 ( 2.86 %) | Male (281) · Zombie (5)
|
45
|
+
{ id: 13, name: "Luxurious Beard" },
|
46
|
+
|
47
|
+
## Clown Hair Green | 148 ( 1.48 %) | Male (85) · Female (63)
|
48
|
+
{ id: 14, name: "Clown Hair Green" },
|
49
|
+
{ id: 104, name: "Clown Hair Green" },
|
50
|
+
|
51
|
+
## Mohawk Dark | 429 ( 4.29 %) | Male (279) · Female (146) · Zombie (4)
|
52
|
+
{ id: 15, name: "Mohawk Dark" },
|
53
|
+
{ id: 130, name: "Mohawk Dark" },
|
54
|
+
|
55
|
+
## Cowboy Hat | 142 ( 1.42 %) | Male (139) · Ape (2) · Alien (1)
|
56
|
+
{ id: 16, name: "Cowboy Hat" },
|
57
|
+
|
58
|
+
## Mustache | 288 ( 2.88 %) | Male (286) · Zombie (2)
|
59
|
+
{ id: 17, name: "Mustache" },
|
60
|
+
|
61
|
+
## Clown Nose | 212 ( 2.12 %) | Male (134) · Female (76) · Zombie (2)
|
62
|
+
{ id: 18, name: "Clown Nose" },
|
63
|
+
{ id: 109, name: "Clown Nose" },
|
64
|
+
|
65
|
+
## Cigarette | 961 ( 9.61 %) | Male (557) · Female (392) · Zombie (11) · Ape (1)
|
66
|
+
{ id: 19, name: "Cigarette" },
|
67
|
+
{ id: 115, name: "Cigarette" },
|
68
|
+
|
69
|
+
## Nerd Glasses | 572 ( 5.72 %) | Male (392) · Female (175) · Zombie (3) · Ape (2)
|
70
|
+
{ id: 20, name: "Nerd Glasses" },
|
71
|
+
{ id: 89, name: "Nerd Glasses" },
|
72
|
+
|
73
|
+
## Regular Shades | 527 ( 5.27 %) | Male (393) · Female (128) · Zombie (4) · Ape (1) · Alien (1)
|
74
|
+
{ id: 21, name: "Regular Shades" },
|
75
|
+
{ id: 82, name: "Regular Shades" },
|
76
|
+
|
77
|
+
## Knitted Cap | 419 ( 4.19 %) | Male (305) · Female (101) · Zombie (7) · Ape (4) · Alien (2)
|
78
|
+
{ id: 22, name: "Knitted Cap" },
|
79
|
+
{ id: 113, name: "Knitted Cap" },
|
80
|
+
|
81
|
+
## Shadow Beard | 526 ( 5.26 %) | Male (516) · Zombie (10)
|
82
|
+
{ id: 23, name: "Shadow Beard" },
|
83
|
+
|
84
|
+
## Frown | 261 ( 2.61 %) | Male (257) · Zombie (4)
|
85
|
+
{ id: 24, name: "Frown" },
|
86
|
+
|
87
|
+
## Cap Forward | 254 ( 2.54 %) | Male (248) · Zombie (3) · Ape (2) · Alien (1)
|
88
|
+
{ id: 25, name: "Cap Forward" },
|
89
|
+
|
90
|
+
## Goat | 295 ( 2.95 %) | Male (292) · Zombie (3)
|
91
|
+
{ id: 26, name: "Goat" },
|
92
|
+
|
93
|
+
## Mole | 644 ( 6.44 %) | Male (357) · Female (285) · Zombie (2)
|
94
|
+
{ id: 27, name: "Mole" },
|
95
|
+
{ id: 85, name: "Mole" },
|
96
|
+
|
97
|
+
## Purple Hair | 165 ( 1.65 %) | Male (163) · Zombie (2)
|
98
|
+
{ id: 28, name: "Purple Hair" },
|
99
|
+
|
100
|
+
## Small Shades | 378 ( 3.78 %) | Male (372) · Alien (2) · Zombie (2) · Ape (2)
|
101
|
+
{ id: 29, name: "Small Shades" },
|
102
|
+
|
103
|
+
## Shaved Head | 300 ( 3.00 %) | Male (298) · Zombie (2)
|
104
|
+
{ id: 30, name: "Shaved Head" },
|
105
|
+
|
106
|
+
## Classic Shades | 502 ( 5.02 %) | Male (345) · Female (154) · Zombie (3)
|
107
|
+
{ id: 31, name: "Classic Shades" },
|
108
|
+
{ id: 102, name: "Classic Shades" },
|
109
|
+
|
110
|
+
## Vape | 272 ( 2.72 %) | Male (161) · Female (110) · Ape (1)
|
111
|
+
{ id: 32, name: "Vape" },
|
112
|
+
{ id: 120, name: "Vape" },
|
113
|
+
|
114
|
+
## Silver Chain | 156 ( 1.56 %) | Male (113) · Female (43)
|
115
|
+
{ id: 33, name: "Silver Chain" },
|
116
|
+
{ id: 133, name: "Silver Chain" },
|
117
|
+
|
118
|
+
## Smile | 238 ( 2.38 %) | Male (234) · Zombie (4)
|
119
|
+
{ id: 34, name: "Smile" },
|
120
|
+
|
121
|
+
## Big Shades | 535 ( 5.35 %) | Male (372) · Female (159) · Zombie (3) · Ape (1)
|
122
|
+
{ id: 35, name: "Big Shades" },
|
123
|
+
{ id: 124, name: "Big Shades" },
|
124
|
+
|
125
|
+
## Mohawk Thin | 441 ( 4.41 %) | Male (285) · Female (152) · Zombie (4)
|
126
|
+
{ id: 36, name: "Mohawk Thin" },
|
127
|
+
{ id: 117, name: "Mohawk Thin" },
|
128
|
+
|
129
|
+
## Beanie | 44 ( 0.44 %) | Male (43) · Zombie (1)
|
130
|
+
{ id: 37, name: "Beanie" },
|
131
|
+
|
132
|
+
## Cap | 351 ( 3.51 %) | Male (245) · Female (98) · Ape (4) · Zombie (3) · Alien (1)
|
133
|
+
{ id: 38, name: "Cap" },
|
134
|
+
{ id: 105, name: "Cap" },
|
135
|
+
|
136
|
+
## Clown Eyes Green | 382 ( 3.82 %) | Female (246) · Male (136)
|
137
|
+
{ id: 39, name: "Clown Eyes Green" },
|
138
|
+
{ id: 114, name: "Clown Eyes Green" },
|
139
|
+
|
140
|
+
## Normal Beard Black | 289 ( 2.89 %) | Male (286) · Zombie (3)
|
141
|
+
{ id: 40, name: "Normal Beard Black" },
|
142
|
+
|
143
|
+
## Medical Mask | 175 ( 1.75 %) | Male (107) · Female (65) · Zombie (2) · Alien (1)
|
144
|
+
{ id: 41, name: "Medical Mask" },
|
145
|
+
{ id: 106, name: "Medical Mask" },
|
146
|
+
|
147
|
+
## Normal Beard | 292 ( 2.92 %) | Male (291) · Zombie (1)
|
148
|
+
{ id: 42, name: "Normal Beard" },
|
149
|
+
|
150
|
+
## VR | 332 ( 3.32 %) | Male (242) · Female (88) · Zombie (1) · Ape (1)
|
151
|
+
{ id: 43, name: "VR" },
|
152
|
+
{ id: 119, name: "VR" },
|
153
|
+
|
154
|
+
## Eye Patch | 461 ( 4.61 %) | Male (363) · Female (92) · Zombie (4) · Ape (2)
|
155
|
+
{ id: 44, name: "Eye Patch" },
|
156
|
+
{ id: 100, name: "Eye Patch" },
|
157
|
+
|
158
|
+
## Wild Hair | 447 ( 4.47 %) | Male (296) · Female (144) · Zombie (7)
|
159
|
+
{ id: 45, name: "Wild Hair" },
|
160
|
+
{ id: 96, name: "Wild Hair" },
|
161
|
+
|
162
|
+
## Top Hat | 115 ( 1.15 %) | Male (112) · Zombie (2) · Ape (1)
|
163
|
+
{ id: 46, name: "Top Hat" },
|
164
|
+
|
165
|
+
## Bandana | 481 ( 4.81 %) | Male (304) · Female (164) · Zombie (7) · Ape (4) · Alien (2)
|
166
|
+
{ id: 47, name: "Bandana" },
|
167
|
+
{ id: 107, name: "Bandana" },
|
168
|
+
|
169
|
+
## Handlebars | 263 ( 2.63 %) | Male (261) · Zombie (2)
|
170
|
+
{ id: 48, name: "Handlebars" },
|
171
|
+
|
172
|
+
## Frumpy Hair | 442 ( 4.42 %) | Male (289) · Female (149) · Zombie (4)
|
173
|
+
{ id: 49, name: "Frumpy Hair" },
|
174
|
+
{ id: 88, name: "Frumpy Hair" },
|
175
|
+
|
176
|
+
## Crazy Hair | 414 ( 4.14 %) | Male (239) · Female (168) · Zombie (7)
|
177
|
+
{ id: 50, name: "Crazy Hair" },
|
178
|
+
{ id: 81, name: "Crazy Hair" },
|
179
|
+
|
180
|
+
## Police Cap | 203 ( 2.03 %) | Male (200) · Zombie (2) · Ape (1)
|
181
|
+
{ id: 51, name: "Police Cap" },
|
182
|
+
|
183
|
+
## Buck Teeth | 78 ( 0.78 %) | Male (78)
|
184
|
+
{ id: 52, name: "Buck Teeth" },
|
185
|
+
|
186
|
+
## Do-rag | 300 ( 3.00 %) | Male (292) · Zombie (4) · Ape (3) · Alien (1)
|
187
|
+
{ id: 53, name: "Do-rag" },
|
188
|
+
|
189
|
+
## Front Beard | 273 ( 2.73 %) | Male (270) · Zombie (3)
|
190
|
+
{ id: 54, name: "Front Beard" },
|
191
|
+
|
192
|
+
## Spots | 124 ( 1.24 %) | Male (73) · Female (51)
|
193
|
+
{ id: 55, name: "Spots" },
|
194
|
+
{ id: 87, name: "Spots" },
|
195
|
+
|
196
|
+
## Big Beard | 146 ( 1.46 %) | Male (146)
|
197
|
+
{ id: 56, name: "Big Beard" },
|
198
|
+
|
199
|
+
## Vampire Hair | 147 ( 1.47 %) | Male (146) · Zombie (1)
|
200
|
+
{ id: 57, name: "Vampire Hair" },
|
201
|
+
|
202
|
+
## Peak Spike | 303 ( 3.03 %) | Male (298) · Zombie (5)
|
203
|
+
{ id: 58, name: "Peak Spike" },
|
204
|
+
|
205
|
+
## Chinstrap | 282 ( 2.82 %) | Male (280) · Zombie (2)
|
206
|
+
{ id: 59, name: "Chinstrap" },
|
207
|
+
|
208
|
+
## Fedora | 186 ( 1.86 %) | Male (184) · Ape (1) · Zombie (1)
|
209
|
+
{ id: 60, name: "Fedora" },
|
210
|
+
|
211
|
+
## Earring | 2459 (24.59 %) | Male (1498) · Female (933) · Zombie (22) · Alien (3) · Ape (3)
|
212
|
+
{ id: 61, name: "Earring" },
|
213
|
+
{ id: 125, name: "Earring" },
|
214
|
+
|
215
|
+
## Horned Rim Glasses | 535 ( 5.35 %) | Male (388) · Female (142) · Zombie (4) · Ape (1)
|
216
|
+
{ id: 62, name: "Horned Rim Glasses" },
|
217
|
+
{ id: 132, name: "Horned Rim Glasses" },
|
218
|
+
|
219
|
+
## Headband | 406 ( 4.06 %) | Male (304) · Female (96) · Zombie (4) · Alien (1) · Ape (1)
|
220
|
+
{ id: 63, name: "Headband" },
|
221
|
+
{ id: 110, name: "Headband" },
|
222
|
+
|
223
|
+
## Pipe | 317 ( 3.17 %) | Male (186) · Female (130) · Alien (1)
|
224
|
+
{ id: 64, name: "Pipe" },
|
225
|
+
{ id: 95, name: "Pipe" },
|
226
|
+
|
227
|
+
## Messy Hair | 460 ( 4.60 %) | Male (294) · Female (160) · Zombie (6)
|
228
|
+
{ id: 65, name: "Messy Hair" },
|
229
|
+
{ id: 93, name: "Messy Hair" },
|
230
|
+
|
231
|
+
## Front Beard Dark | 260 ( 2.60 %) | Male (255) · Zombie (5)
|
232
|
+
{ id: 66, name: "Front Beard Dark" },
|
233
|
+
|
234
|
+
## Hoodie | 259 ( 2.59 %) | Male (256) · Zombie (2) · Ape (1)
|
235
|
+
{ id: 67, name: "Hoodie" },
|
236
|
+
|
237
|
+
## Gold Chain | 169 ( 1.69 %) | Male (107) · Female (60) · Ape (1) · Zombie (1)
|
238
|
+
{ id: 68, name: "Gold Chain" },
|
239
|
+
{ id: 118, name: "Gold Chain" },
|
240
|
+
|
241
|
+
## Muttonchops | 303 ( 3.03 %) | Male (303)
|
242
|
+
{ id: 69, name: "Muttonchops" },
|
243
|
+
|
244
|
+
## Stringy Hair | 463 ( 4.63 %) | Male (292) · Female (165) · Zombie (6)
|
245
|
+
{ id: 70, name: "Stringy Hair" },
|
246
|
+
{ id: 98, name: "Stringy Hair" },
|
247
|
+
|
248
|
+
## Eye Mask | 293 ( 2.93 %) | Male (205) · Female (86) · Zombie (1) · Ape (1)
|
249
|
+
{ id: 71, name: "Eye Mask" },
|
250
|
+
{ id: 103, name: "Eye Mask" },
|
251
|
+
|
252
|
+
## 3D Glasses | 286 ( 2.86 %) | Male (205) · Female (78) · Zombie (2) · Ape (1)
|
253
|
+
{ id: 72, name: "3D Glasses" },
|
254
|
+
{ id: 84, name: "3D Glasses" },
|
255
|
+
|
256
|
+
## Clown Eyes Blue | 384 ( 3.84 %) | Female (274) · Male (108) · Zombie (2)
|
257
|
+
{ id: 73, name: "Clown Eyes Blue" },
|
258
|
+
{ id: 94, name: "Clown Eyes Blue" },
|
259
|
+
|
260
|
+
## Mohawk | 441 ( 4.41 %) | Male (286) · Female (153) · Zombie (2)
|
261
|
+
{ id: 74, name: "Mohawk" },
|
262
|
+
{ id: 123, name: "Mohawk" },
|
263
|
+
|
264
|
+
## Pilot Helmet | 54 ( 0.54 %) | Female (54)
|
265
|
+
{ id: 75, name: "Pilot Helmet" },
|
266
|
+
|
267
|
+
## Tassle Hat | 178 ( 1.78 %) | Female (178)
|
268
|
+
{ id: 76, name: "Tassle Hat" },
|
269
|
+
|
270
|
+
## Hot Lipstick | 696 ( 6.96 %) | Female (696)
|
271
|
+
{ id: 77, name: "Hot Lipstick" },
|
272
|
+
|
273
|
+
## Blue Eye Shadow | 266 ( 2.66 %) | Female (266)
|
274
|
+
{ id: 78, name: "Blue Eye Shadow" },
|
275
|
+
|
276
|
+
## Straight Hair Dark | 148 ( 1.48 %) | Female (148)
|
277
|
+
{ id: 79, name: "Straight Hair Dark" },
|
278
|
+
|
279
|
+
## Choker | 48 ( 0.48 %) | Female (48)
|
280
|
+
{ id: 80, name: "Choker" },
|
281
|
+
|
282
|
+
## Wild Blonde | 144 ( 1.44 %) | Female (144)
|
283
|
+
{ id: 83, name: "Wild Blonde" },
|
284
|
+
|
285
|
+
## Wild White Hair | 136 ( 1.36 %) | Female (136)
|
286
|
+
{ id: 86, name: "Wild White Hair" },
|
287
|
+
|
288
|
+
## Tiara | 55 ( 0.55 %) | Female (55)
|
289
|
+
{ id: 90, name: "Tiara" },
|
290
|
+
|
291
|
+
## Orange Side | 68 ( 0.68 %) | Female (68)
|
292
|
+
{ id: 91, name: "Orange Side" },
|
293
|
+
|
294
|
+
## Red Mohawk | 147 ( 1.47 %) | Female (147)
|
295
|
+
{ id: 92, name: "Red Mohawk" },
|
296
|
+
|
297
|
+
## Purple Eye Shadow | 262 ( 2.62 %) | Female (262)
|
298
|
+
{ id: 97, name: "Purple Eye Shadow" },
|
299
|
+
|
300
|
+
## Dark Hair | 157 ( 1.57 %) | Female (157)
|
301
|
+
{ id: 99, name: "Dark Hair" },
|
302
|
+
|
303
|
+
## Blonde Short | 129 ( 1.29 %) | Female (129)
|
304
|
+
{ id: 101, name: "Blonde Short" },
|
305
|
+
|
306
|
+
## Purple Lipstick | 655 ( 6.55 %) | Female (655)
|
307
|
+
{ id: 108, name: "Purple Lipstick" },
|
308
|
+
|
309
|
+
## Pigtails | 94 ( 0.94 %) | Female (94)
|
310
|
+
{ id: 111, name: "Pigtails" },
|
311
|
+
|
312
|
+
## Straight Hair Blonde | 144 ( 1.44 %) | Female (144)
|
313
|
+
{ id: 112, name: "Straight Hair Blonde" },
|
314
|
+
|
315
|
+
## Welding Goggles | 86 ( 0.86 %) | Female (86)
|
316
|
+
{ id: 116, name: "Welding Goggles" },
|
317
|
+
|
318
|
+
## Pink With Hat | 95 ( 0.95 %) | Female (95)
|
319
|
+
{ id: 121, name: "Pink With Hat" },
|
320
|
+
|
321
|
+
## Blonde Bob | 147 ( 1.47 %) | Female (147)
|
322
|
+
{ id: 122, name: "Blonde Bob" },
|
323
|
+
|
324
|
+
## Green Eye Shadow | 271 ( 2.71 %) | Female (271)
|
325
|
+
{ id: 126, name: "Green Eye Shadow" },
|
326
|
+
|
327
|
+
## Straight Hair | 151 ( 1.51 %) | Female (151)
|
328
|
+
{ id: 127, name: "Straight Hair" },
|
329
|
+
|
330
|
+
## Half Shaved | 147 ( 1.47 %) | Female (147)
|
331
|
+
{ id: 129, name: "Half Shaved" },
|
332
|
+
|
333
|
+
## Black Lipstick | 617 ( 6.17 %) | Female (617)
|
334
|
+
{ id: 131, name: "Black Lipstick" },
|
335
|
+
]
|
336
|
+
|
337
|
+
end # class CryptopunksData
|
338
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class CryptopunksData ## check - change class to a module - why? why not?
|
4
|
+
|
5
|
+
|
6
|
+
def self.meta
|
7
|
+
## get all meta data records for all 10 000 punks
|
8
|
+
@meta ||= decode_meta( META_ENCODED )
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.assets
|
12
|
+
@assets ||= ASSETS_ENCODED.sort { |l,r| l[:id] <=> r[:id] }
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
def self.punk_attributes( id )
|
18
|
+
## comma-separated values / attribute list in a string
|
19
|
+
asset_nums = meta[ id ] ## id - integer number e.g. 0,1,2,
|
20
|
+
|
21
|
+
asset_nums.map do |num|
|
22
|
+
## note: ASSETS_ENCODED array is zero-based; subtract -1 to start with zero (not one)
|
23
|
+
assets[ num-1 ][:name]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
alias_method :attributes, :punk_attributes
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
###
|
33
|
+
# more helpers
|
34
|
+
def self.decode_meta( hex )
|
35
|
+
recs = []
|
36
|
+
|
37
|
+
## note: allow spaces and newlines in hexstring for formatting
|
38
|
+
hex = hex.gsub( /[ \n]/, '' )
|
39
|
+
|
40
|
+
## convert hex string to byte array, that is, array of integer numbers
|
41
|
+
## e.g. 067d7a7e00000000 (0x06 / 0x7d / 0x7a / 0x7e / 0x00 / 0x00 ..)
|
42
|
+
## => [6, 125, 122, 126, 0, 0, 0, 0]
|
43
|
+
a = [hex].pack("H*").unpack('C*')
|
44
|
+
|
45
|
+
a.each_slice( 8 ).with_index do |attributes,i|
|
46
|
+
## filter out (trailing) zeros (0)
|
47
|
+
attributes = attributes.filter { |num| num != 0 }
|
48
|
+
## puts "#{i} => #{attributes.inspect}"
|
49
|
+
|
50
|
+
recs << attributes
|
51
|
+
end
|
52
|
+
recs
|
53
|
+
end
|
54
|
+
end # class CryptopunksData
|
55
|
+
|