1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00

Send tx working; user is taken to confirm page with correct transaction information.

This commit is contained in:
Dan 2017-08-29 20:27:00 -02:30 committed by Chi Kei Chan
parent 6ef483be4a
commit 78f39bcce6
2 changed files with 67 additions and 39 deletions

View File

@ -417,7 +417,7 @@ function signTx (txData) {
if (err) return dispatch(actions.displayWarning(err.message)) if (err) return dispatch(actions.displayWarning(err.message))
dispatch(actions.hideWarning()) dispatch(actions.hideWarning())
}) })
dispatch(this.showConfTxPage()) dispatch(actions.showConfTxPage())
} }
} }

View File

@ -69,7 +69,7 @@ function SendTransactionScreen () {
from: '', from: '',
to: '', to: '',
// these values are hardcoded, so "Next" can be clicked // these values are hardcoded, so "Next" can be clicked
amount: '0.0001', // see L544 amount: '0x0', // see L544
gasPrice: '0x5d21dba00', gasPrice: '0x5d21dba00',
gas: '0x7b0d', gas: '0x7b0d',
txData: null, txData: null,
@ -98,6 +98,7 @@ SendTransactionScreen.prototype.render = function () {
conversionRate, conversionRate,
currentCurrency, currentCurrency,
} = props } = props
const { blockGasLimit, newTx } = this.state const { blockGasLimit, newTx } = this.state
const { gas, gasPrice } = newTx const { gas, gasPrice } = newTx
@ -141,16 +142,14 @@ SendTransactionScreen.prototype.render = function () {
h('input.large-input.send-screen-input', { h('input.large-input.send-screen-input', {
list: 'accounts', list: 'accounts',
placeholder: 'Account', placeholder: 'Account',
value: this.state.from, value: this.state.newTx.from,
onChange: (event) => { onChange: (event) => {
console.log('event', event.target.value) console.log('event', event.target.value)
this.setState({ this.setState({
newTx: Object.assign( newTx: {
this.state.newTx, ...this.state.newTx,
{
from: event.target.value, from: event.target.value,
} },
),
}) })
}, },
}, [ }, [
@ -175,24 +174,61 @@ SendTransactionScreen.prototype.render = function () {
'To:', 'To:',
]), ]),
h(EnsInput, { h('input.large-input.send-screen-input', {
name: 'address', name: 'address',
placeholder: 'Recipient Address', list: 'addresses',
onChange: () => { placeholder: 'Address',
value: this.state.newTx.to,
onChange: (event) => {
console.log('event', event.target.value) console.log('event', event.target.value)
this.setState({ this.setState({
newTx: Object.assign( newTx: {
this.state.newTx, ...this.state.newTx,
{
to: event.target.value, to: event.target.value,
} },
),
}) })
}, },
network, }, [
identities, ]),
addressBook,
h('datalist#addresses', {}, [
// Corresponds to the addresses owned.
Object.keys(props.identities).map((key) => {
const identity = props.identities[key]
return h('option', {
value: identity.address,
label: identity.name,
key: identity.address,
})
}), }),
// Corresponds to previously sent-to addresses.
props.addressBook.map((identity) => {
return h('option', {
value: identity.address,
label: identity.name,
key: identity.address,
})
}),
]),
// h(EnsInput, {
// name: 'address',
// placeholder: 'Recipient Address',
// value: this.state.newTx.to,
// onChange: (event) => {
// this.setState({
// newTx: Object.assign(
// this.state.newTx,
// {
// to: event.target.value,
// }
// ),
// })
// },
// network,
// identities,
// addressBook,
// }),
]), ]),
@ -209,7 +245,7 @@ SendTransactionScreen.prototype.render = function () {
h('input.large-input.send-screen-input', { h('input.large-input.send-screen-input', {
placeholder: '0 ETH', placeholder: '0 ETH',
type: 'number', type: 'number',
onChange: () => { onChange: (event) => {
this.setState({ this.setState({
newTx: Object.assign( newTx: Object.assign(
this.state.newTx, this.state.newTx,
@ -631,23 +667,15 @@ SendTransactionScreen.prototype.onSubmit = function () {
this.props.dispatch(addToAddressBook(recipient, nickname)) this.props.dispatch(addToAddressBook(recipient, nickname))
// var txParams = {
// // from: this.props.address,
// from: this.state.newTx.to,
// // value: '0x' + value.toString(16),
// value: '0x38d7ea4c68000', // hardcoded
// // New: gas will now be specified on this step
// gas: this.state.newTx.gas,
// gasPrice: this.state.newTx.gasPrice
// }
// Hardcoded
var txParams = { var txParams = {
from: '0x82df11beb942beeed58d466fcb0f0791365c7684', from: this.state.newTx.from,
to: '0xa43126b621db5b4fd98f959d9e5499f655913d34', to: this.state.newTx.to,
value: '0x0',
value: this.state.newTx.amount.toString(16),
// New: gas will now be specified on this step
gas: this.state.newTx.gas,
gasPrice: this.state.newTx.gasPrice
} }
if (recipient) txParams.to = addHexPrefix(recipient) if (recipient) txParams.to = addHexPrefix(recipient)