mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-10 08:11:34 +00:00
293c0b604d
* Add SVG icons for map pins * Add federation basis and new coordinator form (#793) * Add new coordinator entry issue form * Add Federation basis * Fix eslint errors from F2F and fix languages * Redo eslint @typescript-eslint/strict-boolean-expressions * Robot Page working * Contexts Working * Garage Working * CurrentOrder working * Federation model working --------- Co-authored-by: Reckless_Satoshi <reckless.satoshi@protonmail.com> Co-authored-by: Reckless_Satoshi <90936742+Reckless-Satoshi@users.noreply.github.com>
24 lines
704 B
TypeScript
24 lines
704 B
TypeScript
export interface Limit {
|
|
code: string;
|
|
price: number;
|
|
min_amount: number;
|
|
max_amount: number;
|
|
max_bondless_amount: number;
|
|
}
|
|
|
|
export type LimitList = Record<string, Limit>;
|
|
|
|
export const compareUpdateLimit = (baseL: Limit, newL: Limit): Limit => {
|
|
if (baseL == null) {
|
|
return newL;
|
|
} else {
|
|
const price = (baseL.price + newL.price) / 2;
|
|
const max_amount = Math.max(baseL.max_amount, newL.max_amount);
|
|
const min_amount = Math.min(baseL.min_amount, newL.min_amount);
|
|
const max_bondless_amount = Math.max(baseL.max_bondless_amount, newL.max_bondless_amount);
|
|
return { code: newL.code, price, max_amount, min_amount, max_bondless_amount };
|
|
}
|
|
};
|
|
|
|
export default Limit;
|