Class: Etheruby::Encoders::Address
- Inherits:
-
Base
- Object
- Base
- Etheruby::Encoders::Address
show all
- Defined in:
- lib/etheruby/encoders/address.rb
Instance Attribute Summary
Attributes inherited from Base
#data
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#decode ⇒ Object
15
16
17
18
|
# File 'lib/etheruby/encoders/address.rb', line 15
def decode
v, s = Uint.new(data).decode
return "0x#{v.to_s(16).rjust(40, "0")}", s
end
|
#encode ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/etheruby/encoders/address.rb', line 7
def encode
if data.is_a?(::String)
Uint.new(data[2..64].to_i(16)).encode
else
Uint.new(data).encode
end
end
|