ordinals 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +86 -3
- data/Rakefile +1 -1
- data/lib/ordinals.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a362c24bda8951706799ad74ddd75b148b94353166d4bf807b2b929ec1c1a1
|
4
|
+
data.tar.gz: ee12466f380d678b7f652a33a4035fb66e593ece071d5489777abf121c1fbef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73cf537fef77274ef1a6acb568fe2a516bec3c4cf3eeceef32e51e8e43df27cbf8236d304897b957a462f1946466db2b38d79969d5ad9228e917a99d32189c4b
|
7
|
+
data.tar.gz: f45716b1e22dcdc42542e5972c1df9635272af900187ce61796d9cf5916a785c65d9c8bca74943733d069b80d7f3acaed78e231820a9a58ad806d31387cb7470
|
data/README.md
CHANGED
@@ -12,9 +12,92 @@ ordinals gem - ordinals (inscription) api wrapper & helpers for Bitcoin, Litcoin
|
|
12
12
|
## Usage
|
13
13
|
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
For now ordinal inscription api queries are supported on
|
16
|
+
- Bitcoin (via <https://ordinals.com>)
|
17
|
+
- Litecoin (via <https://litecoin.earlyordies.com>) and
|
18
|
+
- Dogecoin (via <https://doginals.com>)
|
19
|
+
|
20
|
+
|
21
|
+
Let's start querying for bitcoin (btc) ordinal inscriptions:
|
22
|
+
|
23
|
+
``` ruby
|
24
|
+
require 'ordinals'
|
25
|
+
|
26
|
+
|
27
|
+
# get the inscription binary blob / data by id
|
28
|
+
# e.g. GET https://ordinals.com/content/c41021cb11dce003e6a20a3420cf5954a1d104a1fe314393b915a62f020dcd0ai0...
|
29
|
+
|
30
|
+
id = 'c41021cb11dce003e6a20a3420cf5954a1d104a1fe314393b915a62f020dcd0ai0'
|
31
|
+
content = Ordinals.content( id )
|
32
|
+
pp content
|
33
|
+
#=> #<Ordinals::Api::Content:0x000001a1352df938
|
34
|
+
# @data="RIFF\xF8\v\x00\x00WEBPVP8 \xEC\v\x00\x00...",
|
35
|
+
# @length=3072,
|
36
|
+
# @type="image/png">
|
37
|
+
|
38
|
+
# get the inscription meta data by id
|
39
|
+
# e.g. https://ordinals.com/inscription/c41021cb11dce003e6a20a3420cf5954a1d104a1fe314393b915a62f020dcd0ai0...
|
40
|
+
data = Ordinals.inscription( id )
|
41
|
+
pp data
|
42
|
+
#=> {"title"=>"Inscription 133993",
|
43
|
+
# "id"=>"c41021cb11dce003e6a20a3420cf5954a1d104a1fe314393b915a62f020dcd0ai0",
|
44
|
+
# "address"=>"bc1pyncs638hxfhaqjvnedw2lyc2jta6zuvr9erj6m9cwlghp6qqwvhqeq574l",
|
45
|
+
# "output value"=>"9667",
|
46
|
+
# "sat"=>"1391087135005306",
|
47
|
+
# "preview"=>"link",
|
48
|
+
# "content"=>"link",
|
49
|
+
# "content length"=>"3072 bytes",
|
50
|
+
# "content type"=>"image/png",
|
51
|
+
# "timestamp"=>"2023-02-18 03:02:18 UTC",
|
52
|
+
# "genesis height"=>"777099",
|
53
|
+
# "genesis fee"=>"1814",
|
54
|
+
# "genesis transaction"=>"c41021cb11dce003e6a20a3420cf5954a1d104a1fe314393b915a62f020dcd0a",
|
55
|
+
# "location"=>"6a57dedb854c9bcac3fd2daab1172dd9a45f24c366dd8db33fe80557f11c6b39:22:0",
|
56
|
+
# "output"=>"6a57dedb854c9bcac3fd2daab1172dd9a45f24c366dd8db33fe80557f11c6b39:22",
|
57
|
+
# "offset"=>"0"}
|
58
|
+
```
|
59
|
+
|
60
|
+
|
61
|
+
Let's try querying for litecoin (ltc) ordinal inscriptions:
|
62
|
+
|
63
|
+
``` ruby
|
64
|
+
Ordinals.chain = :ltc
|
65
|
+
|
66
|
+
|
67
|
+
# get the inscription binary blob / data by id
|
68
|
+
# e.g. GET https://litecoin.earlyordies.com/inscription/f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4i0...
|
69
|
+
|
70
|
+
id = 'f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4i0'
|
71
|
+
content = Ordinals.content( id )
|
72
|
+
pp content
|
73
|
+
#=> #<Ordinals::Api::Content:0x000001a1357fd6e0
|
74
|
+
# @data="\x89PNG\r\n\x1A\n\x00\x00\x00...",
|
75
|
+
# @length=816,
|
76
|
+
# @type="image/png">
|
77
|
+
|
78
|
+
|
79
|
+
# get the inscription meta data by id
|
80
|
+
# e.g GET https://litecoin.earlyordies.com/inscription/f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4i0...
|
81
|
+
data = Ordinals.inscription( id )
|
82
|
+
pp data
|
83
|
+
#=> {"title"=>"Inscription 642",
|
84
|
+
# "id"=>"f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4i0",
|
85
|
+
# "address"=>"LSDz4fM4mLFyAZVoDuKyMHYq3af6cSZGSY",
|
86
|
+
# "output value"=>"9878",
|
87
|
+
# "preview"=>"link",
|
88
|
+
# "content"=>"link",
|
89
|
+
# "content length"=>"816 bytes",
|
90
|
+
# "content type"=>"image/png",
|
91
|
+
# "timestamp"=>"2023-02-21 05:29:33 UTC",
|
92
|
+
# "genesis height"=>"2426201",
|
93
|
+
# "genesis fee"=>"361",
|
94
|
+
# "genesis transaction"=>"f2b6adf7b2d0f128fb14817ff37f5f36e9176b17571e20c49871875553f937b4",
|
95
|
+
# "location"=>"6802c71b49f18aab91d0b363762b24afb1bf00c4820a5f782de6dd1b1cfbd68a:0:0",
|
96
|
+
# "output"=>"6802c71b49f18aab91d0b363762b24afb1bf00c4820a5f782de6dd1b1cfbd68a:0",
|
97
|
+
# "offset"=>"0"}
|
98
|
+
```
|
99
|
+
|
100
|
+
That's it for now.
|
18
101
|
|
19
102
|
|
20
103
|
|
data/Rakefile
CHANGED
data/lib/ordinals.rb
CHANGED
@@ -54,8 +54,10 @@ module Ordinals
|
|
54
54
|
def self.config() @config ||= Configuration.new; end
|
55
55
|
|
56
56
|
## add some convenience shortcut helpers (no config. required) - why? why not?
|
57
|
-
def self.client()
|
58
|
-
def self.chain()
|
57
|
+
def self.client() config.client; end
|
58
|
+
def self.chain() config.chain; end
|
59
|
+
def self.chain=(value) config.chain = value; end
|
60
|
+
|
59
61
|
|
60
62
|
def self.btc?() config.chain == 'btc'; end
|
61
63
|
def self.ltc?() config.chain == 'ltc'; end
|
@@ -70,6 +72,12 @@ module Ordinals
|
|
70
72
|
alias_method :dogecoin?, :doge?
|
71
73
|
alias_method :dogecon?, :doge?
|
72
74
|
end
|
75
|
+
|
76
|
+
|
77
|
+
###################
|
78
|
+
### more convenience shortcuts
|
79
|
+
def self.inscription( id ) client.inscription( id ); end
|
80
|
+
def self.content( id ) client.content( id ); end
|
73
81
|
end # module Ordinals
|
74
82
|
|
75
83
|
|