Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fixed an error for 'GET_DECODED_TRANSACTION_INPUT' when the 'transaction.input' was '0x' #4807

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions src/integrations/ethereum/common/redux/transactions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export const showTransaction = function(hash) {
web3Instance,
);
let events = [];
let decodedData = null;

let decodedData;
let contract;
let projectIndex;
const state = getState();
Expand Down Expand Up @@ -192,7 +192,7 @@ export const showTransaction = function(hash) {
});
}
}

if (contract) {
for (let j = 0; j < events.length; j++) {
events[j].decodedLog = await new Promise(resolve => {
Expand All @@ -209,21 +209,23 @@ export const showTransaction = function(hash) {
});
}

decodedData = await new Promise(resolve => {
// TODO: there's a better way to do this to not have to send `contract` and `contracts` every time
ipcRenderer.once(
GET_DECODED_TRANSACTION_INPUT,
(event, decodedData) => {
resolve(decodedData);
},
);
ipcRenderer.send(
GET_DECODED_TRANSACTION_INPUT,
contract,
state.workspaces.current.projects[projectIndex].contracts,
transaction,
);
});
if (transaction.input !== '0x') {
decodedData = await new Promise(resolve => {
//TODO: there's a better way to do this to not have to send `contract` and `contracts` every time
ipcRenderer.once(
GET_DECODED_TRANSACTION_INPUT,
(event, decodedData) => {
resolve(decodedData);
},
);
ipcRenderer.send(
GET_DECODED_TRANSACTION_INPUT,
contract,
state.workspaces.current.projects[projectIndex].contracts,
transaction,
);
});
}
}

dispatch({
Expand Down