From 069e8d8831708d0394e4081ab528fe44f2e2feb5 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Thu, 24 Jan 2019 09:40:57 -0500 Subject: [PATCH] use transfers query in TransfersGraph --- app/components/TransfersGraph.jsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/components/TransfersGraph.jsx b/app/components/TransfersGraph.jsx index 0d56230..53f581d 100644 --- a/app/components/TransfersGraph.jsx +++ b/app/components/TransfersGraph.jsx @@ -1,7 +1,11 @@ import Cytoscape from 'cytoscape' import dagre from 'cytoscape-dagre' import React, { Fragment } from 'react' +import PropTypes from 'prop-types' import CytoscapeComponent from 'react-cytoscapejs' +import withObservables from '@nozbe/with-observables' +import { Q } from '@nozbe/watermelondb' +import { withDatabase } from '@nozbe/watermelondb/DatabaseProvider' import { uniq, isNil } from 'ramda' import { toEther } from '../utils/conversions' import { getTokenLabel } from '../utils/currencies' @@ -71,10 +75,10 @@ const createElements = (transfers, vaultEvents) => { ] } -const TransfersGraph = () => { +const TransfersGraph = ({ transfers }) => { return ( - {({ transfers, vaultEvents }) => + {({ vaultEvents }) => { ) } -export default TransfersGraph +TransfersGraph.propTypes = { + transfers: PropTypes.object.isRequired +} + +export default withDatabase(withObservables([], ({ database }) => ({ + transfers: database.collections.get('lp_events').query( + Q.where('event', 'Transfer') + ).observe() +}))(TransfersGraph))