ordinals 1.2.1 → 1.3.0

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: 689dcb72a0c9c4a381e7389c99651c31373391ebc52ff342c2ab523778717fda
4
- data.tar.gz: 1f444088a912221cedfcf2b1a13c8473ef666d68e2580f90c3e154ebe0334611
3
+ metadata.gz: b32e559e689e18de54615ab2528117193b41924127a6ea59ac1c62c4c9adf1a2
4
+ data.tar.gz: 8f2b06308775f509fe242e8a8c28ddde8864219a4315d051598f45dc7badc9d3
5
5
  SHA512:
6
- metadata.gz: 1624715a985b048b9223029e2fde16dbc8f3cb7fc3ffb401058dcfb20b8db072669b8a37784b62664f68e0adbe81711b375d3ebf8e28cd3bf4dc0ad53cda03f1
7
- data.tar.gz: 7d29a44b6c4df9c76308fb4ce3daae7be30184e39d1ae18b714fc16143929d7ec3d5e16424040e3a0374460d78dee2d1987b5a8730158844df9d7878a870cbef
6
+ metadata.gz: 81da575691583d7f05ff27dda111b80801cb15833a1a5a73f3366315e4e41bbe37e9d7e40bdc89027bf3c39e7b3de78918f356341d490b38ad071b09294a1ec7
7
+ data.tar.gz: 1f9b179ce9f9e4bd0f11802a94da1388ad5a62ef7357bcfbcecc0bd6c986be10c1c585c0937b6dd1d7db96f342d44d20f727029ddac1e283bb75eea935294d2d
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 1.2.1
1
+ ### 1.3.0
2
2
 
3
3
  ### 0.0.1 / 2023-03-23
4
4
 
data/README.md CHANGED
@@ -15,6 +15,7 @@ ordinals gem - ordinals (inscription) api wrapper & helpers for Bitcoin, Litcoin
15
15
  For now ordinal inscription api queries are supported on
