diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-06-13 05:37:32 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-06-13 05:38:26 +0800 |
commit | d1fa3c6de16e5335ea9c21938029312df95c3d51 (patch) | |
tree | 0b1be0d6701c740fdd8d41da03664cbffb0b17b6 | |
parent | 5668910244a44874de93547d4037ee060ed5a264 (diff) | |
download | tangerine-wallet-browser-d1fa3c6de16e5335ea9c21938029312df95c3d51.tar tangerine-wallet-browser-d1fa3c6de16e5335ea9c21938029312df95c3d51.tar.gz tangerine-wallet-browser-d1fa3c6de16e5335ea9c21938029312df95c3d51.tar.bz2 tangerine-wallet-browser-d1fa3c6de16e5335ea9c21938029312df95c3d51.tar.lz tangerine-wallet-browser-d1fa3c6de16e5335ea9c21938029312df95c3d51.tar.xz tangerine-wallet-browser-d1fa3c6de16e5335ea9c21938029312df95c3d51.tar.zst tangerine-wallet-browser-d1fa3c6de16e5335ea9c21938029312df95c3d51.zip |
only prefix ethereum address
-rw-r--r-- | ui/app/components/qr-code.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/app/components/qr-code.js b/ui/app/components/qr-code.js index ac40e9ced..06b9aed9b 100644 --- a/ui/app/components/qr-code.js +++ b/ui/app/components/qr-code.js @@ -3,6 +3,7 @@ const h = require('react-hyperscript') const qrCode = require('qrcode-npm').qrcode const inherits = require('util').inherits const connect = require('react-redux').connect +const isHexPrefixed = require('ethereumjs-util').isHexPrefixed const CopyButton = require('./copyButton') module.exports = connect(mapStateToProps)(QrCodeView) @@ -22,12 +23,12 @@ function QrCodeView () { } QrCodeView.prototype.render = function () { - var props = this.props - var Qr = props.Qr - var qrImage = qrCode(4, 'M') - qrImage.addData(`ethereum:${Qr.data}`) + const props = this.props + const Qr = props.Qr + const address = `${isHexPrefixed(Qr.data) ? 'ethereum:' : ''}${Qr.data}` + const qrImage = qrCode(4, 'M') + qrImage.addData(address) qrImage.make() - return h('.main-container.flex-column', { key: 'qr', style: { |