ethname 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -1
- data/README.md +13 -6
- data/config/contracts.2017.csv +4 -4
- data/config/contracts.2021.csv +12 -8
- data/config/contracts.2022.csv +17 -8
- data/lib/ethname/directory.rb +121 -0
- data/lib/ethname/version.rb +1 -1
- data/lib/ethname.rb +10 -10
- metadata +3 -3
- data/lib/ethname/dictionary.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72d207eabf6a744e375ae0846031daff0dc1ae5cf5511b0186f8b6a5f2c80966
|
4
|
+
data.tar.gz: b4b10c781ca9d6e0f018c2b09dbaec9342aa0bffab3a76a2dd99957a70b23658
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6bd32ea40aee62288c3109352854643da5ef525eab4fdc730c2b28467a6bc6bbdcf809876e382c011ada03c1b781ea2f37e3a33030991a10da4512e439b3bb1
|
7
|
+
data.tar.gz: 812408119cef47a926de01f72aa1aef5707a07e6e9888f46635591a9ce5113d8a58ec4dbf742166c1abf6bbcf3d0f349145ea9d6e460314500fae505bafdac8d
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -70,7 +70,7 @@ Example - [config/contracts.2017.csv](config/contracts.2017.csv):
|
|
70
70
|
address, names
|
71
71
|
0x6Ba6f2207e343923BA692e5Cae646Fb0F566DB8D, punks v1 | crypto punks v1
|
72
72
|
0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb, punks v2 | crypto punks v2 | crypto punks market
|
73
|
-
0x60cd862c9c687a9de49aecdc3a99b74a4fc54ab6, mooncats |
|
73
|
+
0x60cd862c9c687a9de49aecdc3a99b74a4fc54ab6, mooncats | mooncat rescue
|
74
74
|
...
|
75
75
|
```
|
76
76
|
|
@@ -78,16 +78,23 @@ Example - [config/contracts.2022.csv](config/contracts.2022.csv):
|
|
78
78
|
|
79
79
|
``` csv
|
80
80
|
address, names
|
81
|
-
0x282bdd42f4eb70e7a9d9f40c8fea0825b7f68c5d,
|
82
|
-
0xD33c078C2486B7Be0F7B4DDa9B14F35163B949e0,
|
83
|
-
0xd12882c8b5d1bccca57c994c6af7d96355590dbd,
|
81
|
+
0x282bdd42f4eb70e7a9d9f40c8fea0825b7f68c5d, punks v1 wrapped ii
|
82
|
+
0xD33c078C2486B7Be0F7B4DDa9B14F35163B949e0, punks v3
|
83
|
+
0xd12882c8b5d1bccca57c994c6af7d96355590dbd, punks v4
|
84
84
|
0xA19f0378A6F3f3361d8e962F3589Ec28f4f8F159, phunks v3
|
85
|
-
0xaf9CE4B327A3b690ABEA6F78eCCBfeFFfbEa9FDf,
|
86
|
-
0x58E90596C2065BEfD3060767736C829C18F3474c,
|
85
|
+
0xaf9CE4B327A3b690ABEA6F78eCCBfeFFfbEa9FDf, synth punks | synthetic punks
|
86
|
+
0x58E90596C2065BEfD3060767736C829C18F3474c, punk blocks
|
87
87
|
0x23581767a106ae21c074b2276D25e5C3e136a68b, moonbirds
|
88
|
+
0xe9b91d537c3aa5a3fa87275fbd2e4feaaed69bd0, marcs | crypto marcs
|
89
|
+
0xad8474ba5a7f6abc52708f171f57fefc5cdc8c1c, mad camels
|
90
|
+
0xe5a5520b798c5f67ca1b0657b932656df02595ad, punk apes yacht club
|
91
|
+
0x9b66d03fc1eee61a512341058e95f1a68dc3a913, phunk ape origins
|
92
|
+
0x2204a94f96d39df3b6bc0298cf068c8c82dc8d61, chi chis
|
88
93
|
...
|
89
94
|
```
|
90
95
|
|
96
|
+
|
97
|
+
|
91
98
|
### Yes, You Can! - Add More Names / Contracts Via Git ;-)
|
92
99
|
|
93
100
|
Your contributions welcome. You are welcome to join in and
|
data/config/contracts.2017.csv
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
address, names
|
2
|
-
0x6Ba6f2207e343923BA692e5Cae646Fb0F566DB8D, punks v1 | crypto punks v1
|
3
|
-
0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb, punks v2 | crypto punks v2 | crypto punks market
|
4
|
-
0x60cd862c9c687a9de49aecdc3a99b74a4fc54ab6, mooncats | mooncatrescue
|
1
|
+
address, names, interfaces, created
|
2
|
+
0x6Ba6f2207e343923BA692e5Cae646Fb0F566DB8D, punks v1 | crypto punks v1, erc20, 2017-06-09 00:22:50
|
3
|
+
0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb, punks v2 | crypto punks v2 | crypto punks market, erc20, 2017-06-22 19:40:00
|
4
|
+
0x60cd862c9c687a9de49aecdc3a99b74a4fc54ab6, mooncats | mooncatrescue,, 2017-08-09 04:36:06
|
5
5
|
|
6
6
|
|
data/config/contracts.2021.csv
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
-
address, names
|
2
|
-
0x16f5a35647d6f03d5d3da7b35409d65ba03af3b2, punks data | crypto punks data
|
3
|
-
0xf4a4644e818c2843ba0aabea93af6c80b5984114, punks v1 wrapped i | classic punks
|
1
|
+
address, names, interfaces, created
|
2
|
+
0x16f5a35647d6f03d5d3da7b35409d65ba03af3b2, punks data | crypto punks data,, 2021-08-18 00:10:24
|
3
|
+
0xf4a4644e818c2843ba0aabea93af6c80b5984114, punks v1 wrapped i | classic punks, erc721, 2021-03-25 04:26:43
|
4
4
|
|
5
|
-
0xa82f3a61f002f83eba7d184c50bb2a8b359ca1ce, phunks v1 | philips
|
6
|
-
0xf07468ead8cf26c752c676e43c814fee9c8cf402, phunks v2 | phunks
|
5
|
+
0xa82f3a61f002f83eba7d184c50bb2a8b359ca1ce, phunks v1 | philips, erc721, 2021-06-14 04:18:53
|
6
|
+
0xf07468ead8cf26c752c676e43c814fee9c8cf402, phunks v2 | phunks, erc721, 2021-06-21 00:07:08
|
7
7
|
|
8
|
-
0x031920cc2d9f5c10b444fd44009cd64f829e7be2, zunks
|
8
|
+
0x031920cc2d9f5c10b444fd44009cd64f829e7be2, zunks, erc721, 2021-08-07 04:01:17
|
9
9
|
|
10
|
-
0x0d0167a823c6619d430b1a96ad85b888bcf97c37, xpunks | expansion punks
|
11
|
-
0x71eb5c179ceb640160853144cbb8df5bd24ab5cc, xphunks | expansion phunks
|
10
|
+
0x0d0167a823c6619d430b1a96ad85b888bcf97c37, xpunks | expansion punks, erc721, 2021-08-15 00:13:20
|
11
|
+
0x71eb5c179ceb640160853144cbb8df5bd24ab5cc, xphunks | expansion phunks, erc721, 2021-12-30 10:14:39
|
12
|
+
|
13
|
+
|
14
|
+
0x7c40c393dc0f283f318791d746d894ddd3693572, mooncats wrapped, erc721, 2021-03-12 20:20:10
|
15
|
+
0xc3f733ca98E0daD0386979Eb96fb1722A1A05E69, acclimated mooncats | mooncats acclimated, erc721, 2021-04-22 01:52:09
|
data/config/contracts.2022.csv
CHANGED
@@ -1,15 +1,24 @@
|
|
1
|
-
address, names
|
2
|
-
0x282bdd42f4eb70e7a9d9f40c8fea0825b7f68c5d, punks v1 wrapped ii
|
1
|
+
address, names, interfaces, created
|
2
|
+
0x282bdd42f4eb70e7a9d9f40c8fea0825b7f68c5d, punks v1 wrapped ii, erc721, 2022-01-17 10:15:07
|
3
3
|
|
4
|
-
0xD33c078C2486B7Be0F7B4DDa9B14F35163B949e0, punks v3
|
5
|
-
0xd12882c8b5d1bccca57c994c6af7d96355590dbd, punks v4
|
4
|
+
0xD33c078C2486B7Be0F7B4DDa9B14F35163B949e0, punks v3, erc721, 2022-02-02 16:57:59
|
5
|
+
0xd12882c8b5d1bccca57c994c6af7d96355590dbd, punks v4, erc721, 2022-02-04 08:57:46
|
6
6
|
|
7
|
-
0xA19f0378A6F3f3361d8e962F3589Ec28f4f8F159, phunks v3
|
7
|
+
0xA19f0378A6F3f3361d8e962F3589Ec28f4f8F159, phunks v3, erc721, 2022-02-03 08:49:52
|
8
8
|
|
9
9
|
|
10
|
-
0xaf9CE4B327A3b690ABEA6F78eCCBfeFFfbEa9FDf, synthetic punks | synth punks
|
10
|
+
0xaf9CE4B327A3b690ABEA6F78eCCBfeFFfbEa9FDf, synthetic punks | synth punks, erc721, 2022-02-13 18:27:43
|
11
11
|
|
12
|
-
0x58E90596C2065BEfD3060767736C829C18F3474c, punk blocks
|
12
|
+
0x58E90596C2065BEfD3060767736C829C18F3474c, punk blocks,, 2022-12-09 23:42:59
|
13
13
|
|
14
14
|
|
15
|
-
0x23581767a106ae21c074b2276D25e5C3e136a68b, moonbirds
|
15
|
+
0x23581767a106ae21c074b2276D25e5C3e136a68b, moonbirds, erc721, 2022-04-15 16:38:30
|
16
|
+
|
17
|
+
|
18
|
+
0xe9b91d537c3aa5a3fa87275fbd2e4feaaed69bd0, marcs | crypto marcs, erc721, 2022-07-17 15:49:16
|
19
|
+
0xad8474ba5a7f6abc52708f171f57fefc5cdc8c1c, mad camels, erc721, 2022-09-04 07:16:38
|
20
|
+
0xe5a5520b798c5f67ca1b0657b932656df02595ad, punk apes yacht club, erc721, 2022-09-14 04:18:54
|
21
|
+
0x9b66d03fc1eee61a512341058e95f1a68dc3a913, phunk ape origins, erc721, 2022-09-23 05:56:47
|
22
|
+
0x34625ecaa75c0ea33733a05c584f4cf112c10b6b, punkin spicies, erc721, 2022-10-08 06:04:23
|
23
|
+
0x2204a94f96d39df3b6bc0298cf068c8c82dc8d61, chi chis, erc721, 2022-10-24 09:07:47
|
24
|
+
|
@@ -0,0 +1,121 @@
|
|
1
|
+
|
2
|
+
module Ethname
|
3
|
+
|
4
|
+
class Record
|
5
|
+
def self.directory() Ethname.directory; end
|
6
|
+
|
7
|
+
def self.find( addr ) directory.find_record( addr ); end
|
8
|
+
def self.find_by( name: ) directory.find_record_by( name: name ); end
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
def self.parse( row )
|
13
|
+
## note: always downcase addresses for now
|
14
|
+
## (do NOT use addresss checksum with mixed-hexchars) - why? why not?
|
15
|
+
address = row['address'].downcase
|
16
|
+
|
17
|
+
names = row['names'].split('|')
|
18
|
+
names = names.map {|name| name.strip } ## remove leading & trailing withespaces
|
19
|
+
|
20
|
+
## note: always downcase and normalize (remove space and - for now)
|
21
|
+
# - why? why not?
|
22
|
+
## e.g. ERC20 => erc20
|
23
|
+
## ERC-20 | ERC-721 => erc20 | erc721
|
24
|
+
interfaces = (row['interfaces'] || '').split('|')
|
25
|
+
interfaces = interfaces.map {|inter| inter.downcase.gsub(/[ -]/, '' ) }
|
26
|
+
|
27
|
+
new( address: address,
|
28
|
+
names: names,
|
29
|
+
interfaces: interfaces )
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
attr_reader :address, :names, :interfaces
|
34
|
+
|
35
|
+
def initialize( address: nil,
|
36
|
+
names: [],
|
37
|
+
interfaces: [] )
|
38
|
+
@address = address
|
39
|
+
@names = names
|
40
|
+
@interfaces = interfaces
|
41
|
+
end
|
42
|
+
|
43
|
+
alias_method :addr, :address
|
44
|
+
def name() @names[0]; end
|
45
|
+
|
46
|
+
def erc20?() @interfaces.include?('erc20' ); end
|
47
|
+
def erc721?() @interfaces.include?('erc721' ); end
|
48
|
+
|
49
|
+
|
50
|
+
end # class Record
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
class Directory
|
55
|
+
## let's you lookup up ethereum addresses by name
|
56
|
+
|
57
|
+
def self.read( *paths ) ## use load - why? why not?
|
58
|
+
dir = new
|
59
|
+
paths.each do |path|
|
60
|
+
rows= read_csv( path )
|
61
|
+
dir.add_rows( rows )
|
62
|
+
end
|
63
|
+
dir
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
def initialize
|
69
|
+
@recs = {} ## lookup (record) by (normalized) address
|
70
|
+
@reverse_table = {} ## lookup (address) by (normalized) name
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
def records() @recs.values; end
|
75
|
+
def size() @recs.size; end
|
76
|
+
|
77
|
+
def find_record( addr )
|
78
|
+
@recs[ addr.downcase ]
|
79
|
+
end
|
80
|
+
|
81
|
+
def find_record_by( name: )
|
82
|
+
key = normalize( name )
|
83
|
+
@reverse_table[ key ]
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
def []( name )
|
88
|
+
rec = find_record_by( name: name )
|
89
|
+
rec ? rec.addr : nil
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
def add_rows( rows )
|
94
|
+
rows.each do |row|
|
95
|
+
rec = Record.parse( row )
|
96
|
+
rec.names.each do |name|
|
97
|
+
|
98
|
+
key = normalize( name )
|
99
|
+
rec2 = @reverse_table[ key ]
|
100
|
+
|
101
|
+
## check for duplicates
|
102
|
+
raise ArgumentError, "duplicate (normalized) key >#{key} for addr >#{rec.addr}<" if rec == rec2
|
103
|
+
raise ArgumentError, "duplicate (normalized) key >#{key}< for addr >#{rec.addr}; addr already in use >#{rec2.addr}<" if rec2
|
104
|
+
@reverse_table[ key ] = rec
|
105
|
+
end
|
106
|
+
|
107
|
+
@recs[rec.addr] = rec
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
#################
|
112
|
+
# convencience helpers
|
113
|
+
def self.normalize( str )
|
114
|
+
## remove all non a-z (and 0-9) characters
|
115
|
+
str.downcase.gsub( /[^a-z0-9]/i, '' )
|
116
|
+
end
|
117
|
+
|
118
|
+
def normalize( str ) self.class.normalize( str ); end
|
119
|
+
end # class Directory
|
120
|
+
end # module Ethname
|
121
|
+
|
data/lib/ethname/version.rb
CHANGED
data/lib/ethname.rb
CHANGED
@@ -4,23 +4,23 @@ require 'cocos'
|
|
4
4
|
|
5
5
|
## our own code
|
6
6
|
require_relative 'ethname/version'
|
7
|
-
require_relative 'ethname/
|
7
|
+
require_relative 'ethname/directory'
|
8
8
|
|
9
9
|
|
10
10
|
module Ethname
|
11
11
|
|
12
|
-
def self.
|
13
|
-
@
|
14
|
-
|
15
|
-
|
12
|
+
def self.dir
|
13
|
+
@dir ||= Directory.read( "#{root}/config/contracts.2017.csv",
|
14
|
+
"#{root}/config/contracts.2021.csv",
|
15
|
+
"#{root}/config/contracts.2022.csv",
|
16
16
|
)
|
17
17
|
end
|
18
|
-
|
19
|
-
def self.lookup( q )
|
20
|
-
dict.lookup( q )
|
21
|
-
end
|
22
18
|
class << self
|
23
|
-
|
19
|
+
alias_method :directory, :dir
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.[]( q )
|
23
|
+
dir[ q ]
|
24
24
|
end
|
25
25
|
|
26
26
|
end # module Ethname
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.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: 2022-12-
|
11
|
+
date: 2022-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocos
|
@@ -77,7 +77,7 @@ files:
|
|
77
77
|
- config/contracts.2021.csv
|
78
78
|
- config/contracts.2022.csv
|
79
79
|
- lib/ethname.rb
|
80
|
-
- lib/ethname/
|
80
|
+
- lib/ethname/directory.rb
|
81
81
|
- lib/ethname/version.rb
|
82
82
|
homepage: https://github.com/rubycocos/blockchain
|
83
83
|
licenses:
|
data/lib/ethname/dictionary.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
|
2
|
-
module Ethname
|
3
|
-
|
4
|
-
class Dictionary
|
5
|
-
## let's you lookup up ethereum addresses by name
|
6
|
-
|
7
|
-
def self.read( *paths ) ## use load - why? why not?
|
8
|
-
dict = new
|
9
|
-
paths.each do |path|
|
10
|
-
recs = read_csv( path )
|
11
|
-
dict.add_recs( recs )
|
12
|
-
end
|
13
|
-
dict
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
@recs = []
|
20
|
-
@reverse_table = {} ## lookup (address) by (normalized) name
|
21
|
-
end
|
22
|
-
|
23
|
-
def recs() @recs; end
|
24
|
-
def size() @recs.size; end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
def lookup( q )
|
29
|
-
key = normalize( q )
|
30
|
-
addr = @reverse_table[ key ]
|
31
|
-
addr
|
32
|
-
end
|
33
|
-
alias_method :[], :lookup
|
34
|
-
|
35
|
-
|
36
|
-
def add_recs( recs )
|
37
|
-
recs.each do |rec|
|
38
|
-
## note: always downcase addresses for now
|
39
|
-
## (do NOT use addresss checksum with mixed-hexchars) - why? why not?
|
40
|
-
addr = rec['address'].downcase
|
41
|
-
names = rec['names'].split('|')
|
42
|
-
names.each do |name|
|
43
|
-
_add( addr, name )
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
@recs += recs
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
#################
|
52
|
-
# convencience helpers
|
53
|
-
def self.normalize( str )
|
54
|
-
## remove all non a-z (and 0-9) characters
|
55
|
-
str.downcase.gsub( /[^a-z0-9]/i, '' )
|
56
|
-
end
|
57
|
-
|
58
|
-
def normalize( str ) self.class.normalize( str ); end
|
59
|
-
|
60
|
-
####
|
61
|
-
# private (internal) helpers
|
62
|
-
def _add( addr, name )
|
63
|
-
key = normalize( name )
|
64
|
-
addr2 = @reverse_table[ key ]
|
65
|
-
|
66
|
-
## check for duplicates
|
67
|
-
raise ArgumentError, "duplicate (normalized) key >#{key} for addr >#{addr}<" if addr == addr2
|
68
|
-
raise ArgumentError, "duplicate (normalized) key >#{key}< for addr >#{addr}; addr already in use >#{addr2}<" if addr2
|
69
|
-
@reverse_table[ key ] = addr
|
70
|
-
self
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end # module Ethname
|
75
|
-
|