22var $ = require ( 'jquery' )
33var yo = require ( 'yo-yo' )
44var remixLib = require ( 'chainsql-remix-lib' )
5- var ethJSUtil = require ( 'ethereumjs-util' )
65var csjs = require ( 'csjs-inject' )
76var txExecution = remixLib . execution . txExecution
87var txFormat = remixLib . execution . txFormat
@@ -13,8 +12,6 @@ var helper = require('../../lib/helper.js')
1312var executionContext = require ( '../../execution-context' )
1413var modalDialogCustom = require ( '../ui/modal-dialog-custom' )
1514var copyToClipboard = require ( '../ui/copy-to-clipboard' )
16- const Buffer = require ( 'safe-buffer' ) . Buffer
17- var Personal = require ( 'web3-eth-personal' )
1815var Card = require ( '../ui/card' )
1916var Recorder = require ( '../../recorder' )
2017var addTooltip = require ( '../ui/tooltip' )
@@ -567,10 +564,10 @@ function settings (container, self) {
567564 <div class=${ css . account } >
568565 <select name="txorigin" class="${ css . select } " id="txorigin"></select>
569566 ${ copyToClipboard ( ( ) => document . querySelector ( '#runTabView #txorigin' ) . value ) }
570- <i class="fa fa-pencil-square-o ${ css . icon } " aria-hiden="true" onclick=${ signMessage } title="Sign a message using this account key"></i>
571567 </div>
572568 </div>
573569 `
570+ // <i class="fa fa-pencil-square-o ${css.icon}" aria-hiden="true" onclick=${signMessage} title="Sign a message using this account key"></i>
574571 var gasPriceEl = yo `
575572 <div class="${ css . crow } ">
576573 <div class="${ css . col1_1 } ">Gas limit</div>
@@ -685,67 +682,6 @@ function settings (container, self) {
685682 }
686683 } )
687684 }
688- function signMessage ( event ) {
689- self . _deps . udapp . getAccounts ( ( err , accounts ) => {
690- if ( err ) { addTooltip ( `Cannot get account list: ${ err } ` ) }
691- var signMessageDialog = { 'title' : 'Sign a message' , 'text' : 'Enter a message to sign' , 'inputvalue' : 'Message to sign' }
692- var $txOrigin = container . querySelector ( '#txorigin' )
693- var account = $txOrigin . selectedOptions [ 0 ] . value
694- var isVM = executionContext . isVM ( )
695- var isInjected = executionContext . getProvider ( ) === 'injected'
696- function alertSignedData ( error , hash , signedData ) {
697- if ( error && error . message !== '' ) {
698- console . log ( error )
699- addTooltip ( error . message )
700- } else {
701- modalDialogCustom . alert ( yo `<div><b>hash:</b>${ hash } <br><b>signature:</b>${ signedData } </div>` )
702- }
703- }
704- if ( isVM ) {
705- modalDialogCustom . promptMulti ( signMessageDialog , ( message ) => {
706- const personalMsg = ethJSUtil . hashPersonalMessage ( Buffer . from ( message ) )
707- var privKey = self . _deps . udapp . accounts [ account ] . privateKey
708- try {
709- var rsv = ethJSUtil . ecsign ( personalMsg , privKey )
710- var signedData = ethJSUtil . toRpcSig ( rsv . v , rsv . r , rsv . s )
711- alertSignedData ( null , '0x' + personalMsg . toString ( 'hex' ) , signedData )
712- } catch ( e ) {
713- addTooltip ( e . message )
714- return
715- }
716- } , false )
717- } else if ( isInjected ) {
718- modalDialogCustom . promptMulti ( signMessageDialog , ( message ) => {
719- const hashedMsg = executionContext . web3 ( ) . sha3 ( message )
720- try {
721- executionContext . web3 ( ) . eth . sign ( account , hashedMsg , ( error , signedData ) => {
722- alertSignedData ( error , hashedMsg , signedData )
723- } )
724- } catch ( e ) {
725- addTooltip ( e . message )
726- console . log ( e )
727- return
728- }
729- } )
730- } else {
731- modalDialogCustom . promptPassphrase ( 'Passphrase to sign a message' , 'Enter your passphrase for this account to sign the message' , '' , ( passphrase ) => {
732- modalDialogCustom . promptMulti ( signMessageDialog , ( message ) => {
733- const hashedMsg = executionContext . web3 ( ) . sha3 ( message )
734- try {
735- var personal = new Personal ( executionContext . web3 ( ) . currentProvider )
736- personal . sign ( hashedMsg , account , passphrase , ( error , signedData ) => {
737- alertSignedData ( error , hashedMsg , signedData )
738- } )
739- } catch ( e ) {
740- addTooltip ( e . message )
741- console . log ( e )
742- return
743- }
744- } )
745- } , false )
746- }
747- } )
748- }
749685
750686 return el
751687}
0 commit comments