UNPKG

xud

Version:
89 lines (88 loc) 3.97 kB
import { BelongsToGetAssociationMixin, Model } from 'sequelize'; import { ReputationEvent, SwapClientType } from '../constants/enums'; import { Currency, Order, Pair } from '../orderbook/types'; import { Address, NodeConnectionInfo } from '../p2p/types'; import { SwapDeal } from '../swaps/types'; export declare type CurrencyCreationAttributes = Currency; export declare type CurrencyAttributes = CurrencyCreationAttributes; export interface CurrencyInstance extends Model<CurrencyAttributes, CurrencyCreationAttributes>, CurrencyAttributes { } export declare type SwapDealCreationAttributes = Pick<SwapDeal, Exclude<keyof SwapDeal, 'takerMaxTimeLock' | 'price' | 'pairId' | 'isBuy' | 'takerUnits' | 'makerUnits'>>; export declare type SwapDealAttributes = SwapDealCreationAttributes & { /** The internal db node id of the counterparty peer for this swap deal. */ nodeId: number; }; export interface SwapDealInstance extends Model<SwapDealAttributes, SwapDealCreationAttributes>, SwapDealAttributes { getNode: BelongsToGetAssociationMixin<NodeInstance>; getOrder: BelongsToGetAssociationMixin<OrderInstance>; Node?: NodeInstance; Order?: OrderInstance; } export declare type OrderCreationAttributes = Pick<Order, Exclude<keyof Order, 'quantity' | 'hold' | 'price'>> & { /** The internal db node id of the peer that created this order. */ nodeId?: number; localId?: string; /** The price for the order expressed in units of the quote currency. */ price?: number; }; export declare type OrderAttributes = OrderCreationAttributes & {}; export interface OrderInstance extends Model<OrderAttributes, OrderCreationAttributes>, OrderAttributes { } export declare type TradeCreationAttributes = { /** The order id of the maker order involved in this trade. */ makerOrderId: string; /** The order id of the taker order involved in this trade, if applicable. */ takerOrderId?: string; /** The rHash of the swap that filled this trade, if applicable. */ rHash?: string; /** The quantity transacted in this trade. */ quantity: number; }; export declare type TradeAttributes = TradeCreationAttributes & {}; export interface TradeInstance extends Model<TradeAttributes, TradeCreationAttributes>, TradeAttributes { getMakerOrder: BelongsToGetAssociationMixin<OrderInstance>; getTakerOrder: BelongsToGetAssociationMixin<OrderInstance>; getSwapDeal: BelongsToGetAssociationMixin<SwapDealInstance>; SwapDeal?: SwapDealInstance; makerOrder?: OrderInstance; takerOrder?: OrderInstance; createdAt: Date; } export declare type NodeCreationAttributes = NodeConnectionInfo; export declare type NodeAttributes = NodeCreationAttributes & { id: number; banned: boolean; addressesText: string; lastAddressText: string; lastAddress: Address; }; export interface NodeInstance extends Model<NodeAttributes, NodeCreationAttributes>, NodeAttributes { reputationScore: number; } export declare type PairCreationAttributes = Pair; export declare type PairAttributes = PairCreationAttributes & { id: string; }; export interface PairInstance extends Model<PairAttributes, PairCreationAttributes>, PairAttributes { } export declare type ReputationEventCreationAttributes = { event: ReputationEvent; nodeId: number; }; export declare type ReputationEventAttributes = ReputationEventCreationAttributes & { createdAt: number; id: number; }; export interface ReputationEventInstance extends Model<ReputationEventAttributes, ReputationEventCreationAttributes>, ReputationEventAttributes { } export declare type PasswordCreationAttributes = { encryptedPassword: string; currency?: string; swapClient: SwapClientType; }; export declare type PasswordAttributes = PasswordCreationAttributes & { createdAt: number; id: number; }; export interface PasswordInstance extends Model<PasswordAttributes, PasswordCreationAttributes>, PasswordAttributes { }