Merge pull request #33 from status-im/bug_fix/empty-contract

Fix empty contract appearing in the contract list
This commit is contained in:
Iuri Matias 2018-08-10 13:25:04 -04:00 committed by GitHub
commit 386deadd10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 9 deletions

View File

@ -24,7 +24,7 @@ const Contracts = ({contracts}) => (
bodyItems={
contracts.map((contract) => {
return ([
{content: <Link to={`contracts/${contract.name}`}>{contract.name}</Link>},
{content: <Link to={`contracts/${contract.className}`}>{contract.className}</Link>},
{content: contract.address},
{content: contract.deploy.toString()}
]);

View File

@ -26,7 +26,7 @@ function mapStateToProps(state) {
}
ContractsContainer.propTypes = {
contracts: PropTypes.object,
contracts: PropTypes.array,
fetchContracts: PropTypes.func
};

View File

@ -37,7 +37,7 @@ const filtrer = {
return index === self.findIndex((t) => t.name === process.name);
},
contracts: function(contract, index, self) {
return index === self.findIndex((t) => t.name === contract.name);
return index === self.findIndex((t) => t.className === contract.className);
},
accounts: function(account, index, self) {
return index === self.findIndex((t) => t.address === account.address);

View File

@ -51,7 +51,7 @@ export function getContracts(state) {
}
export function getContract(state, contractName) {
return state.entities.contracts.find((contract => contract.name === contractName));
return state.entities.contracts.find((contract => contract.className === contractName));
}
export function getContractProfile(state, contractName) {

View File

@ -55,10 +55,6 @@ class ContractsManager {
self.events.emit('contractsState', self.contractsState());
});
self.events.setCommandHandler("contracts:contract", (contractName, cb) => {
cb(self.getContract(contractName));
});
self.events.setCommandHandler("contracts:all", (contractName, cb) => {
let contracts = self.listContracts();
let results = [];
@ -68,7 +64,7 @@ class ContractsManager {
results.push({
index: i,
name: contract.className,
className: contract.className,
deploy: contract.deploy,
error: contract.error,
address: contract.deployedAddress