import { BelongsTo, Column, DataType, ForeignKey, HasMany, Index, Model, Table, } from 'sequelize-typescript'; import { Address } from './address'; import { Coin } from './coin'; import { Redelegation } from './redelegation'; import { Undelegation } from './undelegation'; import { Validator } from './validator'; @Table({ timestamps: true }) export class Stake extends Model { @Index({ name: 'stake-coin-index', using: 'HASH', }) @ForeignKey(() => Coin) @Column(DataType.INTEGER) coinId: number; @Column(DataType.DECIMAL) amount: string; @Column(DataType.DECIMAL) unbondAmount: string; @Index({ name: 'stake-address-index', using: 'HASH', }) @ForeignKey(() => Address) @Column(DataType.INTEGER) addressId: number; @Index({ name: 'stake-validator-index', using: 'HASH', }) @ForeignKey(() => Validator) @Column(DataType.INTEGER) validatorId: number; @BelongsTo(() => Validator) validator: Validator; @BelongsTo(() => Coin) coin: Coin; @BelongsTo(() => Address) address: Address; @HasMany(() => Redelegation) redelegations: Redelegation[]; @HasMany(() => Undelegation) undelegations: Undelegation[]; }