Remove shapeshift deposit form (#6746)

Closes #6478
feature/default_network_editable
Mark Stacey 6 years ago committed by Dan J Miller
parent a257a73172
commit 313def1ce2
  1. 4
      app/_locales/cs/messages.json
  2. 4
      app/_locales/de/messages.json
  3. 4
      app/_locales/en/messages.json
  4. 4
      app/_locales/es/messages.json
  5. 4
      app/_locales/fr/messages.json
  6. 4
      app/_locales/hn/messages.json
  7. 4
      app/_locales/ht/messages.json
  8. 4
      app/_locales/it/messages.json
  9. 4
      app/_locales/ja/messages.json
  10. 4
      app/_locales/ko/messages.json
  11. 4
      app/_locales/nl/messages.json
  12. 4
      app/_locales/ph/messages.json
  13. 4
      app/_locales/pl/messages.json
  14. 4
      app/_locales/pt/messages.json
  15. 4
      app/_locales/ru/messages.json
  16. 4
      app/_locales/sk/messages.json
  17. 4
      app/_locales/sl/messages.json
  18. 4
      app/_locales/th/messages.json
  19. 4
      app/_locales/tml/messages.json
  20. 4
      app/_locales/tr/messages.json
  21. 4
      app/_locales/vi/messages.json
  22. 4
      app/_locales/zh_CN/messages.json
  23. 4
      app/_locales/zh_TW/messages.json
  24. 36
      ui/app/components/app/modals/deposit-ether-modal.js
  25. 8
      ui/app/components/app/modals/modal.js
  26. 40
      ui/app/components/app/modals/shapeshift-deposit-tx-modal.js
  27. 256
      ui/app/components/app/shapeshift-form.js
  28. 4
      ui/app/store/actions.js

@ -252,10 +252,6 @@
"depositBTC": {
"message": "Vložte BTC na níže uvedenou adresu:"
},
"depositCoin": {
"message": "Vložte $1 na níže uvedenou adresu",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "Vložit Eth"
},

@ -249,10 +249,6 @@
"depositBTC": {
"message": "Zahle dein BTC in die unten stehende Adresse ein:"
},
"depositCoin": {
"message": "Zahle deine $1 in die unten stehende Adresse ein",
"description": "Teilt dem Benutzer mit welchen Token er beim Einzahlen mit Shapeshift ausgewählt hat"
},
"depositEth": {
"message": "Eth kaufen"
},

@ -466,10 +466,6 @@
"depositBTC": {
"message": "Deposit your BTC to the address below:"
},
"depositCoin": {
"message": "Deposit your $1 to the address below",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "Deposit Eth"
},

@ -264,10 +264,6 @@
"depositBTC": {
"message": "Deposita tus BTC a la dirección de abajo:"
},
"depositCoin": {
"message": "Deposita tu $1 a la dirección de abajo",
"description": "Informa al usuario que moneda ha elegido para depositar en shapeshift"
},
"depositEth": {
"message": "Depositar Ether"
},

@ -330,10 +330,6 @@
"depositBTC": {
"message": "Déposez vos BTC à l'adresse ci-dessous:"
},
"depositCoin": {
"message": "Déposer votre $1 à l'adresse ci-dessous",
"description": "Indique à l'utilisateur quelle monnaie il a choisi de déposer avec Shapeshift"
},
"depositEth": {
"message": "Déposer Eth"
},

@ -240,10 +240,6 @@
"depositBTC": {
"message": "निए गए पत पर अपन जम कर:"
},
"depositCoin": {
"message": "निए गए पत पर अपन $1 जम कर",
"description": "उपयगकर बति उनिथ जम करनिए किस सि चयन कि"
},
"depositEth": {
"message": "Eth जमआरथ"
},

@ -336,10 +336,6 @@
"depositBTC": {
"message": "Depoze BTC ou nan adrès ki anba a:"
},
"depositCoin": {
"message": "Depoze $1 ou nan adrès ki anba a",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "Depo Eth"
},

@ -463,10 +463,6 @@
"depositBTC": {
"message": "Deposita i tuoi BTC all'indirizzo sotto:"
},
"depositCoin": {
"message": "Deposita $1 all'indirizzo sotto",
"description": "Dice all'utente quale moneta ha selezionato per depositare con Shapeshift"
},
"depositEth": {
"message": "Deposita Eth"
},

@ -228,10 +228,6 @@
"depositBTC": {
"message": "BTCを下記のアドレスへ振込んでください:"
},
"depositCoin": {
"message": "$1を下記のアドレスへ振込んでください",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "ETHを入金"
},

@ -402,10 +402,6 @@
"depositBTC": {
"message": "다음 주소로 BTC를 입금해주세요."
},
"depositCoin": {
"message": "다음 주소로 $1 만큼 입금해주세요.",
"description": "사용자에게 shapeshift에서 어떤 코인을 선택해 입금했는지 알려줍니다"
},
"depositEth": {
"message": "이더 입금하기"
},

@ -240,10 +240,6 @@
"depositBTC": {
"message": "Stort uw BTC op het onderstaande adres:"
},
"depositCoin": {
"message": "Stort uw $1 op het onderstaande adres",
"description": "Laat de gebruiker weten welk muntje ze hebben geselecteerd om te deponeren met shapeshift"
},
"depositEth": {
"message": "Aanbetaling Eth"
},

@ -201,10 +201,6 @@
"depositBTC": {
"message": "I-deposito ang iyong BTC sa address na ito:"
},
"depositCoin": {
"message": "I-deposito ang iyong $1 sa address na ito",
"description": "Sinasabihan ang user kung ano ang coin na kanilang pinili para I-deposito gamit ang shapeshift"
},
"depositEth": {
"message": "I-deposito ang Eth"
},

@ -249,10 +249,6 @@
"depositBTC": {
"message": "Zdeponuj swoje BTC na poniższy adres:"
},
"depositCoin": {
"message": "Zdeponuj $1 na poniższy adres",
"description": "Pokazuje użytkownikowi jakie waluty wybrał do zdeponowania w ShapeShift"
},
"depositEth": {
"message": "Zdeponuj Eth"
},

@ -240,10 +240,6 @@
"depositBTC": {
"message": "Deposite as suas BTC no endereço abaixo:"
},
"depositCoin": {
"message": "Deposite $1 no endereço abaixo",
"description": "Diz ao usuário que moeda selecionou para depositar com shapeshift"
},
"depositEth": {
"message": "Depositar Eth"
},

@ -252,10 +252,6 @@
"depositBTC": {
"message": "Отправьте ваш BTC на адрес ниже:"
},
"depositCoin": {
"message": "Отправьте ваш $1 на адрес ниже",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "Пополнить Eth"
},

@ -243,10 +243,6 @@
"depositBTC": {
"message": "Vložte BTC na níže uvedenou adresu:"
},
"depositCoin": {
"message": "Vložte $1 na níže uvedenou adresu",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "Vložit Eth"
},

@ -408,10 +408,6 @@
"depositBTC": {
"message": "Vplačajte vaš BTC na spodnji naslov:"
},
"depositCoin": {
"message": "Vplačajte vaš $1 na spodnji naslov",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "Vplačilo ETH"
},

@ -240,10 +240,6 @@
"depositBTC": {
"message": "ฝากบตคอยนของคณไปทแอดเดรสดานลางน:"
},
"depositCoin": {
"message": "ฝาก $1 ของคณไปทแอดเดรสดานลางน:",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "การฝากอเธอร"
},

@ -252,10 +252,6 @@
"depositBTC": {
"message": "க உஙகளகவரி உஙகள BTC வ:"
},
"depositCoin": {
"message": "உஙகளகவரி $ 1 ஐ க உளிடவ",
"description": "சபஷிி உடனகபபடட நணயத பயனரிடமி"
},
"depositEth": {
"message": "வ எத "
},

@ -252,10 +252,6 @@
"depositBTC": {
"message": "BTC'inizi aşağıdaki adrese yatırın:"
},
"depositCoin": {
"message": "$1'nızı aşağıdaki adrese yatırın",
"description": "Kullanıcıya hangi jetonu seçtiyse onu yatırmasını shapeshift ile söyler."
},
"depositEth": {
"message": "Eth yatır"
},

@ -201,10 +201,6 @@
"depositBTC": {
"message": "Ký gửi BTC đến địa chỉ sau:"
},
"depositCoin": {
"description": "Báo cho người dùng biết đồng tiền nào họ đã chọn để ký gửi với ShapeShift",
"message": "Ký gửi $1 đến địa chỉ sau:"
},
"depositEth": {
"message": "Ký gửi Eth"
},

@ -261,10 +261,6 @@
"depositBTC": {
"message": "将你的 BTC 存入到下面的地址:"
},
"depositCoin": {
"message": "将你的 $1 存入到下面的地址",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "存入 Eth"
},

@ -378,10 +378,6 @@
"depositBTC": {
"message": "將您的 BTC 存入到下面的位址:"
},
"depositCoin": {
"message": "將您的 $1 存入到下面的位址",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "存入乙太幣"
},

@ -5,7 +5,6 @@ const inherits = require('util').inherits
const connect = require('react-redux').connect
const actions = require('../../../store/actions')
const { getNetworkDisplayName } = require('../../../../../app/scripts/controllers/network/util')
const ShapeshiftForm = require('../shapeshift-form')
import Button from '../../ui/button'
@ -13,8 +12,6 @@ let DIRECT_DEPOSIT_ROW_TITLE
let DIRECT_DEPOSIT_ROW_TEXT
let WYRE_ROW_TITLE
let WYRE_ROW_TEXT
let SHAPESHIFT_ROW_TITLE
let SHAPESHIFT_ROW_TEXT
let FAUCET_ROW_TITLE
let COINSWITCH_ROW_TITLE
let COINSWITCH_ROW_TEXT
@ -56,15 +53,9 @@ function DepositEtherModal (_, context) {
DIRECT_DEPOSIT_ROW_TEXT = context.t('directDepositEtherExplainer')
WYRE_ROW_TITLE = context.t('buyWithWyre')
WYRE_ROW_TEXT = context.t('buyWithWyreDescription')
SHAPESHIFT_ROW_TITLE = context.t('depositShapeShift')
SHAPESHIFT_ROW_TEXT = context.t('depositShapeShiftExplainer')
FAUCET_ROW_TITLE = context.t('testFaucet')
COINSWITCH_ROW_TITLE = context.t('buyCoinSwitch')
COINSWITCH_ROW_TEXT = context.t('buyCoinSwitchExplainer')
this.state = {
buyingWithShapeshift: false,
}
}
DepositEtherModal.contextTypes = {
@ -131,7 +122,6 @@ DepositEtherModal.prototype.renderRow = function ({
DepositEtherModal.prototype.render = function () {
const { network, toWyre, toCoinSwitch, address, toFaucet } = this.props
const { buyingWithShapeshift } = this.state
const isTestNetwork = ['3', '4', '5', '42'].find(n => n === network)
const networkName = getNetworkDisplayName(network)
@ -148,7 +138,6 @@ DepositEtherModal.prototype.render = function () {
h('div.page-container__header-close', {
onClick: () => {
this.setState({ buyingWithShapeshift: false })
this.props.hideWarning()
this.props.hideModal()
},
@ -168,7 +157,6 @@ DepositEtherModal.prototype.render = function () {
text: DIRECT_DEPOSIT_ROW_TEXT,
buttonLabel: this.context.t('viewAccount'),
onButtonClick: () => this.goToAccountDetailsModal(),
hide: buyingWithShapeshift,
}),
this.renderRow({
@ -177,7 +165,7 @@ DepositEtherModal.prototype.render = function () {
text: this.facuetRowText(networkName),
buttonLabel: this.context.t('getEther'),
onButtonClick: () => toFaucet(network),
hide: !isTestNetwork || buyingWithShapeshift,
hide: !isTestNetwork,
}),
this.renderRow({
@ -191,7 +179,7 @@ DepositEtherModal.prototype.render = function () {
text: WYRE_ROW_TEXT,
buttonLabel: this.context.t('continueToWyre'),
onButtonClick: () => toWyre(address),
hide: isTestNetwork || buyingWithShapeshift,
hide: isTestNetwork,
}),
this.renderRow({
@ -205,29 +193,9 @@ DepositEtherModal.prototype.render = function () {
text: COINSWITCH_ROW_TEXT,
buttonLabel: this.context.t('continueToCoinSwitch'),
onButtonClick: () => toCoinSwitch(address),
hide: isTestNetwork || buyingWithShapeshift,
}),
this.renderRow({
logo: h('div.deposit-ether-modal__logo', {
style: {
backgroundImage: 'url(\'./images/shapeshift logo.png\')',
},
}),
title: SHAPESHIFT_ROW_TITLE,
text: SHAPESHIFT_ROW_TEXT,
buttonLabel: this.context.t('shapeshiftBuy'),
onButtonClick: () => this.setState({ buyingWithShapeshift: true }),
hide: isTestNetwork,
hideButton: buyingWithShapeshift,
hideTitle: buyingWithShapeshift,
onBackClick: () => this.setState({ buyingWithShapeshift: false }),
showBackButton: this.state.buyingWithShapeshift,
className: buyingWithShapeshift && 'deposit-ether-modal__buy-row__shapeshift-buy',
}),
buyingWithShapeshift && h(ShapeshiftForm),
]),
]),

@ -16,7 +16,6 @@ const AccountDetailsModal = require('./account-details-modal')
const EditAccountNameModal = require('./edit-account-name-modal')
const ExportPrivateKeyModal = require('./export-private-key-modal')
const NewAccountModal = require('./new-account-modal')
const ShapeshiftDepositTxModal = require('./shapeshift-deposit-tx-modal.js')
const HideTokenConfirmationModal = require('./hide-token-confirmation-modal')
const NotifcationModal = require('./notification-modal')
const QRScanner = require('./qr-scanner')
@ -181,13 +180,6 @@ const MODALS = {
...accountModalStyle,
},
SHAPESHIFT_DEPOSIT_TX: {
contents: [
h(ShapeshiftDepositTxModal),
],
...accountModalStyle,
},
HIDE_TOKEN_CONFIRMATION: {
contents: [
h(HideTokenConfirmationModal, {}, []),

@ -1,40 +0,0 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const connect = require('react-redux').connect
const actions = require('../../../store/actions')
const QrView = require('../../ui/qr-code')
const AccountModalContainer = require('./account-modal-container')
function mapStateToProps (state) {
return {
Qr: state.appState.modal.modalState.props.Qr,
}
}
function mapDispatchToProps (dispatch) {
return {
hideModal: () => {
dispatch(actions.hideModal())
},
}
}
inherits(ShapeshiftDepositTxModal, Component)
function ShapeshiftDepositTxModal () {
Component.call(this)
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(ShapeshiftDepositTxModal)
ShapeshiftDepositTxModal.prototype.render = function () {
const { Qr } = this.props
return h(AccountModalContainer, {
}, [
h('div', {}, [
h(QrView, {key: 'qr', Qr}),
]),
])
}

@ -1,256 +0,0 @@
const h = require('react-hyperscript')
const inherits = require('util').inherits
const PropTypes = require('prop-types')
const Component = require('react').Component
const connect = require('react-redux').connect
const classnames = require('classnames')
const qrcode = require('qrcode-generator')
const { shapeShiftSubview, pairUpdate, buyWithShapeShift } = require('../../store/actions')
const { isValidAddress } = require('../../helpers/utils/util')
const SimpleDropdown = require('./dropdowns/simple-dropdown')
import Button from '../ui/button'
function mapStateToProps (state) {
const {
coinOptions,
tokenExchangeRates,
selectedAddress,
} = state.metamask
const { warning } = state.appState
return {
coinOptions,
tokenExchangeRates,
selectedAddress,
warning,
}
}
function mapDispatchToProps (dispatch) {
return {
shapeShiftSubview: () => dispatch(shapeShiftSubview()),
pairUpdate: coin => dispatch(pairUpdate(coin)),
buyWithShapeShift: data => dispatch(buyWithShapeShift(data)),
}
}
ShapeshiftForm.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(ShapeshiftForm)
inherits(ShapeshiftForm, Component)
function ShapeshiftForm () {
Component.call(this)
this.state = {
depositCoin: 'btc',
refundAddress: '',
showQrCode: false,
depositAddress: '',
errorMessage: '',
isLoading: false,
bought: false,
}
}
ShapeshiftForm.prototype.getCoinPair = function () {
return `${this.state.depositCoin.toUpperCase()}_ETH`
}
ShapeshiftForm.prototype.componentWillMount = function () {
this.props.shapeShiftSubview()
}
ShapeshiftForm.prototype.onCoinChange = function (coin) {
this.setState({
depositCoin: coin,
errorMessage: '',
})
this.props.pairUpdate(coin)
}
ShapeshiftForm.prototype.onBuyWithShapeShift = function () {
this.setState({
isLoading: true,
showQrCode: true,
})
const {
buyWithShapeShift,
selectedAddress: withdrawal,
} = this.props
const {
refundAddress: returnAddress,
depositCoin,
} = this.state
const pair = `${depositCoin}_eth`
const data = {
withdrawal,
pair,
returnAddress,
// Public api key
'apiKey': '803d1f5df2ed1b1476e4b9e6bcd089e34d8874595dda6a23b67d93c56ea9cc2445e98a6748b219b2b6ad654d9f075f1f1db139abfa93158c04e825db122c14b6',
}
if (isValidAddress(withdrawal)) {
buyWithShapeShift(data)
.then(d => this.setState({
showQrCode: true,
depositAddress: d.deposit,
isLoading: false,
}))
.catch(() => this.setState({
showQrCode: false,
errorMessage: this.context.t('invalidRequest'),
isLoading: false,
}))
}
}
ShapeshiftForm.prototype.renderMetadata = function (label, value) {
return h('div', {className: 'shapeshift-form__metadata-wrapper'}, [
h('div.shapeshift-form__metadata-label', {}, [
h('span', `${label}:`),
]),
h('div.shapeshift-form__metadata-value', {}, [
h('span', value),
]),
])
}
ShapeshiftForm.prototype.renderMarketInfo = function () {
const { tokenExchangeRates } = this.props
const {
limit,
rate,
minimum,
} = tokenExchangeRates[this.getCoinPair()] || {}
return h('div.shapeshift-form__metadata', {}, [
this.renderMetadata(this.context.t('status'), limit ? this.context.t('available') : this.context.t('unavailable')),
this.renderMetadata(this.context.t('limit'), limit),
this.renderMetadata(this.context.t('exchangeRate'), rate),
this.renderMetadata(this.context.t('min'), minimum),
])
}
ShapeshiftForm.prototype.renderQrCode = function () {
const { depositAddress, isLoading, depositCoin } = this.state
const qrImage = qrcode(4, 'M')
qrImage.addData(depositAddress)
qrImage.make()
return h('div.shapeshift-form', {}, [
h('div.shapeshift-form__deposit-instruction', [
this.context.t('depositCoin', [depositCoin.toUpperCase()]),
]),
h('div', depositAddress),
h('div.shapeshift-form__qr-code', [
isLoading
? h('img', {
src: 'images/loading.svg',
style: { width: '60px'},
})
: h('div', {
dangerouslySetInnerHTML: { __html: qrImage.createTableTag(4) },
}),
]),
this.renderMarketInfo(),
])
}
ShapeshiftForm.prototype.render = function () {
const { coinOptions, btnClass, warning } = this.props
const { errorMessage, showQrCode, depositAddress } = this.state
const { tokenExchangeRates } = this.props
const token = tokenExchangeRates[this.getCoinPair()]
return h('div.shapeshift-form-wrapper', [
showQrCode
? this.renderQrCode()
: h('div.modal-shapeshift-form', [
h('div.shapeshift-form__selectors', [
h('div.shapeshift-form__selector', [
h('div.shapeshift-form__selector-label', this.context.t('deposit')),
h(SimpleDropdown, {
selectedOption: this.state.depositCoin,
onSelect: (coin) => this.onCoinChange(coin),
options: Object.entries(coinOptions).map(([coin]) => ({
value: coin.toLowerCase(),
displayValue: coin,
})),
}),
]),
h('div.icon.shapeshift-form__caret', {
style: { backgroundImage: 'url(images/caret-right.svg)'},
}),
h('div.shapeshift-form__selector', [
h('div.shapeshift-form__selector-label', [
this.context.t('receive'),
]),
h('div.shapeshift-form__selector-input', ['ETH']),
]),
]),
warning && h('div.shapeshift-form__address-input-label', warning),
!warning && h('div', {
className: classnames('shapeshift-form__address-input-wrapper', {
'shapeshift-form__address-input-wrapper--error': errorMessage,
}),
}, [
h('div.shapeshift-form__address-input-label', [
this.context.t('refundAddress'),
]),
h('input.shapeshift-form__address-input', {
type: 'text',
onChange: e => this.setState({
refundAddress: e.target.value,
errorMessage: '',
}),
}),
h('divshapeshift-form__address-input-error-message', [errorMessage]),
]),
!warning && this.renderMarketInfo(),
]),
!depositAddress && h(Button, {
type: 'secondary',
large: true,
className: `${btnClass} shapeshift-form__shapeshift-buy-btn`,
disabled: !token,
onClick: () => this.onBuyWithShapeShift(),
}, [this.context.t('buy')]),
])
}

@ -2384,10 +2384,6 @@ function reshowQrCode (data, coin) {
dispatch(actions.hideLoadingIndication())
return dispatch(actions.showQrView(data, message))
// return dispatch(actions.showModal({
// name: 'SHAPESHIFT_DEPOSIT_TX',
// Qr: { data, message },
// }))
})
}
}

Loading…
Cancel
Save