2019-01-25 17:18:44 +00:00
|
|
|
import { Model } from '@nozbe/watermelondb'
|
|
|
|
import { action, field, json } from '@nozbe/watermelondb/decorators'
|
|
|
|
|
|
|
|
|
|
|
|
const sanitizeValues = json => json
|
|
|
|
export default class VaultEvent extends Model {
|
|
|
|
static table = 'vault_events'
|
2019-01-25 19:48:17 +00:00
|
|
|
|
2019-01-25 17:18:44 +00:00
|
|
|
@field('address') address
|
|
|
|
|
|
|
|
@field('event_id') eventId
|
|
|
|
|
|
|
|
@field('event') event
|
|
|
|
|
|
|
|
@field('block_number') blockNumber
|
|
|
|
|
|
|
|
@json('return_values', sanitizeValues) returnValues
|
|
|
|
|
|
|
|
@action async addEvent(data) {
|
|
|
|
return await this.create(lpEvent => {
|
|
|
|
const { event, address, id, blockNumber } = data
|
|
|
|
lpEvent.eventId = id
|
|
|
|
lpEvent.address = address
|
|
|
|
lpEvent.event = event
|
|
|
|
lpEvent.blockNumber = blockNumber
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|