feat: extend contract events to include tracking

This commit is contained in:
Richard Ramos 2019-10-03 15:27:20 -04:00
parent e1b02fa3e6
commit 6b1b91274a
2 changed files with 1 additions and 3 deletions

View File

@ -23,7 +23,7 @@ class App extends React.Component {
Product = await ProductContract.getInstance(); Product = await ProductContract.getInstance();
Product = subspace.contract(Product) Product = subspace.contract(Product)
const rating$ = Product.trackEvent("Rating").map("rating").pipe(map(x => parseInt(x))); const rating$ = Product.events.Rating.track().map("rating").pipe(map(x => parseInt(x)));
window.Product = Product; window.Product = Product;
window.web3 = web3; window.web3 = web3;

View File

@ -54,8 +54,6 @@ export default class Subspace {
throw new Error("please pass a contract instance to Subspace.contract()") throw new Error("please pass a contract instance to Subspace.contract()")
} }
console.dir(contractInstance)
let address = (contractInstance.options && contractInstance.options.address) || contractInstance.address || contractInstance.deployedAddress; let address = (contractInstance.options && contractInstance.options.address) || contractInstance.address || contractInstance.deployedAddress;
let abi = (contractInstance.options && contractInstance.options.jsonInterface) || contractInstance.abi || contractInstance.abiDefinition; let abi = (contractInstance.options && contractInstance.options.jsonInterface) || contractInstance.abi || contractInstance.abiDefinition;
let from = (contractInstance.options && contractInstance.options.from) || contractInstance.from || contractInstance.defaultAddress || this.web3.defaultAccount; let from = (contractInstance.options && contractInstance.options.from) || contractInstance.from || contractInstance.defaultAddress || this.web3.defaultAccount;