add project to admin profiles

add address to profiles table
This commit is contained in:
Barry Gitarts 2018-12-05 13:36:44 -05:00
parent 1f23433646
commit 69500cf3e6
3 changed files with 15 additions and 7 deletions

View File

@ -43,7 +43,7 @@ const addDelegateSucessMsg = response => {
return `Delegate created with ID of ${idDelegate}`
}
const addProjectSucessMsg = response => {
const { events: { DelegateAdded: { returnValues: { idProject } } } } = response
const { events: { ProjectAdded: { returnValues: { idProject } } } } = response
return `Project created with ID of ${idProject}`
}
const successMsg = {

View File

@ -15,6 +15,7 @@ const FunderProfilesTable = ({ data }) => (
{ title: 'Profile Id', field: 'idProfile', type: 'numeric' },
{ title: 'Name', field: 'name' },
{ title: 'Url', field: 'url' },
{ title: 'Admin Address', field: 'addr'},
{ title: 'Commit Time', field: 'commitTime', type: 'numeric' },
{ title: 'Type', field: 'type' },
{ title: 'Canceled', field: 'canceled' }

View File

@ -3,6 +3,7 @@ import web3 from 'Embark/web3'
const GIVER_ADDED = 'GiverAdded'
const DELEGATE_ADDED = 'DelegateAdded'
const PROJECT_ADDED = 'ProjectAdded'
const lookups = {
[GIVER_ADDED]: {
id: 'idGiver',
@ -11,6 +12,10 @@ const lookups = {
[DELEGATE_ADDED]: {
id: 'idDelegate',
type: 'Delegate'
},
[PROJECT_ADDED]: {
id: 'idProject',
type: 'Project'
}
}
@ -19,12 +24,13 @@ export const formatFundProfileEvent = async event => {
const lookup = lookups[event.event]
const { returnValues: { url } } = event
const idProfile = event.returnValues[lookup.id]
const { commitTime, name, canceled } = await getPledgeAdmin(idProfile).call()
const { addr, commitTime, name, canceled } = await getPledgeAdmin(idProfile).call()
return {
idProfile,
url,
commitTime,
name,
addr,
canceled,
type: lookups[event.event].type
}
@ -41,10 +47,11 @@ const getPastEvents = async event => {
)
return formattedEvents
}
export const getFunderProfiles = async () => await getPastEvents('GiverAdded')
export const getDelegateProfiles = async () => await getPastEvents('DelegateAdded')
export const getFunderProfiles = async () => await getPastEvents(GIVER_ADDED)
export const getDelegateProfiles = async () => await getPastEvents(DELEGATE_ADDED)
export const getProjectProfiles = async () => await getPastEvents(PROJECT_ADDED)
export const getProfileEvents = async () => {
const funderProfiles = await getFunderProfiles()
const delegateProfiles = await getDelegateProfiles()
return [ ...funderProfiles, ...delegateProfiles]
const [ funderProfiles, delegateProfiles, projectProfiles]
= await Promise.all([getFunderProfiles(), getDelegateProfiles(), getProjectProfiles()])
return [ ...funderProfiles, ...delegateProfiles, ...projectProfiles]
}