Fixing UI to support both send and signTransaction

This commit is contained in:
Tomasz Drwięga 2016-11-28 11:55:29 +01:00
parent 3e69ff0b88
commit 8686339b0c
4 changed files with 12 additions and 9 deletions

View File

@ -144,7 +144,8 @@ export function outSignerRequest (request) {
break; break;
case 'payload': case 'payload':
request[key].transaction = outTransaction(request[key].transaction); request[key].signTransaction = outTransaction(request[key].signTransaction);
request[key].sendTransaction = outTransaction(request[key].sendTransaction);
break; break;
} }
}); });

View File

@ -72,8 +72,8 @@ export default class SignerMiddleware {
}; };
// Sign request in-browser // Sign request in-browser
if (wallet && payload.transaction) { if (wallet && (payload.sendTransaction || payload.signTransaction)) {
const { transaction } = payload; const transaction = payload.sendTransaction || payload.signTransaction;
(transaction.nonce.isZero() (transaction.nonce.isZero()
? this._api.parity.nextNonce(transaction.from) ? this._api.parity.nextNonce(transaction.from)

View File

@ -25,7 +25,8 @@ export default class RequestFinished extends Component {
result: PropTypes.any.isRequired, result: PropTypes.any.isRequired,
date: PropTypes.instanceOf(Date).isRequired, date: PropTypes.instanceOf(Date).isRequired,
payload: PropTypes.oneOfType([ payload: PropTypes.oneOfType([
PropTypes.shape({ transaction: PropTypes.object.isRequired }), PropTypes.shape({ signTransaction: PropTypes.object.isRequired }),
PropTypes.shape({ sendTransaction: PropTypes.object.isRequired }),
PropTypes.shape({ sign: PropTypes.object.isRequired }) PropTypes.shape({ sign: PropTypes.object.isRequired })
]).isRequired, ]).isRequired,
msg: PropTypes.string, msg: PropTypes.string,
@ -58,8 +59,8 @@ export default class RequestFinished extends Component {
); );
} }
if (payload.transaction) { if (payload.sendTransaction || payload.signTransaction) {
const { transaction } = payload; const transaction = payload.sendTransaction || payload.signTransaction;
return ( return (
<TransactionFinished <TransactionFinished

View File

@ -27,7 +27,8 @@ export default class RequestPending extends Component {
isSending: PropTypes.bool.isRequired, isSending: PropTypes.bool.isRequired,
date: PropTypes.instanceOf(Date).isRequired, date: PropTypes.instanceOf(Date).isRequired,
payload: PropTypes.oneOfType([ payload: PropTypes.oneOfType([
PropTypes.shape({ transaction: PropTypes.object.isRequired }), PropTypes.shape({ signTransaction: PropTypes.object.isRequired }),
PropTypes.shape({ sendTransaction: PropTypes.object.isRequired }),
PropTypes.shape({ sign: PropTypes.object.isRequired }) PropTypes.shape({ sign: PropTypes.object.isRequired })
]).isRequired, ]).isRequired,
className: PropTypes.string, className: PropTypes.string,
@ -64,8 +65,8 @@ export default class RequestPending extends Component {
); );
} }
if (payload.transaction) { if (payload.sendTransaction || payload.signTransaction) {
const { transaction } = payload; const transaction = payload.sendTransaction || payload.signTransaction;
return ( return (
<TransactionPending <TransactionPending