ordinals 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fec9f519a6abfabeae1243ccd48ab0abdd0b03db8cf1f58256fbea7346673a8b
4
- data.tar.gz: 7633ca1833fbbe8a41fc31608c9c084c983342a3abe33a2dda08422ae65eb3a1
3
+ metadata.gz: 586a022b2167110472eaea7be6d88e4f21fe72ea1f05ed6465ce29913a10cc15
4
+ data.tar.gz: fe6f05e73dfdfd42560607c0721b0bdf642718debc83f48e0c36ba2a0ac82db2
5
5
  SHA512:
6
- metadata.gz: e89f0c5897973530ccabc577f4e055645ae428abbe35430252131992a95a4058e31c4e31a40717c24dbf1237067b153669a7e2a25b0e688f1c2495c58c73b476
7
- data.tar.gz: f225b18511b8eea28e0f8068198ad5076a6632cdab4850cf1f70a7f712b1476b66c8990b88f809f93fb2588d3fb6ac7960785e7db744ef23800467b0b2ce252f
6
+ metadata.gz: 0b7550126e529e67d821042f6fa5d2092f8e93460d4b6e892fe9d21e7bd4e7e5f83673beb39557dafbb1617eb7527569c2b4347e57cf6ce61090e1c00979d335
7
+ data.tar.gz: 452fc65024f99d80bddf2254e2177a4397b816525d43cf8e42c7e914b95706c4f1a5b4086e5a2e2135792cfe895edcd9dca9e39190c95c74c63cee1550a0da41
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 1.1.0
1
+ ### 1.1.1
2
2
 
3
3
  ### 0.0.1 / 2023-03-23
4
4
 
data/Manifest.txt CHANGED
@@ -5,5 +5,6 @@ Rakefile
5
5
  lib/ordinals.rb
6
6
  lib/ordinals/api.rb
7
7
  lib/ordinals/recursive/composite.rb
8
+ lib/ordinals/recursive/generator.rb
8
9
  lib/ordinals/recursive/image.rb
9
10
  lib/ordinals/stats.rb
data/README.md CHANGED
@@ -97,11 +97,238 @@ pp data
97
97
  # "offset"=>"0"}
