1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Create a ShapeShift tx in tx History

This commit is contained in:
Frankie 2016-08-18 15:20:26 -07:00
parent 23aeb1c5c1
commit 3525dc0801
8 changed files with 105 additions and 65 deletions

View File

@ -340,8 +340,8 @@ ConfigManager.prototype.getShapeShiftTxList = function () {
if (tx.response.status !== 'complete') { if (tx.response.status !== 'complete') {
var requestListner = function (request) { var requestListner = function (request) {
tx.response = JSON.parse(this.responseText) tx.response = JSON.parse(this.responseText)
if (tx.status === 'complete') { if (tx.response.status === 'complete') {
tx.completeTime = new Date().getTime() tx.time = new Date().getTime()
} }
} }
@ -351,6 +351,7 @@ ConfigManager.prototype.getShapeShiftTxList = function () {
shapShiftReq.send() shapShiftReq.send()
} }
}) })
this.setData(data)
return shapeShiftTxList return shapeShiftTxList
} }
@ -365,3 +366,4 @@ ConfigManager.prototype.createShapeShiftTx = function (depositAddress, depositTy
} }
this.setData(data) this.setData(data)
} }

View File

@ -322,7 +322,6 @@ module.exports = class MetamaskController {
createShapeShiftTx (depositAddress, depositType) { createShapeShiftTx (depositAddress, depositType) {
this.configManager.createShapeShiftTx(depositAddress, depositType) this.configManager.createShapeShiftTx(depositAddress, depositType)
} }
} }
function noop () {} function noop () {}

View File

@ -54,7 +54,7 @@ BuyButtonSubview.prototype.render = function () {
justifyContent: 'space-around', justifyContent: 'space-around',
}, },
}, [ }, [
h(currentForm.coinbase ? '.activeForm' : '.inactiveForm', { h(currentForm.coinbase ? '.activeForm' : '.inactiveForm.pointer', {
onClick: () => props.dispatch(actions.coinBaseSubview()), onClick: () => props.dispatch(actions.coinBaseSubview()),
}, 'Coinbase'), }, 'Coinbase'),
h('a', { h('a', {
@ -67,7 +67,7 @@ BuyButtonSubview.prototype.render = function () {
}, },
}), }),
]), ]),
h(currentForm.shapeshift ? '.activeForm' : '.inactiveForm', { h(currentForm.shapeshift ? '.activeForm' : '.inactiveForm.pointer', {
onClick: () => props.dispatch(actions.shapeShiftSubview(props.provider.type)), onClick: () => props.dispatch(actions.shapeShiftSubview(props.provider.type)),
}, 'Shapeshift'), }, 'Shapeshift'),

View File

