class Faker::Blockchain::Tezos
Constants
- PREFIXES
@private
Public Class Methods
account()
click to toggle source
Produces a random Tezos
account address
@return [String]
@example
Faker::Blockchain::Tezos.account #=> "tz1eUsgK6aj752Fbxwk5sAoEFvSDnPjZ4qvk"
@faker.version 1.9.2
# File lib/faker/blockchain/tezos.rb, line 31 def account encode_tz(:tz1, 20) end
block()
click to toggle source
Produces a random Tezos
block
@return [String]
@example
Faker::Blockchain::Tezos.block #=> "BMbhs2rkY1dvAkAyRytvPsjFQ2RiPrBhYkxvWpY65dzkdSuw58a"
@faker.version 1.9.4
# File lib/faker/blockchain/tezos.rb, line 73 def block encode_tz(:B, 32) end
contract()
click to toggle source
Produces a random Tezos
contract
@return [String]
@example
Faker::Blockchain::Tezos.contract #=> "KT1MroqeP15nnitB4CnNfkqHYa2NErhPPLWF"
@faker.version 1.9.2
# File lib/faker/blockchain/tezos.rb, line 45 def contract encode_tz(:KT1, 20) end
operation()
click to toggle source
Produces a random Tezos
operation
@return [String]
@example
Faker::Blockchain::Tezos.operation #=> "onygWYXJX3xNstFLv9PcCrhQdCkENC795xwSinmTEc1jsDN4VDa"
@faker.version 1.9.2
# File lib/faker/blockchain/tezos.rb, line 59 def operation encode_tz(:o, 32) end
signature()
click to toggle source
Produces a random Tezos
signature
@return [String]
@example
Faker::Blockchain::Tezos.signature #=> "edsigu165B7VFf3Dpw2QABVzEtCxJY2gsNBNcE3Ti7rRxtDUjqTFRpg67EdAQmY6YWPE5tKJDMnSTJDFu65gic8uLjbW2YwGvAZ"
@faker.version 1.9.2
# File lib/faker/blockchain/tezos.rb, line 87 def signature encode_tz(:edsig, 64) end
Protected Class Methods
encode_tz(prefix, payload_size)
click to toggle source
@param prefix [Symbol] @param payload_size [Integer] The size of the payload
@return [String]
# File lib/faker/blockchain/tezos.rb, line 98 def encode_tz(prefix, payload_size) prefix = PREFIXES.fetch(prefix) packed = prefix.map(&:chr).join('') + Faker::Config.random.bytes(payload_size) checksum = Digest::SHA2.digest(Digest::SHA2.digest(packed))[0..3] Faker::Base58.encode(packed + checksum) end