21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/graphdb/model/tx_out.rb', line 21
def self.create_from_hash(hash)
tx_out = new
tx_out.value = hash['value']
tx_out.n = hash['n']
tx_out.save!
if hash['scriptPubKey']
tx_out.script_pubkey_asm = hash['scriptPubKey']['asm']
tx_out.script_pubkey_hex = hash['scriptPubKey']['hex']
tx_out.output_type = hash['scriptPubKey']['type']
tx_out.req_sigs = hash['scriptPubKey']['reqSigs']
if hash['scriptPubKey']['addresses']
hash['scriptPubKey']['addresses'].each do |a|
tx_out.addresses << Address.find_or_create(a)
end
end
end
tx_out.save!
tx_out
end
|