@ -10,6 +10,7 @@ const addressSummary = require('../util').addressSummary
const CopyButton = require('./copyButton') const CopyButton = require('./copyButton')
const EtherBalance = require('./eth-balance') const EtherBalance = require('./eth-balance')
const Tooltip = require('./tooltip')
module.exports = connect(mapStateToProps)(ShiftListItem) module.exports = connect(mapStateToProps)(ShiftListItem)
@ -19,14 +20,14 @@ function mapStateToProps (state) {
} }
inherits(ShiftListItem, Component) inherits(ShiftListItem, Component)
function ShiftListItem () { function ShiftListItem () {
Component.call(this) Component.call(this)
} }
ShiftListItem.prototype.render = function () { ShiftListItem.prototype.render = function () {
const props = this.props
return ( return (
h(`.transaction-list-item.flex-row`, { h('.transaction-list-item.flex-row', {
style: { style: {
paddingTop: '20px', paddingTop: '20px',
paddingBottom: '20px', paddingBottom: '20px',
@ -68,8 +69,13 @@ ShiftListItem.prototype.renderUtilComponents = function () {
switch (props.response.status) { switch (props.response.status) {
case 'no_deposits': case 'no_deposits':
return h('.flex-row', [ return h('.flex-row', [
h(CopyButton, { value: this.props.depositAddress }), h(CopyButton, {
h('i.fa.fa-qrcode.pointer', { value: this.props.depositAddress,
}),
h(Tooltip, {
title: 'QR Code',
}, [
h('i.fa.fa-qrcode.pointer.pop-hover', {
onClick: () => props.dispatch(actions.reshowQrCode(props.depositAddress, props.depositType)), onClick: () => props.dispatch(actions.reshowQrCode(props.depositAddress, props.depositType)),
style: { style: {
margin: '5px', margin: '5px',
@ -79,19 +85,37 @@ ShiftListItem.prototype.renderUtilComponents = function () {
color: '#F7861C', color: '#F7861C',
}, },
}), }),
]),
]) ])
case 'received': case 'received':
return h('.flex-row') return h('.flex-row')
case 'complete': case 'complete':
return h('.flex-row', [ return h('.flex-row', [
h(CopyButton, { value: this.props.response.transaction }), h(CopyButton, {
value: this.props.response.transaction,
}),
h('.flex-row', {
style: {
alignItems: 'baseline',
},
}, [
h('.color-orange', {
style: {
fontFamily: 'Montserrat Light',
position: 'relative',
left: '6px',
},
}, '+'),
h(EtherBalance, { h(EtherBalance, {
value: `+${props.response.outgoingCoin}`, value: `${props.response.outgoingCoin}`,
width: '55px', width: '55px',
shorten: true, shorten: true,
style: {fontSize: '15px'}, style: {
}) fontSize: '15px',
},
}),
]),
]) ])
case 'failed': case 'failed':
@ -106,17 +130,20 @@ ShiftListItem.prototype.renderInfo = function () {
var props = this.props var props = this.props
switch (props.response.status) { switch (props.response.status) {
case 'no_deposits': case 'no_deposits':
return h('.flex-column', {style: {width: '200px', overflow: 'hidden'}}, [ return h('.flex-column', {
style: {
width: '200px',
overflow: 'hidden',
},
}, [
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, [ }, `${props.depositType} to ETH via ShapeShift`),
`${props.depositType} to ETH via ShapeShift` h('div', 'No deposits received'),
]),
h('div', `Status: ${props.response.status.replace('_', ' ')}`),
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
@ -126,17 +153,20 @@ ShiftListItem.prototype.renderInfo = function () {
}, formatDate(props.time)), }, formatDate(props.time)),
]) ])
case 'received': case 'received':
return h('.flex-column', {style: {width: '200px', overflow: 'hidden'}}, [ return h('.flex-column', {
style: {
width: '200px',
overflow: 'hidden',
},
}, [
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, [ }, `${props.depositType} to ETH via ShapeShift`),
`${props.depositType} to ETH via ShapeShift` h('div', 'Conversion in progress'),
]),
h('div', `Conversion in progress`),
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
@ -149,8 +179,13 @@ ShiftListItem.prototype.renderInfo = function () {
var url = explorerLink(props.response.transaction, parseInt('1')) var url = explorerLink(props.response.transaction, parseInt('1'))
return h('.flex-column.pointer', { return h('.flex-column.pointer', {
style: {width: '200px', overflow: 'hidden'}, style: {
onClick: () => extension.tabs.create({ url }) width: '200px',
overflow: 'hidden',
},
onClick: () => extension.tabs.create({
url,
}),
}, [ }, [
h('div', { h('div', {
style: { style: {
@ -158,8 +193,8 @@ ShiftListItem.prototype.renderInfo = function () {
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, `ShapeShift`), }, 'From ShapeShift'),
h('div', props.completeTime), h('div', formatDate(props.time)),
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',

View File

@ -592,3 +592,7 @@ div.message-container > div:first-child {
font-size: 15px; font-size: 15px;
color: #4D4D4D; color: #4D4D4D;
} }
.pop-hover:hover {
transform: scale(1.1);
}