Skip to content

Instantly share code, notes, and snippets.

@tayvano
Created February 3, 2017 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tayvano/b348a747f654c22e5a7bb445df539d66 to your computer and use it in GitHub Desktop.
Save tayvano/b348a747f654c22e5a7bb445df539d66 to your computer and use it in GitHub Desktop.
walletdecryptdrtv.js in html
<article class="row" ng-controller='decryptWalletCtrl'>
<!-- Column 1 - Select Type of Key -->
<section class="col-md-4 col-sm-6">
<h4 translate="decrypt_Title"> Select the format of your private key: </h4>
<div class="radio"><label><input type="radio" ng-model="walletType" value="fileupload" /><span translate="x_Keystore2">Keystore / JSON File</span></label></div>
<div class="radio"><label><input type="radio" ng-model="walletType" value="pasteprivkey" /><span translate="x_PrivKey2">Private Key</span></label></div>
<div class="radio"><label><input type="radio" ng-model="walletType" value="pastemnemonic" /><span translate="x_Mnemonic">Mnemonic Phrase</span></label></div>
<div class="radio" ng-hide="globalService.currentTab==globalService.tabs.signMsg.id"><label><input type="radio" ng-model="walletType" value="ledger" />Ledger Nano S</label></div>
<div class="radio" ng-hide="globalService.currentTab==globalService.tabs.signMsg.id"><label><input type="radio" ng-model="walletType" value="trezor" />TREZOR</label></div>
<div class="radio" ng-hide="globalService.currentTab!==globalService.tabs.viewWalletInfo.id"><label><input type="radio" ng-model="walletType" value="addressOnly" /><span>View with Address Only</span></label></div>
</section>
<!-- Column 1 - Select Type of Key -->
<!-- Column 2 - Unlock That Key -->
<section class="col-md-4 col-sm-6">
<!-- if selected upload -->
<div id="selectedUploadKey" ng-if="walletType=='fileupload'">
<h4 translate="ADD_Radio_2_alt">Select your wallet file:</h4>
<div class="form-group">
<input style="display:none;" type="file" on-read-file="showContent($fileContent)" id="fselector" />
<a class="file-input btn btn-block btn-default btn-file marg-v-sm" ng-click="openFileDialog()" translate="ADD_Radio_2_short">SELECT WALLET FILE... </a>
<div id="fuploadStatus" ng-bind-html="fileStatus"></div>
</div>
<div class="form-group" ng-if="requireFPass">
<p translate="ADD_Label_3"> Your file is encrypted. Please enter the password: </p>
<input class="form-control" type="password" placeholder="{{ 'x_Password' | translate }}" ng-model="$parent.$parent.filePassword" ng-class="Validator.isPasswordLenValid($parent.$parent.filePassword,0) ? 'is-valid' : 'is-invalid'" ng-change="onFilePassChange()" />
</div>
</div>
<!-- /if selected upload -->
<!-- if selected type key-->
<div id="selectedTypeKey" ng-if="walletType=='pasteprivkey'">
<h4 translate="ADD_Radio_3"> Paste / type your private key: </h4>
<div class="form-group">
<textarea rows="4" class="form-control" placeholder="{{ 'x_PrivKey2' | translate }}" ng-model="$parent.$parent.manualprivkey" ng-class="Validator.isValidPrivKey($parent.$parent.manualprivkey.length) ? 'is-valid' : 'is-invalid'" ng-change="onPrivKeyChange()" ng-keyup="$event.keyCode == 13 && decryptWallet()"></textarea>
</div>
<div class="form-group" ng-if="requirePPass">
<p translate="ADD_Label_3"> Your file is encrypted. Please enter the password: </p>
<input class="form-control" type="password" placeholder="{{ 'x_Password' | translate }}" ng-model="$parent.$parent.privPassword" ng-class="Validator.isPasswordLenValid($parent.$parent.privPassword,0) ? 'is-valid' : 'is-invalid'" ng-change="onPrivKeyPassChange()" ng-keyup="$event.keyCode == 13 && decryptWallet()">
</div>
</div>
<!-- /if selected type key-->
<!-- if selected type mnemonic-->
<div id="selectedTypeMnemonic" ng-if="walletType=='pastemnemonic'">
<h4 translate="ADD_Radio_5"> Paste / type your mnemonic: </h4>
<div class="form-group">
<textarea rows="4" class="form-control" placeholder="{{ 'x_Mnemonic' | translate}}" ng-model="$parent.$parent.manualmnemonic" ng-class="Validator.isValidMnemonic($parent.$parent.manualmnemonic) ? 'is-valid' : 'is-invalid'" ng-change="onMnemonicChange()" ng-keyup="$event.keyCode == 13 && decryptWallet()"></textarea>
</div>
</div>
<!-- /if selected type mnemonic-->
<!-- if selected type ledger-->
<div id="selectedTypeLedger" ng-if="walletType=='ledger'">
<ol>
<li translate="ADD_Ledger_0a" class="text-danger" ng-hide="isSSL"> Re-open MyEtherWallet on a secure (SSL) connection </li>
<li translate="ADD_Ledger_0b" class="text-danger" ng-hide="isChrome"> Re-open MyEtherWallet using Google Chrome or Opera </li>
<li translate="ADD_Ledger_1">Connect your Ledger Nano S</li>
<li translate="ADD_Ledger_2">Open the Ethereum application (or a contract application)</li>
<li translate="ADD_Ledger_3">Verify that Browser Support is enabled in Settings</li>
<li translate="ADD_Ledger_4">If no Browser Support is found in settings, verify that you have Firmware >1.2</li>
</ol>
</div>
<!-- /if selected type ledger-->
<!-- if selected type trezor-->
<div id="selectedTypeTrezor" ng-if="walletType=='trezor'">
<div class="form-group"><a class="btn btn-primary btn-block btnAction" ng-show="walletType=='trezor'" ng-click="scanTrezor()" translate="ADD_Trezor_scan">SCAN</a></div>
<p ng-show="trezorError" class="text-center text-danger"><strong>{{trezorErrorString}}</strong></p>
</div>
<!-- /if selected type ledger-->
<!-- if selected addressOnly-->
<div id="selectedTypeKey" ng-if="walletType=='addressOnly'">
<h4 translate="x_Address"> Your Address </h4>
<div class="form-group"><textarea rows="4" class="form-control" placeholder="{{ 'x_Address' | translate }}" ng-model="$parent.$parent.addressOnly" ng-class="Validator.isValidAddress($parent.$parent.addressOnly) ? 'is-valid' : 'is-invalid'" ng-change="onAddressChange()"></textarea></div>
</div>
<!-- /if selected addressOnly-->
</section>
<!-- / Column 2 - Unlock That Key -->
<!-- Column 3 -The Unlock Button -->
<section class="col-md-4 col-sm-6" ng-show="showFDecrypt||showPDecrypt||showMDecrypt||walletType=='ledger'||walletType=='trezor'||showAOnly">
<h4 id="uploadbtntxt-wallet" ng-show="showFDecrypt" translate="ADD_Label_6"> Access Your Wallet:</h4>
<h4 id="uploadbtntxt-privkey" ng-show="showPDecrypt" translate="ADD_Label_6"> Access Your Wallet: </h4>
<h4 id="uploadbtntxt-mnemonic" ng-show="showMDecrypt" translate="ADD_Label_6"> Access Your Wallet: </h4>
<div class="form-group"><a class="btn btn-primary btn-block btnAction" ng-show="showFDecrypt||showPDecrypt||showMDecrypt" ng-click="decryptWallet()" translate="ADD_Label_6_short">UNLOCK</a></div>
<div class="form-group"><a class="btn btn-primary btn-block btnAction" ng-show="showAOnly" ng-click="decryptAddressOnly()" translate="ADD_Label_6_short">UNLOCK</a></div>
<div class="form-group"><a class="btn btn-primary btn-block btnAction" ng-show="walletType=='ledger'" ng-click="scanLedger()" translate="ADD_Ledger_scan">SCAN</a></div>
<div ng-bind-html="decryptStatus"></div>
</section>
<!-- / Column 3 -The Unlock Button -->
<!-- MODAL -->
<section class="modal fade" tabindex="-1" role="dialog" id="mnemonicModel">
<div class="modal-dialog" role="document" style="top: 200px">
<div class="modal-content">
<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>
<div class="modal-body">
<div ng-show="showMDecrypt">
<!-- Select HD Path -->
<h4 translate="ADD_Radio_5_Path"> Select HD derivation path: </h4>
<div class="form-group">
<div class="radio">
<label>
<input type="radio" id="hd_derivation_path_default" ng-model="$parent.HDWallet.dPath" value="{{$parent.HDWallet.defaultDPath}}" />
<span ng-bind="$parent.HDWallet.defaultDPath"></span>
<span ng-if="!showTrezorSeparate" translate="ADD_Radio_5_PathDefault_withTrezor">(default with trezor)</span>
<span ng-if="showTrezorSeparate" translate="ADD_Radio_5_PathDefault_withoutTrezor">(default without trezor)</span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" id="hd_derivation_path_alternative" ng-model="$parent.HDWallet.dPath" value="{{$parent.HDWallet.alternativeDPath}}" />
<span ng-bind="$parent.HDWallet.alternativeDPath"></span>
<span translate="ADD_Radio_5_PathAlternative">(alternative)</span>
</label>
</div>
<div class="radio" ng-if="showTrezorSeparate">
<label>
<input type="radio" id="hd_derivation_path_trezor" ng-model="$parent.HDWallet.dPath" value="{{$parent.getTrezorPath()}}" />
<span ng-bind="$parent.getTrezorPath()"></span>
<span translate="ADD_Radio_5_PathTrezor">(Trezor)</span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" id="hd_derivation_path_custom" ng-model="$parent.HDWallet.dPath" value="{{$parent.HDWallet.customDPath}}" />
<input type="text" class="form-control" style="display: inline; width: 70%" ng-model="$parent.HDWallet.customDPath" id="hd_derivation_path_custom_value" ng-change="onCustomHDDPathChange()" />
<span translate="ADD_Radio_5_PathCustom">(custom)</span>
</label>
</div>
</div>
</div>
<!-- / Select HD Path -->
<!-- Select Address -->
<h4 class="modal-title" translate="MNEM_1"> Please select the address you would like to interact with. </h4>
<p translate="MNEM_2"> Your single HD mnemonic phrase can access a number of wallets / addresses. Please select the address you would like to interact with at this time. </p>
<table class="table table-striped table-mnemonic">
<tr>
<th></th>
<th translate="x_Address"> Address </th>
<th translate="MYWAL_Bal"> Balance </th>
</tr>
<tr ng-repeat="wallet in HDWallet.wallets track by $index">
<td><input type="radio" name="addressSelect" value="{{$index}}" ng-model="HDWallet.id" /></td>
<td> {{wallet.getChecksumAddressString()}} </td>
<td> {{wallet.getBalance()}} ETH </td>
</tr>
<tr class="m-addresses">
<td><a ng-show="HDWallet.numWallets > 5" ng-click="AddRemoveHDAddresses(false)" translate="MNEM_prev">Previous Addresses</a></td>
<td></td>
<td><a ng-click="AddRemoveHDAddresses(true)" translate="MNEM_more">More<br />Addresses</a></td>
</tr>
</table>
</div>
<div class="modal-footer text-center">
<button type="button" class="btn btn-default" data-dismiss="modal" translate="x_Cancel">Cancel</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="setHDWallet()" translate="ADD_Label_6_short">Access Wallet</button>
</div>
</div>
</div>
</section>
<!-- / MODAL -->
</article>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment