Permalink
Browse files

Initial commit

  • Loading branch information...
jaimehgb committed Jan 11, 2018
0 parents commit 78d48624bb51eb33937eb32457e27f427e246e94
Showing with 33,587 additions and 0 deletions.
  1. +29 −0 .env-example
  2. +5 −0 .gitattributes
  3. +17 −0 .gitignore
  4. +42 −0 app/Console/Kernel.php
  5. +252 −0 app/Custom/RaiNode.php
  6. +53 −0 app/Exceptions/Handler.php
  7. +32 −0 app/Http/Controllers/Auth/ForgotPasswordController.php
  8. +39 −0 app/Http/Controllers/Auth/LoginController.php
  9. +75 −0 app/Http/Controllers/Auth/RegisterController.php
  10. +39 −0 app/Http/Controllers/Auth/ResetPasswordController.php
  11. +13 −0 app/Http/Controllers/Controller.php
  12. +28 −0 app/Http/Controllers/HomeController.php
  13. +562 −0 app/Http/Controllers/WalletsController.php
  14. +61 −0 app/Http/Kernel.php
  15. +17 −0 app/Http/Middleware/EncryptCookies.php
  16. +26 −0 app/Http/Middleware/RedirectIfAuthenticated.php
  17. +18 −0 app/Http/Middleware/TrimStrings.php
  18. +29 −0 app/Http/Middleware/TrustProxies.php
  19. +17 −0 app/Http/Middleware/VerifyCsrfToken.php
  20. +10 −0 app/LegacyWallet.php
  21. +38 −0 app/Mail/RecoveryMail.php
  22. +38 −0 app/Mail/RegistrationMail.php
  23. +10 −0 app/PoW.php
  24. +28 −0 app/Providers/AppServiceProvider.php
  25. +30 −0 app/Providers/AuthServiceProvider.php
  26. +21 −0 app/Providers/BroadcastServiceProvider.php
  27. +32 −0 app/Providers/EventServiceProvider.php
  28. +73 −0 app/Providers/RouteServiceProvider.php
  29. +29 −0 app/User.php
  30. +39 −0 app/Wallet.php
  31. +53 −0 artisan
  32. +55 −0 bootstrap/app.php
  33. +2 −0 bootstrap/cache/.gitignore
  34. +63 −0 composer.json
  35. +4,482 −0 composer.lock
  36. +231 −0 config/app.php
  37. +103 −0 config/auth.php
  38. +59 −0 config/broadcasting.php
  39. +94 −0 config/cache.php
  40. +120 −0 config/database.php
  41. +68 −0 config/filesystems.php
  42. +123 −0 config/mail.php
  43. +85 −0 config/queue.php
  44. +38 −0 config/services.php
  45. +197 −0 config/session.php
  46. +33 −0 config/view.php
  47. +1 −0 database/.gitignore
  48. +23 −0 database/factories/UserFactory.php
  49. +45 −0 database/migrations/2018_01_02_172133_create_wallets_table.php
  50. +38 −0 database/migrations/2018_01_02_174233_create_pow_table.php
  51. +16 −0 database/seeds/DatabaseSeeder.php
  52. +21 −0 gulpfile.js
  53. +15,367 −0 npm-shrinkwrap.json
  54. +30 −0 package.json
  55. +31 −0 phpunit.xml
  56. +21 −0 public/.htaccess
  57. +1 −0 public/699C8011D254A5588A104B976C8B2870.txt
  58. BIN public/android-icon-144x144.png
  59. BIN public/android-icon-192x192.png
  60. BIN public/android-icon-36x36.png
  61. BIN public/android-icon-48x48.png
  62. BIN public/android-icon-72x72.png
  63. BIN public/android-icon-96x96.png
  64. BIN public/apple-icon-114x114.png
  65. BIN public/apple-icon-120x120.png
  66. BIN public/apple-icon-144x144.png
  67. BIN public/apple-icon-152x152.png
  68. BIN public/apple-icon-180x180.png
  69. BIN public/apple-icon-57x57.png
  70. BIN public/apple-icon-60x60.png
  71. BIN public/apple-icon-72x72.png
  72. BIN public/apple-icon-76x76.png
  73. BIN public/apple-icon-precomposed.png
  74. BIN public/apple-icon.png
  75. +2 −0 public/browserconfig.xml
  76. BIN public/favicon-16x16.png
  77. BIN public/favicon-32x32.png
  78. BIN public/favicon-96x96.png
  79. BIN public/favicon.ico
  80. +60 −0 public/index.php
  81. +41 −0 public/manifest.json
  82. +4 −0 public/mix-manifest.json
  83. +2 −0 public/robots.txt
  84. +490 −0 resources/assets/css/creative.css
  85. +242 −0 resources/assets/css/sidebar.css
  86. +49 −0 resources/assets/js/Logger.js
  87. +22 −0 resources/assets/js/app.js
  88. +55 −0 resources/assets/js/bootstrap.js
  89. +23 −0 resources/assets/js/components/ExampleComponent.vue
  90. +48 −0 resources/assets/js/creative.js
  91. +1,534 −0 resources/assets/js/custom.js
  92. +38 −0 resources/assets/sass/_variables.scss
  93. +9 −0 resources/assets/sass/app.scss
  94. +19 −0 resources/lang/en/auth.php
  95. +19 −0 resources/lang/en/pagination.php
  96. +22 −0 resources/lang/en/passwords.php
  97. +121 −0 resources/lang/en/validation.php
  98. +304 −0 resources/views/components/modals.blade.php
  99. +329 −0 resources/views/components/wallet.blade.php
  100. +25 −0 resources/views/emails/recovery.blade.php
  101. +27 −0 resources/views/emails/registration.blade.php
  102. +23 −0 resources/views/home.blade.php
  103. +144 −0 resources/views/index.blade.php
  104. +103 −0 resources/views/layouts/app.blade.php
  105. +37 −0 resources/views/layouts/navbar.blade.php
  106. +18 −0 routes/api.php
  107. +16 −0 routes/channels.php
  108. +18 −0 routes/console.php
  109. +49 −0 routes/web.php
  110. +21 −0 server.php
  111. +3 −0 storage/app/.gitignore
  112. +2 −0 storage/app/public/.gitignore
  113. +8 −0 storage/framework/.gitignore
  114. +2 −0 storage/framework/cache/.gitignore
  115. +2 −0 storage/framework/sessions/.gitignore
  116. +2 −0 storage/framework/testing/.gitignore
  117. +2 −0 storage/framework/views/.gitignore
  118. +2 −0 storage/logs/.gitignore
  119. +6,548 −0 yarn.lock
