App-NoodlePay

 view release on metacpan or  search on metacpan

bin/noodlepay.pl  view on Meta::CPAN

  $frame->Refresh;
}

sub initui {                # Initialize the UI
  Wx::InitAllImageHandlers();
  my $app = Wx::SimpleApp->new;
  my $frame = Wx::Frame->new( undef, -1, _('Noodle Pay'), wxDefaultPosition, wxDefaultSize );

  my $topSizer = Wx::BoxSizer->new(wxVERTICAL);
  $frame->SetSizer($topSizer);
  my $boxSizer = Wx::BoxSizer->new(wxVERTICAL);
  $topSizer->Add($boxSizer, 0, wxALL | wxEXPAND, 5);

  # Buttons

  my %button;

  if ($ARGV[0] and $ARGV[0] eq '--offline') {
      $button{SendSign} = Wx::Button->new($frame, -1, _('Sign'), [-1,-1]);
  }
  else {
      $button{SendSign} = Wx::Button->new($frame, -1, _('Send'), [-1,-1]);
  }
  $button{Exit} = Wx::Button->new($frame, -1, _('Exit'), [-1,-1]);

  my $buttonbox1 = Wx::BoxSizer->new(wxHORIZONTAL);
  $boxSizer->Add($buttonbox1, 0, wxGROW | wxALL, 5);

  $buttonbox1->Add($button{SendSign}, 1, wxALL, 5);
  $buttonbox1->Add($button{Exit}, 1, wxALL, 5);

  # Status bar

  my $statusBar = Wx::StatusBar->new($frame, wxID_ANY);
  $frame->SetStatusBar($statusBar);
  return ($app, $frame, $topSizer, $boxSizer, $statusBar, %button)
}

sub initl8n {               # Initialize l8n
  $lang{zh} = { };
  $lang{es} = { };
  $lang{fr} = { };
  $lang{de} = { };
  $lang{gr} = { };
  $lang{hi} = { };
  $lang{it} = { };
  $lang{ja} = { };
  $lang{kr} = { };
  $lang{ru} = { };
  $lang = 'en';
  if ($^O eq 'MSWin32') {
    my %winlang = ( de => [qw(0007 0c07 0407 1407 1007 0807)],
		    es => [qw(000a 2c0a 200a 400a 340a 240a 140a 5c0a 1c0a 300a 440a 100a 480a 580a 080a 4c0a 180a 3c0a 280a 500a 040a 0c0a 540a 380a)],
		    fr => [qw(000c 080c 2c0c 240c 300c 040c 3c0c 140c 340c 380c 180c 200c 280c 100c)],
		    gr => [qw(0008 0408)],
		    hi => [qw(0039 0439)],
		    it => [qw(0010 0410 0810)],
		    ja => [qw(0011 0411)],
		    kr => [qw(0012 0412)],
		    ru => [qw(0019 0819 0419)],
		    zh => [qw(0004 7804 0804 1004 7c04 0c04 1404 0404)]
		  );
    require Win32::API;
    Win32::API->Import('kernel32', 'int GetUserDefaultLCID()');
    my $langid = GetUserDefaultLCID();
    for my $l (keys %winlang) {
      $lang = $l, last if grep { sprintf("%04x",$langid) eq $_ } @{$winlang{$l}};
    }
  }
  else {
    $lang = $ENV{LC_ALL} || $ENV{LANG};
  }
  $lang = 'en' unless defined $lang;
  $lang = 'en' if $lang =~ /^C|POSIX/;
  $lang = substr($lang, 0, 2) || 'en';
  return ($lang, %lang);
}

sub _ {
  $_ = shift;
  if (/^\d+$/) {
    if ($lang eq 'h1') {
      $numerals = $lang{$lang}->{__NUMERALS};
      eval "tr/0-9/$numerals/";
    }
    return $_;
  }
  else {
    if ($lang eq 'hi' and $ENV{DISPLAY} and $ENV{DISPLAY} !~ /apple/) {
      return $lang{$lang}->{__X11}->{$_} || $_;
    }
    else {
      return $lang{$lang}->{$_} || $_;
    }
  }
}

1;

__END__

=head1 NAME

noodlepay.pl - Convenient way to securely send Bitcoin from cold storage

=head1 VERSION

 $Revision: 1.007 $
 $Date: Tue Oct 16 22:06:51 PDT 2018 $

=head1 SYNOPSIS

  noodlepay.pl [--offline] [--online]

=head1 DESCRIPTION

noodlepay.pl (Noodle Pay) enables the use of an air-gapped wallet
running on a device such as a Noodle Air (L<http://www.noodlepi.com>)
to easily and securely send Bitcoin payments.

Noodle Pay is much more convenient to use than hardware wallets, and



( run in 2.437 seconds using v1.01-cache-2.11-cpan-98e64b0badf )