Class: Casper::Entity::StoredContractByHash
Instance Attribute Summary
#args
Instance Method Summary
collapse
#get_arg_by_name, #set_arg
Constructor Details
Returns a new instance of StoredContractByHash.
10
11
12
13
14
15
|
# File 'lib/entity/stored_contract_by_hash.rb', line 10
def initialize(hash, entry_point, args)
@tag = 1
@hash = hash
@entry_point = entry_point
@args = args
end
|
Instance Method Details
#get_args ⇒ Object
29
30
31
|
# File 'lib/entity/stored_contract_by_hash.rb', line 29
def get_args
@args
end
|
#get_entry_point ⇒ Object
25
26
27
|
# File 'lib/entity/stored_contract_by_hash.rb', line 25
def get_entry_point
@entry_point
end
|
#get_hash ⇒ Object
21
22
23
|
# File 'lib/entity/stored_contract_by_hash.rb', line 21
def get_hash
@hash
end
|
#get_tag ⇒ Object
17
18
19
|
# File 'lib/entity/stored_contract_by_hash.rb', line 17
def get_tag
@tag
end
|
#to_bytes ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/entity/stored_contract_by_hash.rb', line 33
def to_bytes
serializer = DeployNamedArgSerializer.new
num_of_args = @args.length
bytes = Utils::ByteUtils.to_u8(@tag)
bytes += @hash
bytes += CLValueBytesParsers::CLStringBytesParser.to_bytes(@entry_point)
bytes += Utils::ByteUtils.to_u32(num_of_args)
@args.each do |arg|
arg.each do |item|
bytes += serializer.to_bytes(item)
end
end
Utils::ByteUtils.hex_to_byte_array(bytes)
end
|