98
98
  ```
99
99
 
100
- That's it for now.
100
+ That's it.
101
101
 
102
102
 
103
+ ### Bonus - Recursive Images - Generate .SVG Inscriptions
103
104
 
104
- ## Bonus: Ordinal Pixel Art Collections
105
+ Ordinal helper classes for generating recursive images include:
106
+ - `RecursiveImage`
107
+ - `RecursiveImageComposite`
108
+ - `RecursiveGenerator`
109
+
110
+
111
+ #### Sample No 1 - (Recursive) D.I.Y. Martians - Aliens Vol. 2
112
+
113
+
114
+ ```ruby
115
+ require 'ordinals'
116
+
117
+ ## 50 .PNG "one-by-one" images - each 24×24px
118
+ inscribes = [
119
+ '0829dc471f8bb92a971dfdfb00a71c016b833c8f1d5f39dcb15aa5535d08fc15i0',
120
+ '9482552ec759b76577b28923741eb4bfc7770cead528755bf8fa44196ae9318ci0',
121
+ '5b8eb4a05f13fffc49f824f457fb080b67e4fdc312fbbf2f804cef59e6d5fad2i0',
122
+ '85e0efd6cc2801ab7e1fe28e23110441348ca40481599f880c571ff4f69f066fi0',
123
+ '7953ccb6614a41e7b4c4ed2a2b112b52feda387de92de2c1a314f03d5da41955i0',
124
+ '2f1219924cfa01f9816581e8a39e201f15e19ab447e852ff9b43b13fa7b0c75di0',
125
+ 'e60f597ec41c50e823ea382c101dfc2f30c13a927222be3b73cedd88bd1b9237i0',
126
+ '5ce9f89ad571e5380baa5b5ee387f08ea313421e7e54662b3899d411c39321ddi0',
127
+ '3459b14a4fcb7bce1df0465abc711b556caba6f7b42d4f925f1ddf830be47125i0',
128
+ '1355524a2aab576e069bac91227b0e52d227d65d84c5535377d3a0ea4e44d470i0',
129
+ 'a6b4b81f69e8c217db24f0a71954195d67ced49a819b67a4daf9f3ca7fa1b971i0',
130
+ '83827ec13cb55a35fe3adca5acf67caf943c3bd6810f8fa893b067e8015c8f19i0',
131
+ '5b1e638c050318bec23f17b8b7758ccf13945e422516da6c722c67ae5ed4e26di0',
132
+ '5dcf96b13e5762d5a288d8bee36deb933fe192a55475199fe9a39ae29dd16853i0',
133
+ '5760ce05009e94a750a7245cac994fa9ffd388eadc757929ac17737811455429i0',
134
+ '0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0',
135
+ '7c2fd41b52624ddb1ba11fe1c6d95475f2e42c4b53d6aaf6a16a09064acebe38i0',
136
+ '0f473c9dcd14e3f43a6599b038d810eac16bc6394edcfcf6b32f8df992ab6791i0',
137
+ 'd32c50c23693a028e2381d6f756746a9ff684f2028edf694ab7b1b6cde78e2cdi0',
138
+ 'd61fc2a89ecc6ae65cf91cdfac9edc37fd60c38621dac211f3a70891ef79b69ai0',
139
+ '680e2ee8cad86aa174b4f3373d733370c9a6fc4230b9708d520a0f6bcb8e72a6i0',
140
+ '56d3f4f661b2b4a9fc17755171d7cf4da74e570614b6b45de0cc87a809c3eb3ci0',
141
+ 'fe4321178bd841e52fdeb72ce4456c5b7596c0d611b19da15ba75ec63b5314cai0',
142
+ 'eddc1242f0fd290e130332e046897ad41dce1e7e112df48ecf2168e43172d383i0',
143
+ 'a2110fb4afaa29bc70bcfac445f750ecb5e81777e8d080be2d2b07eb030ba0ffi0',
144
+ 'c1277df4b986067b2a3f006d717b7f6d042896840c8b592e5a8b9ff22444b08fi0',
145
+ '722dfdc90a67ff7eb892d13393a8a5b360b8a109f3d809600919684a600ff60ei0',
146
+ 'a0d11e78978a9dd5f1d891b71f06bd2d411c08372eba1f23e8b0722474388130i0',
147
+ '2c2d812754b9374ffb699173da7f6d476af138a99906b66b8453cc4343305167i0',
148
+ '964c52312f1db9025695b181d5f631292d29bec63ff9587138a589cb5ff8c26di0',
149
+ '545fd4d45d2f6d732d48accc082f72b67a00d19f88517320f814bf1fe827c816i0',
150
+ '72fe7ebda802852f499dca865ec22ac43eacfcf4796d761969ae8358791e943ci0',
151
+ '4db2e931b5cd489d8007d111d20ab97d84161b84c8f7ff3038e1afe79567b9afi0',
152
+ '4869c9bb7cf23e68ad94da5b1e9de1feff1ebdcaf9a08fccca5f1887dd40e239i0',
153
+ '06136a5b4fb585069ef6265a0fde3baf67ee914b9f784d2c951f3a8187800d54i0',
154
+ '8043604c7c96a5a43a97e251b246102ca40c0203431ff21bd26f23330dfa554ci0',
155
+ '92e7f48454546718f98103d7464d954033adbee21855f06584be06faa3e291ddi0',
156
+ 'a01012b213ed425c5d4038bc36016f19f4f342ca052ff9bf6971672164e1a402i0',
157
+ '87d89d290ebde5d5b7aa75b4c8d0359515e25ea1542bc0646dc3f5b0b2fc55fdi0',
158
+ 'aab67a4269ca0bda649fe341bd88c862aba2e9bf6e0826b9dfa5c4ba8fe62c2di0',
159
+ '189b02ffc8aac68a45102e9837a1ca92e422bf5544d9011a863626cf6b0abeeai0',
160
+ '43e93e43f2dac75b141baaa5b08df440e0b6ec5755577a9554a7af6540447bb7i0',
161
+ '39d774f7d7514371c88bc4f939346f6b23000c9892ac4ae8ea36c76694e3b842i0',
162
+ 'b268b2acccd6b04680c2aa3130863ffbaa450f6870f100af678428cd07212ef6i0',
163
+ 'ac810c9098681e100964166b7510d1ac371c147861b0ae2a862da3a8b8256037i0',
164
+ '4b9f880df07b072a4147a62acdd0881d024d14da6d84174db9b5ac555b71b346i0',
165
+ '014ad6ed6297bc4ed624b2856e036c6bde115d51eb7200b14e3b3413ad53db08i0',
166
+ 'e139b5b0649186772cbf044bb8d3c5e43b77e3cf0472008ce2aaf52966c921eci0',
167
+ '6eb271ad3fdd15cc2ec34dda462e71aaa8a7ef7e306cfd189931ef37216a9c60i0',
168
+ '47cb34f1d73371df0b27ca0a259927fa80e2b2d9ee0e1d487fca5c9029b67b49i0',
169
+ ]
170
+
171
+ diymartians = RecursiveGenerator.new( 24, 24,
172
+ inscribes: inscribes )
173
+
174
+
175
+ [
176
+ '41 0 39 37 23 8',
177
+ '44 1 10 23',
178
+ '46 3 21 15',
179
+ '47 2 39 26 37',
180
+ '47 4 39 20 33 35 36',
181
+ '41 0 32 35 13 36',
182
+ '44 6 16 28 37 34 35',
183
+ '41 0 10 33 34 35 36 8 7',
184
+ '48 2 33 8 34 35 37 14',
185
+ '49 3 21 14 35 34 35 37 18 14',
186
+ ].each_with_index do |spec,i|
187
+ img = diymartians.generate( spec )
188
+ write_text( "./diymartian#{i}.svg", img.to_svg )
189
+ end
190
+ ```
191
+
192
+ resulting in (hosted on ordtest - Ordinals (Recursive) Testing Sandbox):
193
+
194
+ - <https://ordtest.github.io/diymartian0.svg> - d.i.y. martian no. 0
195
+ - <https://ordtest.github.io/diymartian1.svg> - d.i.y. martian no. 1
196
+ - <https://ordtest.github.io/diymartian2.svg>
197
+ - <https://ordtest.github.io/diymartian3.svg>
198
+ - <https://ordtest.github.io/diymartian4.svg>
199
+ - <https://ordtest.github.io/diymartian5.svg>
200
+ - <https://ordtest.github.io/diymartian6.svg>
201
+ - <https://ordtest.github.io/diymartian7.svg>
202
+ - <https://ordtest.github.io/diymartian8.svg>
203
+ - <https://ordtest.github.io/diymartian9.svg>
204
+
205
+
206
+ Tip: If you select "show source" in the "right-click" menu in your web browser you will see the "magic" recursive .SVG source text.
207
+
208
+
209
+
210
+ #### Sample No 2 - (Recursive) D.I.Y. Maxi Biz (Punks)
211
+
212
+ ```ruby
213
+ require 'ordinals'
214
+
215
+ ## all-in-one spritesheet .PNG image 240×216px (10×9 grid - 24×24px each)
216
+ inscribes = [
217
+ ['ad56d4f242677ac334844002f1c27b9b636ba71f68590cdc0cc5a2cbce080990i0', { width: 240, height: 216 }],
218
+ ]
219
+
220
+ diymaxibiz = RecursiveGenerator.new( 24, 24,
221
+ inscribes: inscribes )
222
+
223
+
224
+ [
225
+ '87 6 25 41 74 59',
226
+ '87 6 25 41 74',
227
+ '87 6 25 41',
228
+ '84 13 68 33 73',
229
+ '87 12 21 38 46 73',
230
+ '84 14 66 35 73',
231
+ '84 11 35 69 72',
232
+ '84 1 44 73 40',
233
+ '87 3 40 43 73',
234
+ '87 83 77',
235
+ ].each_with_index do |spec,i|
236
+ img = diymaxibiz.generate( spec )
237
+ write_text( "./diymaxibiz#{i}.svg", img.to_svg )
238
+ end
239
+ ```
240
+
241
+ resulting in (hosted on ordtest - Ordinals (Recursive) Testing Sandbox):
242
+
243
+ - <https://ordtest.github.io/diymaxibiz0.svg>
244
+ - <https://ordtest.github.io/diymaxibiz1.svg>
245
+ - <https://ordtest.github.io/diymaxibiz2.svg>
246
+ - <https://ordtest.github.io/diymaxibiz3.svg>
247
+ - <https://ordtest.github.io/diymaxibiz4.svg>
248
+ - <https://ordtest.github.io/diymaxibiz5.svg>
249
+ - <https://ordtest.github.io/diymaxibiz6.svg>
250
+ - <https://ordtest.github.io/diymaxibiz7.svg>
251
+ - <https://ordtest.github.io/diymaxibiz8.svg>
252
+ - <https://ordtest.github.io/diymaxibiz9.svg>
253
+
254
+
255
+
256
+ #### Sample No 3 - All-In-One 100 Ordinal Punks Composite
257
+
258
+ _100 recursions each 96×96px in 10×10 grid_
259
+
260
+ ```ruby
261
+ require 'ordinals'
262
+
263
+
264
+ composite = RecursiveImageComposite.new( 10, 10, width: 96,
265
+ height: 96 )
266
+
267
+ data = read_json( "./ordinalpunks.json" )
268
+ puts " #{data['items'].size} inscribe(s)"
269
+
270
+ data['items'].each_with_index do |rec|
271
+ id = rec['inscription_id']
272
+ comment = rec['name']
273
+
274
+ composite << [id, {pixelate: true,
275
+ comment: comment}]
276
+ end
277
+
278
+ write_text( "./ordinalpunks.svg", composite.to_svg )
279
+ ```
280
+
281
+ resulting in (hosted on ordtest - Ordinals (Recursive) Testing Sandbox):
282
+
283
+ - <https://ordtest.github.io/ordinalpunks.svg>
284
+
285
+
286
+
287
+ #### Sample No 4 - Nine D.I.Y. Punks Composite
288
+
289
+ _9 recursions each 24×24px in 3×3 grid_
290
+
291
+ ```ruby
292
+ require 'ordinals'
293
+
294
+ ## all-in-one spritesheet .PNG image 240×144px (10×6 grid - 24×24px each)
295
+ inscribes = [
296
+ ['cf5df319bbe23fa3d012e5ee0810700c8e82aebff41164246f0d87d7b60a9903i0', { width: 240, height: 144 }],
297
+ ]
298
+
299
+ diypunks = RecursiveGenerator.new( 24, 24,
300
+ inscribes: inscribes )
301
+
302
+
303
+ composite = RecursiveImageComposite.new( 3, 3, width: 24,
304
+ height: 24)
305
+
306
+ [
307
+ '59 0',
308
+ '59 1',
309
+ '59 2',
310
+ '59 3',
311
+ '59 4',
312
+ '59 5',
313
+ '59 6',
314
+ '59 7',
315
+ '59 8',
316
+ ].each do |spec|
317
+ img = diypunks.generate( spec )
318
+ composite << img
319
+ end
320
+
321
+ write_text( "./diypunks.svg", composite.to_svg )
322
+ ```
323
+
324
+ resulting in (hosted on ordtest - Ordinals (Recursive) Testing Sandbox):
325
+
326
+ - <https://ordtest.github.io/diypunks.svg>
327
+
328
+
329
+
330
+
331
+ ## Appendix: Ordinal Pixel Art Collections
105
332
 
106
333
 
107
334
  See the [**Ordinals (Pixel Art) Sandbox (& Cache)**](https://github.com/ordbase/ordinals.sandbox)
@@ -120,8 +347,15 @@ The scripts are dedicated to the public domain.
120
347
  Use it as you please with no restrictions whatsoever.
121
348
 
122
349
 
350
+
351
+
352
+
123
353
  ## Questions? Comments?
124
354
 
125
- Post them over at the [Help & Support](https://github.com/geraldb/help) page. Thanks.
355
+ Join us in the [Ordgen / ORC-721 discord (chat server)](https://discord.gg/dDhvHKjm2t). Yes you can.
356
+ Your questions and commetary welcome.
357
+
358
+
359
+ Or post them over at the [Help & Support](https://github.com/geraldb/help) page. Thanks.
126
360
 
127
361
 
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ require 'hoe'
10
10
 
11
11
  Hoe.spec 'ordinals' do
12
12
 
13
- self.version = '1.1.0'
13
+ self.version = '1.1.1'
14
14
 
15
15
  self.summary = 'ordinals gem - ordinals (inscription) api wrapper & helpers for Bitcoin, Litecoin, Dogecoin & co.'
16
16
  self.description = summary
@@ -0,0 +1,69 @@
1
+
2
+
3
+ class RecursiveGenerator
4
+ def initialize( width, height,
5
+ pixelate: true,
6
+ inscribes: )
7
+ @width = width
8
+ @height = height
9
+ @recursions = _prepare( inscribes )
10
+ @pixelate = pixelate
11
+ end
12
+
13
+ def [](index) ## return recursion (config) as array
14
+ @recursions[index]
15
+ end
16
+
17
+ def count() @recursions.size; end
18
+ alias_method :size, :count ## add size alias (confusing if starting with 0?) - why? why not?
19
+
20
+ def width() @width; end
21
+ def height() @height; end
22
+
23
+
24
+ def _prepare( inscribes)
25
+ ## prepare (flatten) recursion lookup table indexed 0,1,2,3, etc.
26
+ index = []
27
+ inscribes.each do |rec|
28
+ if rec.is_a?( Array ) ## assume spritesheet
29
+ id = rec[0]
30
+ opts = rec[1]
31
+ cols = opts[:width] / width
32
+ rows = opts[:height] / height
33
+ count = cols*rows
34
+ count.times do |num|
35
+ index << [id, { spritesheet: [opts[:width],opts[:height]],
36
+ num: num }
37
+ ]
38
+ end
39
+ else ## assume "standalone / one-by-one" inscribe
40
+ id = rec
41
+ index << [id, {}]
42
+ end
43
+ end
44
+ index
45
+ end
46
+
47
+
48
+ SEP_RX = %r{[ \t/,;*+_-]+
49
+ }x
50
+
51
+ def _parse( str )
52
+ str.strip.split( SEP_RX ).map { |str| str.to_i(10) }
53
+ end
54
+
55
+ def generate( *args )
56
+ g = if args.size==1 && args.is_a?( String )
57
+ _parse( args[0] )
58
+ else ## assume integer numbers
59
+ args
60
+ end
61
+ img = RecursiveImage.new( @width, @height )
62
+ g.each do |num|
63
+ id, opts = @recursions[num]
64
+ img << [id, opts.merge( {pixelate: @pixelate} )]
65
+ end
66
+ img
67
+ end
68
+ end # class RecursiveGenerator
69
+
data/lib/ordinals.rb CHANGED
@@ -91,6 +91,8 @@ require_relative 'ordinals/stats'
91
91
  ### add recursive image helpers
92
92
  require_relative 'ordinals/recursive/image'
93
93
  require_relative 'ordinals/recursive/composite'
94
+ require_relative 'ordinals/recursive/generator'
95
+
94
96
 
95
97
  ## add conveniecen shortcuts/alias - why? why not?
96
98
  RcsvImage = RecursiveImage
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ordinals
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-20 00:00:00.000000000 Z
11
+ date: 2023-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocos
@@ -89,6 +89,7 @@ files:
89
89
  - lib/ordinals.rb
90
90
  - lib/ordinals/api.rb
91
91
  - lib/ordinals/recursive/composite.rb
92
+ - lib/ordinals/recursive/generator.rb
92
93
  - lib/ordinals/recursive/image.rb
93
94
  - lib/ordinals/stats.rb
94
95
  homepage: https://github.com/ordbase/ordbase