ordinals 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/README.md +6 -6
- data/Rakefile +3 -3
- data/lib/ordinals/api.rb +2 -1
- data/lib/ordinals/stats.rb +145 -0
- data/lib/ordinals.rb +2 -0
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e10555694ad5291381edc71af98ba868a6f1f51a42236445873a27e4afbcd177
|
|
4
|
+
data.tar.gz: a751e7a56a4437d162f055fcf838acbf926a8ab0d89ac7559e99ec2a6f312882
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f40f08b9217c1b85a45b3310f21b5acdd14a01d051b989d8abc78cdd88198ec76184b35488fc1f4f5f849224c1793b8e6b23b3ac38b4f36e723b5518b6db8fd6
|
|
7
|
+
data.tar.gz: bf8d701dd8d75045dc049a7aad636328f616c3a07a5d2a14781b4ac1953dd8a29dfdbea830693ba3e75390fc598e5aa2e06f58d8e6d209e65a19058c5e18b901
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
ordinals gem - ordinals (inscription) api wrapper & helpers for Bitcoin, Litcoin, Dogecoin & co.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
* home :: [github.com/
|
|
7
|
-
* bugs :: [github.com/
|
|
6
|
+
* home :: [github.com/ordbase/ordbase](https://github.com/ordbase/ordbase)
|
|
7
|
+
* bugs :: [github.com/ordbase/ordbase/issues](https://github.com/ordbase/ordbase/issues)
|
|
8
8
|
* gem :: [rubygems.org/gems/ordinals](https://rubygems.org/gems/ordinals)
|
|
9
9
|
* rdoc :: [rubydoc.info/gems/ordinals](http://rubydoc.info/gems/ordinals)
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ ordinals gem - ordinals (inscription) api wrapper & helpers for Bitcoin, Litcoin
|
|
|
14
14
|
|
|
15
15
|
For now ordinal inscription api queries are supported on
|
|
16
16
|
- Bitcoin (via <https://ordinals.com>)
|
|
17
|
-
- Litecoin (via <https://
|
|
17
|
+
- Litecoin (via <https://ordinalslite.com>) and
|
|
18
18
|
- Dogecoin (via <https://doginals.com>)
|
|
19
19
|
|
|
20
20
|
|
|
@@ -65,7 +65,7 @@ Ordinals.chain = :ltc
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
# get the inscription binary blob / data by id
|
|
68
|
-
# e.g. GET https://
|
|
68
|
+
# e.g. GET https://ordinalslite.com/inscription/f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4i0...
|
|
69
69
|
|
|
70
70
|
id = 'f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4i0'
|
|
71
71
|
content = Ordinals.content( id )
|
|
@@ -77,7 +77,7 @@ pp content
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
# get the inscription meta data by id
|
|
80
|
-
# e.g GET https://
|
|
80
|
+
# e.g GET https://ordinalslite.com/inscription/f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4i0...
|
|
81
81
|
data = Ordinals.inscription( id )
|
|
82
82
|
pp data
|
|
83
83
|
#=> {"title"=>"Inscription 642",
|
|
@@ -104,7 +104,7 @@ That's it for now.
|
|
|
104
104
|
## Bonus: Ordinal Pixel Art Collections
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
See the [**Ordinals (Pixel Art) Sandbox (& Cache)**](https://github.com/
|
|
107
|
+
See the [**Ordinals (Pixel Art) Sandbox (& Cache)**](https://github.com/ordbase/ordinals.sandbox)
|
|
108
108
|
for collections incl. Ordinal Punks & Phunks (24×24), Bitcoin Punks (24×24), Ordinal Mini Doges (24×24), Ordinal Doggies (32×32),
|
|
109
109
|
Extra Ordinal Women (32×32), Ordinal Penguins (35×35),
|
|
110
110
|
Ordinal Birds (42×42), Bitcoin Bears (48×48) and much more.
|
data/Rakefile
CHANGED
|
@@ -10,15 +10,15 @@ end
|
|
|
10
10
|
|
|
11
11
|
Hoe.spec 'ordinals' do
|
|
12
12
|
|
|
13
|
-
self.version = '1.0.
|
|
13
|
+
self.version = '1.0.3'
|
|
14
14
|
|
|
15
15
|
self.summary = 'ordinals gem - ordinals (inscription) api wrapper & helpers for Bitcoin, Litecoin, Dogecoin & co.'
|
|
16
16
|
self.description = summary
|
|
17
17
|
|
|
18
|
-
self.urls = { home: 'https://github.com/
|
|
18
|
+
self.urls = { home: 'https://github.com/ordbase/ordbase' }
|
|
19
19
|
|
|
20
20
|
self.author = 'Gerald Bauer'
|
|
21
|
-
self.email = '
|
|
21
|
+
self.email = 'gerald.bauer@gmail.com'
|
|
22
22
|
|
|
23
23
|
# switch extension to .markdown for gihub formatting
|
|
24
24
|
self.readme_file = 'README.md'
|
data/lib/ordinals/api.rb
CHANGED
|
@@ -5,7 +5,8 @@ module Ordinals
|
|
|
5
5
|
|
|
6
6
|
class Api ## change/rename Api to Client - why? why not?
|
|
7
7
|
def self.litecoin
|
|
8
|
-
@litecoin ||= new( 'https://litecoin.earlyordies.com' )
|
|
8
|
+
## @litecoin ||= new( 'https://litecoin.earlyordies.com' )
|
|
9
|
+
@litecoin ||= new( 'https://ordinalslite.com' )
|
|
9
10
|
@litecoin
|
|
10
11
|
end
|
|
11
12
|
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class InscriptionStats
|
|
4
|
+
|
|
5
|
+
TITLE_RX = /^(Inscription|Shibescription)[ ]+(?<ord>[0-9]+)$/
|
|
6
|
+
BYTES_RX = /^(?<bytes>[0-9]+)[ ]+bytes$/
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@stats = {
|
|
10
|
+
count: 0,
|
|
11
|
+
ord: { '<100' => 0,
|
|
12
|
+
'<1000' => 0,
|
|
13
|
+
'<10000' => 0,
|
|
14
|
+
'<100000' => 0,
|
|
15
|
+
'<1000000' => 0,
|
|
16
|
+
'min' => nil,
|
|
17
|
+
'max' => nil, },
|
|
18
|
+
type: Hash.new(0),
|
|
19
|
+
bytes: { '<100' => 0,
|
|
20
|
+
'<1000' => 0,
|
|
21
|
+
'<10000' => 0,
|
|
22
|
+
'<100000' => 0,
|
|
23
|
+
'<1000000' => 0,
|
|
24
|
+
'min' => nil,
|
|
25
|
+
'max' => nil, },
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@days = Hash.new(0)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def size() @stats[:count]; end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def update( data )
|
|
36
|
+
data = JSON.parse( data) if data.is_a?( String )
|
|
37
|
+
|
|
38
|
+
@stats[ :count ] += 1
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
ord = nil
|
|
42
|
+
if m=TITLE_RX.match( data['title'] )
|
|
43
|
+
ord = m[:ord].to_i(10)
|
|
44
|
+
else
|
|
45
|
+
puts "!! ERROR - cannot find ord in inscription title; sorry"
|
|
46
|
+
pp data
|
|
47
|
+
exit 1
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
if ord < 100 then @stats[:ord]['<100'] += 1
|
|
51
|
+
elsif ord < 1000 then @stats[:ord]['<1000'] += 1
|
|
52
|
+
elsif ord < 10000 then @stats[:ord]['<10000'] += 1
|
|
53
|
+
elsif ord < 100000 then @stats[:ord]['<100000'] += 1
|
|
54
|
+
elsif ord < 1000000 then @stats[:ord]['<1000000'] += 1
|
|
55
|
+
else
|
|
56
|
+
puts "!! ERROR ord out-of-bounds"
|
|
57
|
+
exit 1
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
## update min/max
|
|
61
|
+
@stats[:ord]['min'] = ord if ord < (@stats[:ord]['min'] || 9999999)
|
|
62
|
+
@stats[:ord]['max'] = ord if ord > (@stats[:ord]['max'] || -1)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
bytes = nil
|
|
66
|
+
if m=BYTES_RX.match( data['content length'] )
|
|
67
|
+
bytes = m[:bytes].to_i(10)
|
|
68
|
+
else
|
|
69
|
+
puts "!! ERROR - cannot find bytes in inscription content length; sorry"
|
|
70
|
+
pp data
|
|
71
|
+
exit 1
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
if bytes < 100 then @stats[:bytes]['<100'] += 1
|
|
75
|
+
elsif bytes < 1000 then @stats[:bytes]['<1000'] += 1
|
|
76
|
+
elsif bytes < 10000 then @stats[:bytes]['<10000'] += 1
|
|
77
|
+
elsif bytes < 100000 then @stats[:bytes]['<100000'] += 1
|
|
78
|
+
elsif bytes < 1000000 then @stats[:bytes]['<1000000'] += 1
|
|
79
|
+
else
|
|
80
|
+
puts "!! ERROR bytes (content-length) out-of-bounds"
|
|
81
|
+
exit 1
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
## update min/max
|
|
85
|
+
@stats[:bytes]['min'] = bytes if bytes < (@stats[:bytes]['min'] || 9999999)
|
|
86
|
+
@stats[:bytes]['max'] = bytes if bytes > (@stats[:bytes]['max'] || -1)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
type = data['content type']
|
|
90
|
+
|
|
91
|
+
@stats[:type][ type ] += 1
|
|
92
|
+
|
|
93
|
+
## "timestamp"=>"2023-02-05 01:45:22 UTC",
|
|
94
|
+
ts = Time.strptime( data['timestamp'], '%Y-%m-%d %H:%M:%S' )
|
|
95
|
+
|
|
96
|
+
@days[ ts.strftime('%Y-%m-%d') ] +=1
|
|
97
|
+
end # method update
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def data ## rename to model or such - why? why not?
|
|
101
|
+
## sort days
|
|
102
|
+
days = @days.sort {|l,r| l[0] <=> r[0] }
|
|
103
|
+
## add to stats
|
|
104
|
+
@stats[:days] = {}
|
|
105
|
+
days.each {|k,v| @stats[:days][k] = v }
|
|
106
|
+
@stats
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
=begin
|
|
110
|
+
{:count=>101,
|
|
111
|
+
:ord=>{"<1000"=>0, "<10000"=>0, "<100000"=>101, "<1000000"=>0, "min"=>14343, "max"=>42901},
|
|
112
|
+
:type=>{"image/png"=>101},
|
|
113
|
+
:bytes=>{"<100"=>0, "<1000"=>101, "<10000"=>0, "<100000"=>0, "<1000000"=>0, "min"=>274, "max"=>512},
|
|
114
|
+
:days=>{"2023-02-22"=>10, "2023-02-25"=>17, "2023-02-26"=>74}}
|
|
115
|
+
=end
|
|
116
|
+
|
|
117
|
+
def format ## rename to pretty_print or such - why? why not?
|
|
118
|
+
stat = data
|
|
119
|
+
|
|
120
|
+
buf = String.new('')
|
|
121
|
+
buf << "#{stat[:count]} inscription(s)\n"
|
|
122
|
+
|
|
123
|
+
buf << "- from ##{stat[:ord]['min']} to ##{stat[:ord]['max']} (min. to max.)\n"
|
|
124
|
+
buf << " - <100 => #{stat[:ord]['<100']}\n" if stat[:ord]["<100"] > 0
|
|
125
|
+
buf << " - <1000 => #{stat[:ord]['<1000']}\n" if stat[:ord]["<1000"] > 0
|
|
126
|
+
buf << " - <10000 => #{stat[:ord]['<10000']}\n" if stat[:ord]["<10000"] > 0
|
|
127
|
+
buf << " - <100000 => #{stat[:ord]['<100000']}\n" if stat[:ord]["<100000"] > 0
|
|
128
|
+
buf << " - <1000000 => #{stat[:ord]['<1000000']}\n" if stat[:ord]["<1000000"] > 0
|
|
129
|
+
|
|
130
|
+
buf << "- format(s)\n"
|
|
131
|
+
stat[:type].each do |k,v|
|
|
132
|
+
buf << " - #{k} => #{v}\n"
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
buf << "- day(s)\n"
|
|
136
|
+
stat[:days].each do |k,v|
|
|
137
|
+
buf << " - #{k} => #{v}\n"
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
buf
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
end ## class InscriptionStats
|
|
144
|
+
|
|
145
|
+
|
data/lib/ordinals.rb
CHANGED
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.0.
|
|
4
|
+
version: 1.0.3
|
|
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-
|
|
11
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cocos
|
|
@@ -74,7 +74,7 @@ dependencies:
|
|
|
74
74
|
version: '3.23'
|
|
75
75
|
description: ordinals gem - ordinals (inscription) api wrapper & helpers for Bitcoin,
|
|
76
76
|
Litecoin, Dogecoin & co.
|
|
77
|
-
email:
|
|
77
|
+
email: gerald.bauer@gmail.com
|
|
78
78
|
executables: []
|
|
79
79
|
extensions: []
|
|
80
80
|
extra_rdoc_files:
|
|
@@ -88,7 +88,8 @@ files:
|
|
|
88
88
|
- Rakefile
|
|
89
89
|
- lib/ordinals.rb
|
|
90
90
|
- lib/ordinals/api.rb
|
|
91
|
-
|
|
91
|
+
- lib/ordinals/stats.rb
|
|
92
|
+
homepage: https://github.com/ordbase/ordbase
|
|
92
93
|
licenses:
|
|
93
94
|
- Public Domain
|
|
94
95
|
metadata: {}
|