ethlite 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ethlite/abi/codec.rb +10 -9
- data/lib/ethlite/abi/type.rb +2 -2
- data/lib/ethlite/utils.rb +9 -5
- data/lib/ethlite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a91770dc04d591bf88353b4783080812f1659a7f679f09636b656a1a8d9ac7b7
|
4
|
+
data.tar.gz: 626dda3168008abf7743526be783722292af40633c4acbe1bea4ea649f77a602
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31b7dce9e0b71c4ea56697272d731541ecd58fdbfac6d5a3ddc949f7d47263340fda578d37403f788ecc02b7b08152d75107fd856f4af54b256c1cbb52b55ab2
|
7
|
+
data.tar.gz: 852410528fc380e40cff8fd4eafd49a2697947d2b2a4ab73b6210c88c87c45ecfdd2c44c296dd473cb7a5e5c7d175625d774e3fb6f88a45da7f3356af2b21ea6
|
data/lib/ethlite/abi/codec.rb
CHANGED
@@ -2,16 +2,13 @@
|
|
2
2
|
|
3
3
|
module Ethlite
|
4
4
|
module Abi
|
5
|
-
extend self
|
6
5
|
|
7
6
|
##
|
8
7
|
# Contract ABI encoding and decoding.
|
9
8
|
#
|
10
9
|
# @see https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
|
11
10
|
#
|
12
|
-
|
13
|
-
extend self
|
14
|
-
|
11
|
+
class Codec
|
15
12
|
class EncodingError < StandardError; end
|
16
13
|
class DecodingError < StandardError; end
|
17
14
|
class ValueError < StandardError; end
|
@@ -412,19 +409,23 @@ module Ethlite
|
|
412
409
|
raise EncodingError, "Cannot decode int: #{n}"
|
413
410
|
end
|
414
411
|
end
|
415
|
-
end #
|
412
|
+
end # class Codec
|
413
|
+
|
416
414
|
|
417
415
|
|
418
416
|
|
419
417
|
|
420
418
|
|
419
|
+
def self.codec
|
420
|
+
@codec ||= Codec.new
|
421
|
+
end
|
421
422
|
|
422
|
-
def encode_abi(types, args)
|
423
|
-
|
423
|
+
def self.encode_abi(types, args)
|
424
|
+
codec.encode_abi( types, args )
|
424
425
|
end
|
425
426
|
|
426
|
-
def decode_abi(types, data, raise_errors = false)
|
427
|
-
|
427
|
+
def self.decode_abi(types, data, raise_errors = false)
|
428
|
+
codec.decode_abi( types, data, raise_errors )
|
428
429
|
end
|
429
430
|
|
430
431
|
|
data/lib/ethlite/abi/type.rb
CHANGED
@@ -117,8 +117,8 @@ module Ethlite
|
|
117
117
|
def subtype
|
118
118
|
@subtype ||= self.class.new(base, sub, dims[0...-1])
|
119
119
|
end
|
120
|
+
end # class Type
|
120
121
|
|
121
|
-
end
|
122
122
|
|
123
123
|
class Tuple < Type
|
124
124
|
|
@@ -193,7 +193,7 @@ module Ethlite
|
|
193
193
|
def subtype
|
194
194
|
@subtype ||= Tuple.new(types, dims[0...-1])
|
195
195
|
end
|
196
|
-
end
|
196
|
+
end # class Tuple
|
197
197
|
|
198
198
|
|
199
199
|
end # module Abi
|
data/lib/ethlite/utils.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module Ethlite
|
2
|
-
module Utils
|
3
2
|
|
4
|
-
extend self
|
5
3
|
|
4
|
+
module UtilHelper
|
6
5
|
##
|
7
6
|
# Not the keccak in sha3, although it's underlying lib named SHA3
|
8
7
|
#
|
@@ -211,12 +210,17 @@ module Utils
|
|
211
210
|
end
|
212
211
|
end
|
213
212
|
|
214
|
-
|
215
|
-
|
216
213
|
def signature_hash( signature, length=8 )
|
217
214
|
encode_hex( keccak256(signature) )[0...length]
|
218
215
|
end
|
219
216
|
|
220
|
-
end # module
|
217
|
+
end # module UtilHelper
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
module Utils
|
222
|
+
extend UtilHelper
|
223
|
+
end
|
224
|
+
|
221
225
|
end # module Ethlite
|
222
226
|
|
data/lib/ethlite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.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-11-
|
11
|
+
date: 2022-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocos
|