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;
case 'payload':
request[key].transaction = outTransaction(request[key].transaction);
request[key].signTransaction = outTransaction(request[key].signTransaction);
request[key].sendTransaction = outTransaction(request[key].sendTransaction);
break;
}
});

View File

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

View File

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

View File

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