1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 03:12:42 +02:00

Add send button to TokenFactory

A simple solution to a temporary token send screen: Linking to EtherScan.

Will hold us over until we make our own token send view.
This commit is contained in:
Dan Finlay 2017-06-19 16:12:34 -07:00
parent 48789f2a3d
commit 60855b0510
2 changed files with 30 additions and 7 deletions

View File

@ -5,6 +5,7 @@
- Add list of popular tokens held to the account detail view.
- Add ability to add Tokens to token list.
- Add a warning to JSON file import.
- Add "send" link to token list, which goes to TokenFactory.
## 3.7.8 2017-6-12

View File

@ -17,12 +17,7 @@ TokenCell.prototype.render = function () {
return (
h('li.token-cell', {
style: { cursor: network === '1' ? 'pointer' : 'default' },
onClick: (event) => {
const url = urlFor(address, userAddress, network)
if (url) {
navigateTo(url)
}
},
onClick: this.view.bind(this, address, userAddress, network),
}, [
h(Identicon, {
@ -32,15 +27,42 @@ TokenCell.prototype.render = function () {
}),
h('h3', `${string || 0} ${symbol}`),
h('span', { style: { flex: '1 0 auto' } }),
h('button', {
onClick: this.send.bind(this, address),
}, 'SEND'),
])
)
}
TokenCell.prototype.send = function (address, event) {
event.preventDefault()
event.stopPropagation
const url = tokenFactoryFor(address)
if (url) {
navigateTo(url)
}
}
TokenCell.prototype.view = function (address, userAddress, network, event) {
const url = etherscanLinkFor(address, userAddress, network)
if (url) {
navigateTo(url)
}
}
function navigateTo (url) {
global.platform.openWindow({ url })
}
function urlFor (tokenAddress, address, network) {
function etherscanLinkFor (tokenAddress, address, network) {
return `https://etherscan.io/token/${tokenAddress}?a=${address}`
}
function tokenFactoryFor (tokenAddress) {
return `https://tokenfactory.surge.sh/#/token/${tokenAddress}`
}