import { Trade } from 'ccxt' ; interface FieldBase { name : string ; } type FieldNodeBase = FieldBase & { prettyName : string ; description : string ; } ; type FieldInput = FieldNodeBase & { type : 'text' | 'password' | 'number' ; } ; type FieldToggle = FieldNodeBase & { type : 'boolean' ; } ; type FieldSelect = FieldNodeBase & { type : 'select' ; options : { key : string ; value : string ; } [ ] ; } ; type FieldNode = FieldInput | FieldToggle | FieldSelect ; type FieldRoot = FieldBase & { type : Field [ ] ; } ; export type Field = FieldRoot | FieldNode ; export interface ExchangeAdapter { fields : Field [ ] ; description : string ; options ? : Record < string , any > ; scan : 'back' | 'forward' ; ratelimit : number ; getTradeCursor : ( trade : Trade ) => number ; mapTradeParams : ( start : number ) => { [ key ] : number ; } ; } export const tradePollIntervalField = { name : 'tradePollInterval' , type : 'number' , prettyName : 'Trade Poll Interval' , description : 'Time delay in milliseconds for new trade requests.' , } ; export const authField = { name : 'auth' , type : [ { name : 'apiKey' , type : 'password' , prettyName : 'API Key' , description : 'The API key generated by the exchange.' , } , { name : 'secret' , type : 'password' , prettyName : 'API Secret' , description : 'The API secret generated by the exchange.' , } , ] , } ; export const baseFields = [ tradePollIntervalField , authField ] ;