scribelite 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Manifest.txt +3 -2
- data/README.md +110 -0
- data/Rakefile +2 -1
- data/lib/scribelite/importer.rb +91 -0
- data/lib/scribelite/models/forward.rb +2 -2
- data/lib/scribelite/models/{inscribe.rb → scribe.rb} +58 -83
- data/lib/scribelite/models/{calldata.rb → tx.rb} +3 -4
- data/lib/scribelite/schema.rb +19 -20
- data/lib/scribelite/version.rb +2 -2
- data/lib/scribelite.rb +19 -8
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8423f47a4a80b7687f04a31e0457500faa3b52e48a40e239377f0877271aface
|
4
|
+
data.tar.gz: 86413fdd0e42317307cb97f0989fca3f8b82736539d4333687ff6c9f158f5915
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfb49887358be1a89b68c855cdce8a0c2dbafa3439f76a0ef0c8dea47ceb00316d73d82577ba01f8112a839d7dc468e312ebcc9c4e0882f7f50fd3c5b560ae9e
|
7
|
+
data.tar.gz: d77a2a72689f2e49292edbcb4c02f74b96b1135a2ccf32a33c20c6e3bd79c12288143f8237ef4e06305d9bfa95c9fd5f7934ca36d1f521284d5269c2a8460cc4
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
@@ -3,8 +3,9 @@ Manifest.txt
|
|
3
3
|
README.md
|
4
4
|
Rakefile
|
5
5
|
lib/scribelite.rb
|
6
|
-
lib/scribelite/
|
6
|
+
lib/scribelite/importer.rb
|
7
7
|
lib/scribelite/models/forward.rb
|
8
|
-
lib/scribelite/models/
|
8
|
+
lib/scribelite/models/scribe.rb
|
9
|
+
lib/scribelite/models/tx.rb
|
9
10
|
lib/scribelite/schema.rb
|
10
11
|
lib/scribelite/version.rb
|
data/README.md
CHANGED
@@ -19,11 +19,121 @@ See [Introducing Ethscriptions - A new way of creating and sharing digital artif
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
+
The work-in-progess database schema looks like:
|
23
|
+
|
24
|
+
``` ruby
|
25
|
+
ActiveRecord::Schema.define do
|
26
|
+
|
27
|
+
create_table :scribes, :id => :string do |t|
|
28
|
+
t.integer :num, null: false, index: { unique: true, name: 'scribe_nums' }
|
29
|
+
t.integer :bytes
|
30
|
+
t.string :content_type
|
31
|
+
## add allow duplicate opt-in protocol flag e.g. esip6
|
32
|
+
t.boolean :duplicate ## allows duplicates flag
|
33
|
+
t.boolean :flagged, null: false, default: false ## censored flag / removed on request
|
34
|
+
t.string :sha, null: false ## sha hash as hexstring (but no leading 0)
|
35
|
+
end
|
36
|
+
|
37
|
+
create_table :txs, :id => :string do |t|
|
38
|
+
t.binary :data # , null: false
|
39
|
+
t.datetime :date, null: false
|
40
|
+
t.integer :block, null: false
|
41
|
+
t.integer :idx, null: false ## transaction index (number)
|
42
|
+
|
43
|
+
t.string :from, null: false
|
44
|
+
t.string :to, null: false
|
45
|
+
|
46
|
+
t.integer :fee
|
47
|
+
t.integer :value
|
48
|
+
end
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
|
53
|
+
and to setup use it like:
|
54
|
+
|
55
|
+
``` ruby
|
56
|
+
require 'scribelite'
|
57
|
+
|
58
|
+
ScribeDb.connect( adapter: 'sqlite3',
|
59
|
+
database: './scribe.db' )
|
60
|
+
|
61
|
+
ScribeDb.create_all ## build schema
|
62
|
+
```
|
63
|
+
|
64
|
+
and lets import the first hundred (page size is 25) ethscriptions on mainnet (via the ethscriptions.com api):
|
65
|
+
|
66
|
+
|
67
|
+
``` ruby
|
68
|
+
require 'scribelite'
|
69
|
+
|
70
|
+
ScribeDb.open( './scribe.db' )
|
71
|
+
|
72
|
+
(1..4).each do |page|
|
73
|
+
ScribeDb.import_ethscriptions( page: page )
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
and to query use it like:
|
80
|
+
|
81
|
+
``` ruby
|
82
|
+
require 'scribelite'
|
83
|
+
|
84
|
+
ScribeDb.open( './scribe.db' )
|
85
|
+
|
86
|
+
puts
|
87
|
+
puts " #{Scribe.count} scribe(s)"
|
88
|
+
puts " #{Tx.count} tx(s)"
|
89
|
+
|
90
|
+
|
91
|
+
## how many flagged in top 100?
|
92
|
+
limit = 100
|
93
|
+
|
94
|
+
flagged_count = Scribe.order( :num ).limit(limit).where( flagged: true ).count
|
95
|
+
pp flagged_count #=> 75 !!!!!!!!!
|
96
|
+
unflagged_count = Scribe.order( :num).limit(limit).where( flagged: false ).count
|
97
|
+
pp unflagged_count #=> 25
|
98
|
+
|
99
|
+
|
100
|
+
Scribe.order( :num ).limit(limit).each do |scribe|
|
101
|
+
if scribe.flagged?
|
102
|
+
print " xx "
|
103
|
+
else
|
104
|
+
print "==> "
|
105
|
+
end
|
106
|
+
print "#{scribe.num} / #{scribe.content_type} - #{scribe.tx.date} @ #{scribe.tx.block}"
|
107
|
+
print "\n"
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
## Let's query for all inscriptions grouped by date (day)
|
112
|
+
## and dump the results:
|
113
|
+
pp Scribe.counts_by_day
|
114
|
+
pp Scribe.counts_by_year
|
115
|
+
pp Scribe.counts_by_month
|
116
|
+
pp Scribe.counts_by_hour
|
117
|
+
|
118
|
+
|
119
|
+
## Let's query for all content types and group by count (descending)
|
120
|
+
## and dump the results:
|
121
|
+
pp Scribe.counts_by_content_type
|
122
|
+
|
123
|
+
pp Scribe.counts_by_block
|
124
|
+
pp Scribe.counts_by_block_with_timestamp
|
125
|
+
|
126
|
+
pp Scribe.counts_by_address # from (creator/minter) address
|
127
|
+
|
128
|
+
# ...
|
129
|
+
```
|
130
|
+
|
22
131
|
To be continued...
|
23
132
|
|
24
133
|
|
25
134
|
|
26
135
|
|
136
|
+
|
27
137
|
## Bonus - More Blockchain (Crypto) Tools, Libraries & Scripts In Ruby
|
28
138
|
|
29
139
|
See [**/blockchain**](https://github.com/rubycocos/blockchain)
|
data/Rakefile
CHANGED
@@ -18,7 +18,8 @@ Hoe.spec 'scribelite' do
|
|
18
18
|
self.history_file = 'CHANGELOG.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['ethscribe'],
|
21
|
+
['ethscribe'],
|
22
|
+
['calldata'], ## todo - check if included via ethscribe in the future?
|
22
23
|
['activerecord'],
|
23
24
|
['activerecord-utils'],
|
24
25
|
['logutils'],
|
@@ -0,0 +1,91 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module ScribeDb
|
4
|
+
|
5
|
+
## note: by default - sort asc(ending) - oldest first (0,1,2,3, .etc.)
|
6
|
+
def self.import_ethscriptions( page: 1, sort_order: 'asc' )
|
7
|
+
net = Ethscribe::Api.mainnet
|
8
|
+
recs = net.ethscriptions( page: page, sort_order: sort_order )
|
9
|
+
|
10
|
+
recs.each_with_index do |rec,i|
|
11
|
+
puts "==> page #{page}/#{i+1} - #{rec['transaction_hash']}..."
|
12
|
+
|
13
|
+
txid = rec['transaction_hash']
|
14
|
+
block = rec['block_number']
|
15
|
+
idx = rec['transaction_index']
|
16
|
+
|
17
|
+
from = rec['creator']
|
18
|
+
to = rec['initial_owner']
|
19
|
+
|
20
|
+
## todo - double check if daylight saving time (dst) breaks timestamp == utc identity/conversion?
|
21
|
+
## 2001-02-03T04:05:06+07:00
|
22
|
+
## 2016-05-29T22:28:15.000Z
|
23
|
+
## check if %z can handle .000Z ??
|
24
|
+
## DateTime.strptime( '2016-05-29T22:28:15.000Z', '%Y-%m-%dT%H:%M:%S%z' )
|
25
|
+
## pp rec['creation_timestamp']
|
26
|
+
date = DateTime.strptime( rec['creation_timestamp'], '%Y-%m-%dT%H:%M:%S.000Z' )
|
27
|
+
|
28
|
+
|
29
|
+
num = rec['ethscription_number']
|
30
|
+
content_type = rec['mimetype']
|
31
|
+
data = rec['content_uri']
|
32
|
+
sha = rec['sha']
|
33
|
+
|
34
|
+
duplicate = rec['esip6']
|
35
|
+
flagged = rec['image_removed_by_request_of_rights_holder']
|
36
|
+
|
37
|
+
### check - if flagged
|
38
|
+
## content_type always set to text/plain
|
39
|
+
## and data to data:, ???
|
40
|
+
## (re)set to nil/null - why? why not?
|
41
|
+
if flagged
|
42
|
+
data = nil
|
43
|
+
content_type = nil
|
44
|
+
end
|
45
|
+
|
46
|
+
tx_attribs = {
|
47
|
+
id: txid,
|
48
|
+
block: block,
|
49
|
+
idx: idx,
|
50
|
+
date: date,
|
51
|
+
from: from,
|
52
|
+
to: to,
|
53
|
+
data: data, ## note: for now saved as utf8 string (not hex!!!!)
|
54
|
+
}
|
55
|
+
|
56
|
+
scribe_attribs = {
|
57
|
+
id: txid,
|
58
|
+
num: num,
|
59
|
+
content_type: content_type,
|
60
|
+
duplicate: duplicate,
|
61
|
+
flagged: flagged,
|
62
|
+
sha: sha,
|
63
|
+
bytes: data ? data.length : nil ## auto-add/calc bytes (content length)
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
scribe = Scribe.find_by( id: txid )
|
70
|
+
if scribe
|
71
|
+
## skip for now - found id db
|
72
|
+
else
|
73
|
+
puts "scribe_attribs:"
|
74
|
+
pp scribe_attribs
|
75
|
+
Scribe.create!( **scribe_attribs )
|
76
|
+
end
|
77
|
+
|
78
|
+
tx = Tx.find_by( id: txid )
|
79
|
+
if tx
|
80
|
+
## skip for now - found id db
|
81
|
+
else
|
82
|
+
puts "tx_attribs:"
|
83
|
+
pp tx_attribs
|
84
|
+
Tx.create!( **tx_attribs )
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end # method import_ethscriptions
|
89
|
+
|
90
|
+
end # module ScribeDb
|
91
|
+
|
@@ -2,8 +2,8 @@
|
|
2
2
|
module ScribeDb
|
3
3
|
module Model
|
4
4
|
|
5
|
-
class
|
6
|
-
has_one :
|
5
|
+
class Scribe < ActiveRecord::Base
|
6
|
+
has_one :tx, foreign_key: 'id'
|
7
7
|
|
8
8
|
## convernience helper
|
9
9
|
## forward to blob.content
|
@@ -17,7 +17,8 @@ module ScribeDb
|
|
17
17
|
### scope like helpers
|
18
18
|
def self.png() where( content_type: 'image/png' ); end
|
19
19
|
def self.gif() where( content_type: 'image/gif' ); end
|
20
|
-
def self.jpg() where( content_type: 'image/jpeg'
|
20
|
+
def self.jpg() where( content_type: ['image/jpeg',
|
21
|
+
'image/jpg'] ); end
|
21
22
|
def self.webp() where( content_type: 'image/webp' ); end
|
22
23
|
def self.svg() where( content_type: 'image/svg+xml' ); end
|
23
24
|
def self.avif() where( content_type: 'image/avif' ); end
|
@@ -31,6 +32,7 @@ module ScribeDb
|
|
31
32
|
where( content_type: [
|
32
33
|
'image/png',
|
33
34
|
'image/jpeg',
|
35
|
+
'image/jpg',
|
34
36
|
'image/gif',
|
35
37
|
'image/webp',
|
36
38
|
'image/svg+xml',
|
@@ -98,91 +100,64 @@ module ScribeDb
|
|
98
100
|
.order( Arel.sql( 'COUNT(*) DESC, content_type')).count
|
99
101
|
end
|
100
102
|
|
101
|
-
|
102
|
-
|
103
|
-
|
103
|
+
|
104
|
+
def self.block_counts
|
105
|
+
joins(:tx).group( 'block' )
|
106
|
+
.order( 'block').count
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.block_with_timestamp_counts
|
110
|
+
joins(:tx).group( Arel.sql( "block || ' @ ' || date" ))
|
111
|
+
.order( 'block' ).count
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
def self.date_counts
|
116
|
+
## note: strftime is SQLite specific/only!!!
|
117
|
+
joins(:tx).group( Arel.sql("strftime('%Y-%m-%d', date)"))
|
118
|
+
.order( Arel.sql("strftime('%Y-%m-%d', date)")).count
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.month_counts
|
122
|
+
## note: strftime is SQLite specific/only!!!
|
123
|
+
joins(:tx).group( Arel.sql("strftime('%Y-%m', date)"))
|
124
|
+
.order( Arel.sql("strftime('%Y-%m', date)")).count
|
104
125
|
end
|
105
126
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
## see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
111
|
-
## for real-world usage, see https://dune.com/dgtl_assets/bitcoin-ordinals-analysis
|
112
|
-
## https://github.com/casey/ord/blob/master/src/media.rs
|
113
|
-
|
114
|
-
if content_type.start_with?( 'text/plain' )
|
115
|
-
'.txt'
|
116
|
-
elsif content_type.start_with?( 'text/markdown' )
|
117
|
-
'.md'
|
118
|
-
elsif content_type.start_with?( 'text/html' )
|
119
|
-
'.html'
|
120
|
-
elsif content_type.start_with?( 'text/javascript' ) ||
|
121
|
-
content_type.start_with?( 'application/javascript' )
|
122
|
-
## note: application/javascript is considered bad practice/legacy
|
123
|
-
'.js'
|
124
|
-
elsif content_type.start_with?( 'image/png' )
|
125
|
-
## Portable Network Graphics (PNG)
|
126
|
-
'.png'
|
127
|
-
elsif content_type.start_with?( 'image/jpeg' )
|
128
|
-
## Joint Photographic Expert Group image (JPEG)
|
129
|
-
'.jpg' ## use jpeg - why? why not?
|
130
|
-
elsif content_type.start_with?( 'image/webp' )
|
131
|
-
## Web Picture format (WEBP)
|
132
|
-
'.webp' ## note: no three-letter extension available
|
133
|
-
elsif content_type.start_with?( 'image/svg' )
|
134
|
-
## Scalable Vector Graphics (SVG)
|
135
|
-
'.svg'
|
136
|
-
elsif content_type.start_with?( 'image/gif' )
|
137
|
-
## Graphics Interchange Format (GIF)
|
138
|
-
'.gif'
|
139
|
-
elsif content_type.start_with?( 'image/avif' )
|
140
|
-
## AV1 Image File Format (AVIF)
|
141
|
-
'.avif'
|
142
|
-
elsif content_type.start_with?( 'application/epub' )
|
143
|
-
'.epub'
|
144
|
-
elsif content_type.start_with?( 'application/pdf' )
|
145
|
-
'.pdf'
|
146
|
-
elsif content_type.start_with?( 'application/json' )
|
147
|
-
'.json'
|
148
|
-
elsif content_type.start_with?( 'application/pgp-signature' )
|
149
|
-
'.sig'
|
150
|
-
elsif content_type.start_with?( 'audio/mpeg' )
|
151
|
-
'.mp3'
|
152
|
-
elsif content_type.start_with?( 'audio/midi' )
|
153
|
-
'.midi'
|
154
|
-
elsif content_type.start_with?( 'video/mp4' )
|
155
|
-
'.mp4'
|
156
|
-
elsif content_type.start_with?( 'video/webm' )
|
157
|
-
'.wepm'
|
158
|
-
elsif content_type.start_with?( 'audio/mod' )
|
159
|
-
## is typo? possible? only one inscription in 20m?
|
160
|
-
'.mod' ## check/todo/fix if is .wav??
|
161
|
-
else
|
162
|
-
puts "!! ERROR - no file extension configured for content type >#{content_type}<; sorry:"
|
163
|
-
pp self
|
164
|
-
exit 1
|
127
|
+
def self.year_counts
|
128
|
+
## note: strftime is SQLite specific/only!!!
|
129
|
+
joins(:tx).group( Arel.sql("strftime('%Y', date)"))
|
130
|
+
.order( Arel.sql("strftime('%Y', date)")).count
|
165
131
|
end
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
"./tmp/#{numstr}#{extname}"
|
172
|
-
end
|
173
|
-
def export( path=export_path )
|
174
|
-
if blob
|
175
|
-
write_blob( path, blob.content )
|
176
|
-
else
|
177
|
-
## todo/fix: raise exception - no content
|
178
|
-
puts "!! ERROR - inscribe has no content (blob); sorry:"
|
179
|
-
pp self
|
180
|
-
exit 1
|
132
|
+
|
133
|
+
def self.hour_counts
|
134
|
+
## note: strftime is SQLite specific/only!!!
|
135
|
+
joins(:tx).group( Arel.sql("strftime('%Y-%m-%d %Hh', date)"))
|
136
|
+
.order( Arel.sql("strftime('%Y-%m-%d %Hh', date)")).count
|
181
137
|
end
|
182
|
-
end
|
183
|
-
=end
|
184
138
|
|
185
|
-
|
139
|
+
|
140
|
+
def self.from_counts
|
141
|
+
## note: from is sql keyword!!!
|
142
|
+
## wrap in [] for sqlite - check if works for others!!!
|
143
|
+
joins(:tx).group( '[from]' )
|
144
|
+
.order( Arel.sql( 'COUNT(*) DESC')).count
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
class << self
|
149
|
+
alias_method :biggest, :largest
|
150
|
+
alias_method :counts_by_content_type, :content_type_counts
|
151
|
+
alias_method :counts_by_date, :date_counts
|
152
|
+
alias_method :counts_by_day, :date_counts
|
153
|
+
alias_method :counts_by_month, :month_counts
|
154
|
+
alias_method :counts_by_year, :year_counts
|
155
|
+
alias_method :counts_by_hour, :hour_counts
|
156
|
+
alias_method :counts_by_block, :block_counts
|
157
|
+
alias_method :counts_by_block_with_timestamp, :block_with_timestamp_counts
|
158
|
+
alias_method :counts_by_address, :from_counts
|
159
|
+
end
|
160
|
+
end # class Scribe
|
186
161
|
|
187
162
|
end # module Model
|
188
163
|
end # module ScribeDb
|
@@ -2,17 +2,16 @@
|
|
2
2
|
module ScribeDb
|
3
3
|
module Model
|
4
4
|
|
5
|
-
class
|
6
|
-
self.table_name = '
|
5
|
+
class Tx < ActiveRecord::Base
|
6
|
+
self.table_name = 'txs' ## note auto-infers txes change to txs
|
7
7
|
|
8
8
|
belongs_to :inscribe, foreign_key: 'id'
|
9
|
-
|
10
9
|
=begin
|
11
10
|
def text
|
12
11
|
content.force_encoding(Encoding::UTF_8)
|
13
12
|
end
|
14
13
|
=end
|
15
|
-
end # class
|
14
|
+
end # class Tx
|
16
15
|
|
17
16
|
end # module Model
|
18
17
|
end # module ScribeDb
|
data/lib/scribelite/schema.rb
CHANGED
@@ -8,15 +8,15 @@ def up
|
|
8
8
|
|
9
9
|
ActiveRecord::Schema.define do
|
10
10
|
|
11
|
-
create_table :
|
11
|
+
create_table :scribes, :id => :string do |t|
|
12
12
|
## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0",
|
13
13
|
## note: change to uuid (universally unique id) - why? why not?
|
14
14
|
## id gets used by row_id (internal orm db machinery) and is int
|
15
|
-
## t.string :uuid, null: false, index: { unique: true, name: '
|
15
|
+
## t.string :uuid, null: false, index: { unique: true, name: 'scribe_uuids' }
|
16
16
|
|
17
17
|
## "title": "Inscription 10371414",
|
18
18
|
## note: use num/no. from title only - why? why not?
|
19
|
-
t.integer :num, null: false, index: { unique: true, name: '
|
19
|
+
t.integer :num, null: false, index: { unique: true, name: 'scribe_nums' }
|
20
20
|
|
21
21
|
## "content length": "85 bytes",
|
22
22
|
## note: extract bytes as integer!!!
|
@@ -25,11 +25,14 @@ create_table :inscribes, :id => :string do |t|
|
|
25
25
|
## "content type": "text/plain;charset=utf-8",
|
26
26
|
## note: make sure always lower/down case!!!
|
27
27
|
t.string :content_type
|
28
|
-
|
29
|
-
|
28
|
+
|
30
29
|
## add allow duplicate opt-in protocol flag e.g. esip6
|
31
|
-
|
32
|
-
|
30
|
+
t.boolean :duplicate ## allows duplicates flag - make duplicate the default - why? why not?
|
31
|
+
t.boolean :flagged, null: false, default: false ## censored flag / removed on request
|
32
|
+
|
33
|
+
## move sha to tx - why? why not?
|
34
|
+
t.string :sha # , null: false ## sha hash as hexstring
|
35
|
+
|
33
36
|
## timestamp last
|
34
37
|
t.timestamps
|
35
38
|
end
|
@@ -37,14 +40,13 @@ end
|
|
37
40
|
|
38
41
|
## change to tx/txs or txn/txns - why? why not?
|
39
42
|
|
40
|
-
create_table :
|
43
|
+
create_table :txs, :id => :string do |t|
|
41
44
|
## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0",
|
42
45
|
## note: change to uuid (universally unique id) - why? why not?
|
43
46
|
## id gets used by row_id (internal orm db machinery) and is int
|
44
47
|
## t.string :id, null: false, index: { unique: true, name: 'blob_uuids' }
|
45
48
|
|
46
|
-
t.binary :data
|
47
|
-
t.string :sha # , null: false ## sha hash as hexstring
|
49
|
+
t.binary :data # , null: false
|
48
50
|
|
49
51
|
## "timestamp": "2023-06-01 05:00:57 UTC"
|
50
52
|
## or use date_utc ???
|
@@ -52,19 +54,16 @@ create_table :calldatas, :id => :string do |t|
|
|
52
54
|
t.datetime :date, null: false
|
53
55
|
|
54
56
|
t.integer :block, null: false
|
55
|
-
t.integer :
|
56
|
-
t.integer :value
|
57
|
+
t.integer :idx, null: false ## transaction index (number)
|
57
58
|
|
58
|
-
###
|
59
|
-
## "address": "bc1p3h4eecuxjj2g72sq38gyva732866u5w29lhxgeqfe6c0sg8xmagsuau63k",
|
60
|
-
## is this minter/inscriber addr???
|
61
|
-
## change to minter?? or such - why? why not?
|
62
|
-
## creator
|
63
59
|
t.string :from, null: false
|
60
|
+
t.string :to, null: false
|
64
61
|
|
65
|
-
|
66
|
-
t.
|
67
|
-
|
62
|
+
t.integer :fee
|
63
|
+
t.integer :value
|
64
|
+
|
65
|
+
|
66
|
+
## timestamp last
|
68
67
|
t.timestamps
|
69
68
|
end
|
70
69
|
|
data/lib/scribelite/version.rb
CHANGED
data/lib/scribelite.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
|
2
2
|
# core and stlibs
|
3
3
|
require 'ethscribe' ## will pull-in cocos & friends
|
4
|
-
|
4
|
+
require 'calldata'
|
5
5
|
|
6
6
|
|
7
7
|
require 'logger' # Note: use for ActiveRecord::Base.logger -- remove/replace later w/ LogUtils::Logger ???
|
8
|
+
require 'date' ## check if date & datetime required ??
|
8
9
|
|
9
10
|
|
10
11
|
# 3rd party gems / libs
|
@@ -27,14 +28,12 @@ require_relative 'scribelite/version' # always goes first
|
|
27
28
|
|
28
29
|
require_relative 'scribelite/models/forward'
|
29
30
|
|
30
|
-
require_relative 'scribelite/models/
|
31
|
-
require_relative 'scribelite/models/
|
31
|
+
require_relative 'scribelite/models/scribe'
|
32
|
+
require_relative 'scribelite/models/tx'
|
32
33
|
|
33
34
|
|
34
35
|
require_relative 'scribelite/schema'
|
35
36
|
|
36
|
-
# require_relative 'cache'
|
37
|
-
# require_relative 'importer' ## note: require (soft dep) ordinals gems!!!
|
38
37
|
|
39
38
|
|
40
39
|
|
@@ -66,7 +65,7 @@ module ScribeDb
|
|
66
65
|
ConfDb.create # add props table
|
67
66
|
end
|
68
67
|
|
69
|
-
unless ScribeDb::Model::
|
68
|
+
unless ScribeDb::Model::Scribe.table_exists?
|
70
69
|
ScribeDb.create
|
71
70
|
end
|
72
71
|
end # method auto_migrate!
|
@@ -133,11 +132,23 @@ end # module ScribeDb
|
|
133
132
|
|
134
133
|
|
135
134
|
|
135
|
+
# add ethscriptions / ethscripe importer - why? why not?
|
136
|
+
require_relative 'scribelite/importer'
|
137
|
+
|
138
|
+
|
139
|
+
|
136
140
|
|
137
141
|
|
138
142
|
## add convenience helpers
|
139
|
-
|
140
|
-
|
143
|
+
Scribe = ScribeDb::Model::Scribe
|
144
|
+
Tx = ScribeDb::Model::Tx
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
require 'active_support/number_helper'
|
149
|
+
include ActiveSupport::NumberHelper ## e.g. number_to_human_size
|
150
|
+
|
151
|
+
|
141
152
|
|
142
153
|
|
143
154
|
# say hello
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scribelite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.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-11-
|
11
|
+
date: 2023-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ethscribe
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: calldata
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: activerecord
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,9 +185,10 @@ files:
|
|
171
185
|
- README.md
|
172
186
|
- Rakefile
|
173
187
|
- lib/scribelite.rb
|
174
|
-
- lib/scribelite/
|
188
|
+
- lib/scribelite/importer.rb
|
175
189
|
- lib/scribelite/models/forward.rb
|
176
|
-
- lib/scribelite/models/
|
190
|
+
- lib/scribelite/models/scribe.rb
|
191
|
+
- lib/scribelite/models/tx.rb
|
177
192
|
- lib/scribelite/schema.rb
|
178
193
|
- lib/scribelite/version.rb
|
179
194
|
homepage: https://github.com/s6ruby/rubidity
|