lib/zold/wallet.rb
# Creates an empty wallet with the specified ID and public key.
Creates an empty wallet with the specified ID and public key.
Creates an empty wallet with the specified ID and public key .
def init(id, pubkey, overwrite: false, network: 'test')
      raise "File '#{path}' already exists" if File.exist?(path) && !overwrite
      raise "Invalid network name '#{network}'" unless network =~ /^[a-z]{4,16}$/
      FileUtils.mkdir_p(File.dirname(path))
      IO.write(path, "#{network}\n#{PROTOCOL}\n#{id}\n#{pubkey.to_pub}\n\n")
      @txns.flush
      @head.flush
    end
def init ( id , pubkey , overwrite : false , network : 'test' ) raise "File '#{path}' already exists" if File . exist? ( path ) && ! overwrite raise "Invalid network name '#{network}'" unless network =~ / ^[a-z]{4,16}$ / FileUtils . mkdir_p ( File . dirname ( path ) ) IO . write ( path , "#{network}\n#{PROTOCOL}\n#{id}\n#{pubkey.to_pub}\n\n" ) @txns . flush @head . flush end
Creates an empty wallet with the specified ID and public key.
Creates an empty wallet with the specified ID and public key .
id
<not_specific>
pubkey
<not_specific>
overwrite
<not_specific>
network
<not_specific>