@@ -0,0 +1,29 @@
APP_NAME="RaiWallet"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
@@ -0,0 +1,17 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
/tests
/public/css
/public/fonts
/public/img
/public/js
@@ -0,0 +1,42 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
@@ -0,0 +1,252 @@
<?php
namespace App\Custom;
use Illuminate\Http\Request;
class RaiNode
{
/*
easyraiblocksphp
===================
INSPIRED BY Andrew LeCody EasyBitcoin-PHP
A simple class for making calls to Bitcoin's API using PHP.
https://github.com/aceat64/EasyBitcoin-PHP
====================
LICENSE: Use it as you want!
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
====================
// Include the script in your configuration file
include_once('PATH/easyraiblocks.php');
// Initialize RaiBlocks connection/object
$raiblocks = new RaiBlocks();
// Optionally, you can specify a host and port.
$raiblocks = new RaiBlocks('host','port');
// Defaults are:
// host = localhost
// port = 7076
// proto = http
// If you wish to make an SSL connection you can set an optional CA certificate or leave blank
// This will set the protocol to HTTPS and some CURL flags
$raiblocks->setSSL('/full/path/to/mycertificate.cert');
// Make calls to node as methods for your object. Responses are returned as an array.
// Example:
$args = array(
"account" => "xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000"
);
$response = $raiblocks->account_balance( $args );
echo $response['balance'];
// The full response (not usually needed) is stored in $this->response while the raw JSON is stored in $this->raw_response
// When node fails for any reason, it will return FALSE and put the error message in $this->node_error
// Example:
echo $raiblocks->node_error;
// When a call fails for any reason, it will return FALSE and put the error message in $this->error
// Example:
echo $raiblocks->error;
// The HTTP status code can be found in $this->status and will either be a valid HTTP status code or will be 0 if cURL was unable to connect.
// Example:
echo $raiblocks->status;
*/
private $rai = "000000000000000000000000"; // A string to concatenate to build 1Rai value
private $rain = "1000000000000000000000000"; // A value to build 1Rai value
// Configuration options
private $proto;
private $host;
private $port;
private $url;
private $CACertificate;
// Information and debugging
public $status;
public $error;
public $raw_response;
public $response;
private $id = 0;
/**
* @param string $host
* @param int $port
* @param string $proto
* @param string $url
*/
function __construct( $host = 'localhost', $port = 7076, $url = null ){
$this->host = $host;
$this->port = $port;
$this->url = $url;
// Set some defaults
$this->proto = 'http';
$this->CACertificate = null;
}
/**
* @param string|null $certificate
*/
function setSSL( $certificate = null ){
$this->proto = 'https'; // force HTTPS
$this->CACertificate = $certificate;
}
function __call( $method, $params ){
$this->status = null;
$this->error = null;
$this->node_error = null;
$this->raw_response = null;
$this->response = null;
// If no parameters are passed, this will be an empty array
//$params = array_values($params);
// The ID should be unique for each call
$this->id++;
// Build the request, it's ok that params might have any empty array
$request = array(
'action' => $method
//'params' => $params
//'id' => $this->id
);
if( isset( $params[0] ) ){
foreach( $params[0] as $key=>$value ){
$request[$key] = $value;
}
}
$request = json_encode($request);
// Build the cURL session
$curl = curl_init("{$this->proto}://{$this->host}:{$this->port}/{$this->url}");
$options = array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_FOLLOWLOCATION => TRUE,
CURLOPT_USERAGENT => "PHP",
CURLOPT_MAXREDIRS => 10,
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $request
);
// This prevents users from getting the following warning when open_basedir is set:
// Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
if( ini_get( 'open_basedir' ) ){
unset($options[CURLOPT_FOLLOWLOCATION]);
}
if( $this->proto == 'https' ){
// If the CA Certificate was specified we change CURL to look for it
if( $this->CACertificate != null ){
$options[CURLOPT_CAINFO] = $this->CACertificate;
$options[CURLOPT_CAPATH] = DIRNAME($this->CACertificate);
}else{
// If not we need to assume the SSL cannot be verified so we set this flag to FALSE to allow the connection
$options[CURLOPT_SSL_VERIFYPEER] = FALSE;
}
}
curl_setopt_array( $curl, $options );
// Execute the request and decode to an array
$this->raw_response = curl_exec( $curl );
$this->response = json_decode( $this->raw_response, TRUE );
// If the status is not 200, something is wrong
$this->status = curl_getinfo( $curl, CURLINFO_HTTP_CODE );
// If there was no error, this will be an empty string
$curl_error = curl_error( $curl );
curl_close( $curl );
if( isset( $this->response["error"] ) ){
$this->node_error = $this->response["error"];
}
if( !empty( $curl_error ) ){
$this->error = $curl_error;
}
if( $this->status != 200 ){
// If node didn't return a nice error message, we need to make our own
switch( $this->status ){
case 400:
$this->error = 'HTTP_BAD_REQUEST';
break;
case 401:
$this->error = 'HTTP_UNAUTHORIZED';
break;
case 403:
$this->error = 'HTTP_FORBIDDEN';
break;
case 404:
$this->error = 'HTTP_NOT_FOUND';
break;
}
}
if( $this->error ){
return FALSE;
}
return $this->response;
}
}
Oops, something went wrong.

0 comments on commit 78d4862

Please sign in to comment.