use VaultEvents model for TransfersGraph

This commit is contained in:
Barry Gitarts 2019-01-25 14:48:17 -05:00
parent 8b3e648448
commit 98c1f80942
3 changed files with 15 additions and 18 deletions

View File

@ -12,7 +12,7 @@ const Dashboard = ({ pledges }) => (
</div> </div>
) )
Dashboard.PropTypes = { Dashboard.propTypes = {
pledges: PropTypes.array.isRequired pledges: PropTypes.array.isRequired
} }

View File

@ -9,7 +9,6 @@ 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'
import { FundingContext } from '../context'
import { getAuthorizations } from '../selectors/vault' import { getAuthorizations } from '../selectors/vault'
@ -75,10 +74,8 @@ const createElements = (transfers, vaultEvents) => {
] ]
} }
const TransfersGraph = ({ transfers }) => { const TransfersGraph = ({ transfers, vaultEvents }) => {
return ( return (
<FundingContext.Consumer>
{({ vaultEvents }) =>
<Fragment> <Fragment>
<CytoscapeComponent <CytoscapeComponent
elements={createElements(transfers, vaultEvents)} elements={createElements(transfers, vaultEvents)}
@ -87,17 +84,17 @@ const TransfersGraph = ({ transfers }) => {
layout={layout} layout={layout}
/> />
</Fragment> </Fragment>
}
</FundingContext.Consumer>
) )
} }
TransfersGraph.propTypes = { TransfersGraph.propTypes = {
transfers: PropTypes.array.isRequired transfers: PropTypes.array.isRequired,
vaultEvents: PropTypes.array.isRequired
} }
export default withDatabase(withObservables([], ({ database }) => ({ export default withDatabase(withObservables([], ({ database }) => ({
transfers: database.collections.get('lp_events').query( transfers: database.collections.get('lp_events').query(
Q.where('event', 'Transfer') Q.where('event', 'Transfer')
).observe() ).observe(),
vaultEvents : database.collections.get('vault_events').query().observe()
}))(TransfersGraph)) }))(TransfersGraph))

View File

@ -5,6 +5,7 @@ import { action, field, json } from '@nozbe/watermelondb/decorators'
const sanitizeValues = json => json const sanitizeValues = json => json
export default class VaultEvent extends Model { export default class VaultEvent extends Model {
static table = 'vault_events' static table = 'vault_events'
@field('address') address @field('address') address
@field('event_id') eventId @field('event_id') eventId
@ -25,4 +26,3 @@ export default class VaultEvent extends Model {
}) })
} }
} }