Fix issue with sending from companion app

This commit is contained in:
Aditya Kulkarni 2020-03-23 13:42:09 -07:00
parent 69611fa9a3
commit 09a02d5b25
1 changed files with 6 additions and 3 deletions

View File

@ -168,7 +168,7 @@ export default class CompanionAppListener {
store.delete('companion/localnonce');
}
processIncoming(data: string, keyHex: string, ws: Websocket) {
async processIncoming(data: string, keyHex: string, ws: Websocket) {
const dataJson = JSON.parse(data);
// If the wormhole sends some messages, we ignore them
@ -230,7 +230,7 @@ export default class CompanionAppListener {
const response = this.doGetTransactions();
ws.send(this.encryptOutgoing(response, keyHex));
} else if (cmd.command === 'sendTx') {
const response = this.doSendTransaction(cmd, ws);
const response = await this.doSendTransaction(cmd, ws);
ws.send(this.encryptOutgoing(response, keyHex));
}
}
@ -437,7 +437,7 @@ export default class CompanionAppListener {
const appState = this.fnGetState();
// eslint-disable-next-line radix
const sendingAmount = parseInt((parseFloat(inpTx.amount) * 10 ** 8).toFixed(0));
let sendingAmount = parseFloat(inpTx.amount);
const buildError = (reason: string): string => {
const resp = {
errorCode: -1,
@ -456,6 +456,9 @@ export default class CompanionAppListener {
const memo = !inpTx.memo || inpTx.memo.trim() === '' ? null : inpTx.memo;
// The lightclient expects zats (and not ZEC)
sendingAmount = parseInt(sendingAmount * 10 ** 8);
// Build a sendJSON object
const sendJSON = [];
if (memo) {