use transfers query in TransfersGraph
This commit is contained in:
parent
912b6f539e
commit
069e8d8831
|
@ -1,7 +1,11 @@
|
||||||
import Cytoscape from 'cytoscape'
|
import Cytoscape from 'cytoscape'
|
||||||
import dagre from 'cytoscape-dagre'
|
import dagre from 'cytoscape-dagre'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
import CytoscapeComponent from 'react-cytoscapejs'
|
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 { uniq, isNil } from 'ramda'
|
||||||
import { toEther } from '../utils/conversions'
|
import { toEther } from '../utils/conversions'
|
||||||
import { getTokenLabel } from '../utils/currencies'
|
import { getTokenLabel } from '../utils/currencies'
|
||||||
|
@ -71,10 +75,10 @@ const createElements = (transfers, vaultEvents) => {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const TransfersGraph = () => {
|
const TransfersGraph = ({ transfers }) => {
|
||||||
return (
|
return (
|
||||||
<FundingContext.Consumer>
|
<FundingContext.Consumer>
|
||||||
{({ transfers, vaultEvents }) =>
|
{({ vaultEvents }) =>
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<CytoscapeComponent
|
<CytoscapeComponent
|
||||||
elements={createElements(transfers, vaultEvents)}
|
elements={createElements(transfers, vaultEvents)}
|
||||||
|
@ -88,4 +92,12 @@ const TransfersGraph = () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
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))
|
||||||
|
|
Loading…
Reference in New Issue