-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathReader.ts
38 lines (33 loc) · 921 Bytes
/
Reader.ts
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
import {Trade, Offer} from '../types/XrplObjects'
import type Client from 'rippled-ws-client'
export enum RatesInCurrency {
to = 'to',
from = 'from'
}
export enum Errors {
REQUESTED_LIQUIDITY_NOT_AVAILABLE = 'REQUESTED_LIQUIDITY_NOT_AVAILABLE',
REVERSE_LIQUIDITY_NOT_AVAILABLE = 'REVERSE_LIQUIDITY_NOT_AVAILABLE',
MAX_SPREAD_EXCEEDED = 'MAX_SPREAD_EXCEEDED',
MAX_SLIPPAGE_EXCEEDED = 'MAX_SLIPPAGE_EXCEEDED',
MAX_REVERSE_SLIPPAGE_EXCEEDED = 'MAX_REVERSE_SLIPPAGE_EXCEEDED'
}
export interface Options {
verboseBookData?: boolean
rates?: RatesInCurrency
maxSpreadPercentage?: number
maxSlippagePercentage?: number
maxSlippagePercentageReverse?: number
maxBookLines?: number
includeBookData?: boolean
}
export interface Params {
trade: Trade,
options: Options
method: Client['send']
}
export interface Result {
rate: number
safe: boolean
errors: Array<Errors>
books?: Offer[]
}