All files / src/types redstone-metadata.ts

100% Statements 3/3
100% Branches 2/2
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42                                                                        1x 1x 1x      
// move to common packages when it will be merged ...
export type MetadataForRedstonePrice = {
  nodeLabel: string;
 
  /** Aggregated value represented as decimal with '.' decimal point separator */
  value: string;
 
  /** Metadata per source */
  sourceMetadata: Record<string, MetadataPerSource | undefined>;
};
 
export interface MetadataPerSource {
  /** Info about slippage. Defined only for sources which supports calculating slippage. */
  slippage?: SlippageData[];
 
  /** Defined only for sources which supports fetching liquidity. */
  liquidity?: string;
 
  /** Defined for all sources. If source failed value will be = "error"  */
  value?: string;
 
  /** Info about current bid and ask prices. Defined only for sources that allow retrieval of this data */
  bidAskInfo?: BidAskData;
}
 
export interface SlippageData {
  slippageAsPercent: string;
  direction: TradeDirections;
  simulationValueInUsd: string;
}
 
export interface BidAskData {
  bidPrice: number;
  askPrice: number;
}
 
export enum TradeDirection {
  BUY = "buy",
  SELL = "sell",
}
export type TradeDirections = `${TradeDirection}`;