16
16
  - Bitcoin (via <https://ordinals.com>) and
17
17
  - Litecoin (via <https://ordinalslite.com>)
18
+ - Dogecoin (via <https://wonky-ord.dogeord.io>)
18
19
 
19
20
  <!--
20
21
  chekc if doginals still in operation???
@@ -90,6 +91,10 @@ pp content
90
91
  ```
91
92
 
92
93
 
94
+ Tip: See [**Sub 1k - Inside The First Thousand (Bitcoin) Ordinal Inscriptions**](https://github.com/ordbase/ordbase/blob/master/programming-ordinals/sub1k.md) in the
95
+ Free (Online) Programming (Bitcoin) Ordinals - Step-by-Step Book(let) / Guide.
96
+
97
+
93
98
 
94
99
  Let's try querying for litecoin (ltc) ordinal inscriptions:
95
100
 
@@ -155,6 +160,71 @@ pp data
155
160
  # "offset"=>"0"}
156
161
  ```
157
162
 
163
+
164
+ Tip: See [**Sub 1k - Inside The First Thousand (Litecoin) Ordinal Inscriptions**](https://github.com/ordbase/ordbase/blob/master/programming-ordinals/ltc_sub1k.md) in the
165
+ Free (Online) Programming (Litecoin) Ordinals - Step-by-Step Book(let) / Guide.
166
+
167
+
168
+
169
+
170
+ Let's try querying for dogecoin (doge) ordinal shibescriptions:
171
+
172
+ ``` ruby
173
+ Ordinals.chain = :doge
174
+
175
+ id = '8f7219639800fdddd510f35bcda52471828ded43753b1d2a42f2a054d006edd8i0'
176
+ data = Ordinals.inscription( id )
177
+ pp data
178
+ # GET https://wonky-ord.dogeord.io/shibescription/8f7219639800fdddd510f35bcda52471828ded43753b1d2a42f2a054d006edd8i0...
179
+ #=> {"title"=>"Shibescription 35",
180
+ # "id"=>"8f7219639800fdddd510f35bcda52471828ded43753b1d2a42f2a054d006edd8i0",
181
+ # "address"=>"D6tMqX2ZrjNunNfohgQPGLT9XpUCN56Zyj",
182
+ # "output-value"=>"100000",
183
+ # "content-length"=>"1077 bytes",
184
+ # "content-type"=>"image/png",
185
+ # "timestamp"=>"2023-02-24 09:23:06 UTC",
186
+ # "genesis-height"=>"4609819",
187
+ # "genesis-fee"=>"34200000",
188
+ # "genesis-transaction"=>"8f7219639800fdddd510f35bcda52471828ded43753b1d2a42f2a054d006edd8",
189
+ # "location"=>"8f7219639800fdddd510f35bcda52471828ded43753b1d2a42f2a054d006edd8:0:0",
190
+ # "output"=>"8f7219639800fdddd510f35bcda52471828ded43753b1d2a42f2a054d006edd8:0",
191
+ # "offset"=>"0"}
192
+
193
+ content = Ordinals.content( id )
194
+ pp content
195
+ # GET https://wonky-ord.dogeord.io/content/8f7219639800fdddd510f35bcda52471828ded43753b1d2a42f2a054d006edd8i0...
196
+ #=> #<Ordinals::Api::Content:0x000001cced0740e8
197
+ # @data="\x89PNG\r\n\x1A\n\x00\x00\x00...",
198
+ # @length=1077,
199
+ # @type="image/png">
200
+
201
+ data = Ordinals.inscription( 0 )
202
+ pp data
203
+ # GET https://wonky-ord.dogeord.io/shibescription/15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62ei0...
204
+ #=> {"title"=>"Shibescription 0",
205
+ # "id"=>"15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62ei0",
206
+ # "address"=>"DCagMX5GccdpaBFJwDqmPcCaNqSzXtYoVf",
207
+ # "output-value"=>"100000",
208
+ # "content-length"=>"1461 bytes",
209
+ # "content-type"=>"image/png",
210
+ # "timestamp"=>"2023-02-24 07:45:34 UTC",
211
+ # "genesis-height"=>"4609723",
212
+ # "genesis-fee"=>"34200000",
213
+ # "genesis-transaction"=>"15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62e",
214
+ # "location"=>"15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62e:0:0",
215
+ # "output"=>"15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62e:0",
216
+ # "offset"=>"0"}
217
+
218
+ content = Ordinals.content( 0 )
219
+ pp content
220
+ # GET https://wonky-ord.dogeord.io/content/15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62ei0...
221
+ #=> #<Ordinals::Api::Content:0x000001cceda012a0
222
+ # @data="\x89PNG\r\n\x1A\n\x00\x00...",
223
+ # @length=1461,
224
+ # @type="image/png">
225
+ ```
226
+
227
+
158
228
  That's it.
159
229
 
160
230
 
data/lib/ordinals/api.rb CHANGED
@@ -19,7 +19,9 @@ class Api ## change/rename Api to Client - why? why not?
19
19
  def self.dogecoin
20
20
  ## note: "doginals" call inscriptions
21
21
  ## shibescriptions
22
- @dogecoin ||= new( 'https://doginals.com', inscription: 'shibescription' )
22
+ ##
23
+ ## note: https://doginals.com no longer in operation / working
24
+ @dogecoin ||= new( 'https://wonky-ord.dogeord.io', inscription: 'shibescription' )
23
25
  @dogecoin
24
26
  end
25
27
 
@@ -29,8 +31,16 @@ class Api ## change/rename Api to Client - why? why not?
29
31
  def initialize( base, inscription: 'inscription' )
30
32
  @base = base
31
33
  @inscription = inscription
34
+
35
+ ## e.g. inscriptions or shibescriptions (dogecoin)
36
+ @inscriptions = "#{@inscription}s"
37
+
32
38
  @requests = 0 ## count requests (for delay_in_s sleeping/throttling)
33
39
  @pages = {} ## (0-)99, (100-)199, (200-)299 etc.
40
+
41
+ @inscribe_id_rx = %r{
42
+ (#{@inscription})/(?<id>[a-fi0-9]+)
43
+ }ix
34
44
  end
35
45
 
36
46
 
@@ -72,19 +82,15 @@ end ## (nested) class Content
72
82
  end
73
83
 
74
84
 
75
- INSCRIBE_ID_RX = %r{
76
- inscription/(?<id>[a-fi0-9]+)
77
- }ix
78
-
79
85
 
80
86
  def inscription_ids( offset: ) ## note: page size is for now fixed 100
81
87
  ids = []
82
88
 
83
- src = "#{@base}/inscriptions/#{offset}"
89
+ src = "#{@base}/#{@inscriptions}/#{offset}"
84
90
  res = get( src )
85
91
 
86
92
  page = res.text ### assumes utf-8 for now
87
- page.scan( INSCRIBE_ID_RX ) do |_|
93
+ page.scan( @inscribe_id_rx ) do |_|
88
94
  m = Regexp.last_match
89
95
  ids << m[:id]
90
96
  end
@@ -93,19 +99,28 @@ end ## (nested) class Content
93
99
  ids
94
100
  end
95
101
 
96
- def sub10k_ids
102
+ def _batch_inscription_ids( batch )
97
103
  ids = []
98
104
  limit = 100
99
105
 
100
- 100.times do |i| ## fetch first hundred (100*100=10000) inscribe ids
106
+ batch.times do |i|
101
107
  offset = 99 + limit*i
108
+
102
109
  puts "==> #{i} - @ #{offset}..."
103
- ids += inscription_ids( offset: offset )
110
+ ## auto-add to page cache - why? why not?
111
+ ids += (@pages[ offset ] ||= inscription_ids( offset: offset ))
104
112
  end
105
113
  puts " #{ids.size} inscribe id(s) - total"
106
114
  ids
107
115
  end
108
116
 
117
+ ## convenience sub1k & frens clubs / helpers
118
+ def sub1k_ids() _batch_inscription_ids( 10 ); end
119
+ def sub2k_ids() _batch_inscription_ids( 20 ); end
120
+ def sub5k_ids() _batch_inscription_ids( 50 ); end
121
+ def sub10k_ids() _batch_inscription_ids( 100 ); end
122
+ def sub20k_ids() _batch_inscription_ids( 200 ); end
123
+
109
124
 
110
125
  def _num_to_id( num )
111
126
  limit = 100
@@ -8,6 +8,12 @@ def initialize( dir )
8
8
  @force = false
9
9
  end
10
10
 
11
+ ##########
12
+ ## config helpers
13
+ def force?() @force; end
14
+ def force=(value) @force=value; end
15
+
16
+
11
17
 
12
18
 
13
19
  def json_to_txt( data )
@@ -2,8 +2,8 @@
2
2
  module Ordinals
3
3
  # sync version w/ sport.db n friends - why? why not?
4
4
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
5
- MINOR = 2
6
- PATCH = 1
5
+ MINOR = 3
6
+ PATCH = 0
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
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.2.1
4
+ version: 1.3.0
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-08-04 00:00:00.000000000 Z
11
+ date: 2023-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocos