BnMonitor.ts 725 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { AllowNull, Column, DataType, Model, Table } from 'sequelize-typescript'
  2. export interface BnMonitorData {
  3. chainId: bigint
  4. syncBlockNumber: number
  5. }
  6. @Table({
  7. modelName: 'BnMonitor',
  8. indexes: [
  9. {
  10. fields: ['chainId'],
  11. unique: true,
  12. },
  13. ],
  14. })
  15. export default class BnMonitor extends Model {
  16. @AllowNull(false)
  17. @Column(DataType.INTEGER.UNSIGNED)
  18. get chainId(): bigint {
  19. return this.getDataValue('chainId')
  20. }
  21. @AllowNull(false)
  22. @Column(DataType.INTEGER.UNSIGNED)
  23. get syncBlockNumber(): number {
  24. return this.getDataValue('syncBlockNumber')
  25. }
  26. getData(): BnMonitorData {
  27. return {
  28. chainId: this.chainId,
  29. syncBlockNumber: this.syncBlockNumber,
  30. }
  31. }
  32. }