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

svg notif - use actual txParams

This commit is contained in:
kumavis 2016-06-23 16:42:40 -07:00
parent d293ef0494
commit 3cf7bf725f

View File

@ -55,15 +55,8 @@ function createUnlockRequestNotification (opts) {
function createTxNotification (opts) { function createTxNotification (opts) {
// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
if (!chrome.notifications) return console.error('Chrome notifications API missing...') if (!chrome.notifications) return console.error('Chrome notifications API missing...')
var message = [
'Submitted by ' + opts.txParams.origin,
'to: ' + uiUtils.addressSummary(opts.txParams.to),
'from: ' + uiUtils.addressSummary(opts.txParams.from),
'value: ' + uiUtils.formatBalance(opts.txParams.value),
'data: ' + uiUtils.dataSize(opts.txParams.data),
].join('\n')
transactionNotificationSVG(opts, function(err, source){ renderTransactionNotificationSVG(opts, function(err, source){
var imageUrl = 'data:image/svg+xml;utf8,' + encodeURIComponent(source) var imageUrl = 'data:image/svg+xml;utf8,' + encodeURIComponent(source)
@ -74,7 +67,7 @@ function createTxNotification (opts) {
iconUrl: '/images/icon-128.png', iconUrl: '/images/icon-128.png',
imageUrl: imageUrl, imageUrl: imageUrl,
title: opts.title, title: opts.title,
message: message, message: '',
buttons: [{ buttons: [{
title: 'confirm', title: 'confirm',
}, { }, {
@ -117,14 +110,12 @@ function createMsgNotification (opts) {
} }
} }
function transactionNotificationSVG(opts, cb){ function renderTransactionNotificationSVG(opts, cb){
var state = { var state = {
nonInteractive: true, nonInteractive: true,
inlineIdenticons: true,
txData: { txData: {
txParams: { txParams: opts.txParams,
from: '0x5fda30bb72b8dfe20e48a00dfc108d0915be9bb0',
to: '0x5fda30bb72b8dfe20e48a00dfc108d0915be9bb0',
},
time: (new Date()).getTime(), time: (new Date()).getTime(),
}, },
identities: { identities: {
@ -155,7 +146,6 @@ function transactionNotificationSVG(opts, cb){
unmountComponentAtNode(container) unmountComponentAtNode(container)
var svgSource = svgWrapper(viewSource) var svgSource = svgWrapper(viewSource)
// insert content into svg wrapper // insert content into svg wrapper
console.log(svgSource)
cb(null, svgSource) cb(null, svgSource)
}) })
} }