mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-02-20 15:18:24 +00:00
add getLastBlockStore
This commit is contained in:
parent
a0a71ca97d
commit
4ec9180006
@ -34,6 +34,13 @@ export const getLpEventById = async id => {
|
||||
const event = await lpCollection.query(
|
||||
Q.where('event_id', id)
|
||||
).fetch()
|
||||
console.log({event})
|
||||
return event
|
||||
}
|
||||
|
||||
export const getLastBlockStored = async () => {
|
||||
const col = await lpCollection.query().fetch()
|
||||
const sorted = col.sort(
|
||||
(a,b) => b.blockNumber - a.blockNumber
|
||||
)
|
||||
return sorted[0].blockNumber
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ const profilesCollection = database.collections.get('profiles')
|
||||
export const addProfile = async data => {
|
||||
return await database.action(async () => {
|
||||
const res = await profilesCollection.create(profile => {
|
||||
const { addr, canceled, commitTime, type, name, url, idProfile } = data
|
||||
const { id, addr, canceled, commitTime, type, name, url, idProfile } = data
|
||||
profile.eventId = id
|
||||
profile.addr = addr
|
||||
profile.canceled = canceled
|
||||
profile.commitTime = Number(commitTime)
|
||||
@ -21,7 +22,8 @@ export const addProfile = async data => {
|
||||
export const batchAddProfiles = async profiles => {
|
||||
const batch = profiles.map(data => {
|
||||
return profilesCollection.prepareCreate(profile => {
|
||||
const { addr, canceled, commitTime, type, name, url, idProfile } = data
|
||||
const { id, addr, canceled, commitTime, type, name, url, idProfile } = data
|
||||
profile.eventId = id
|
||||
profile.addr = addr
|
||||
profile.canceled = canceled
|
||||
profile.commitTime = Number(commitTime)
|
||||
|
Loading…
x
Reference in New Issue
Block a user