+
@@ -424,10 +425,7 @@ class UserGenPage extends Component {
-
+
diff --git a/frontend/src/models/Order.model.ts b/frontend/src/models/Book.model.ts
similarity index 89%
rename from frontend/src/models/Order.model.ts
rename to frontend/src/models/Book.model.ts
index 67313f04..5c05c30d 100644
--- a/frontend/src/models/Order.model.ts
+++ b/frontend/src/models/Book.model.ts
@@ -23,4 +23,9 @@ export interface Order {
maker_status: 'Active' | 'Seen recently' | 'Inactive';
}
+export interface Book {
+ orders: Order[];
+ loading: boolean;
+}
+
export default Order;
diff --git a/frontend/src/models/Favorites.model.ts b/frontend/src/models/Favorites.model.ts
new file mode 100644
index 00000000..88204101
--- /dev/null
+++ b/frontend/src/models/Favorites.model.ts
@@ -0,0 +1,6 @@
+export interface Favorites {
+ type: number | null;
+ currency: number;
+}
+
+export default Favorites;
diff --git a/frontend/src/models/Info.model.ts b/frontend/src/models/Info.model.ts
new file mode 100644
index 00000000..0b5d145e
--- /dev/null
+++ b/frontend/src/models/Info.model.ts
@@ -0,0 +1,49 @@
+export interface Info {
+ num_public_buy_orders: number;
+ num_public_sell_orders: number;
+ book_liquidity: number;
+ active_robots_today: number;
+ last_day_nonkyc_btc_premium: number;
+ last_day_volume: number;
+ lifetime_volume: number;
+ lnd_version: string;
+ robosats_running_commit_hash: string;
+ alternative_site: string;
+ alternative_name: string;
+ node_alias: string;
+ node_id: string;
+ version: { major: number | null; minor: number | null; patch: number | null };
+ maker_fee: number;
+ taker_fee: number;
+ bond_size: number;
+ current_swap_fee_rate: number;
+ coordinatorVersion: string;
+ clientVersion: string;
+ openUpdateClient: boolean;
+}
+
+export const defaultInfo: Info = {
+ num_public_buy_orders: 0,
+ num_public_sell_orders: 0,
+ book_liquidity: 0,
+ active_robots_today: 0,
+ last_day_nonkyc_btc_premium: 0,
+ last_day_volume: 0,
+ lifetime_volume: 0,
+ lnd_version: 'v0.0.0-beta',
+ robosats_running_commit_hash: '000000000000000',
+ alternative_site: 'RoboSats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion',
+ alternative_name: 'RoboSats Mainnet',
+ node_alias: 'š¤RoboSatsā”(RoboDevs)',
+ node_id: '033b58d7681fe5dd2fb21fd741996cda5449616f77317dd1156b80128d6a71b807',
+ version: { major: null, minor: null, patch: null },
+ maker_fee: 0,
+ taker_fee: 0,
+ bond_size: 0,
+ current_swap_fee_rate: 0,
+ coordinatorVersion: 'v?.?.?',
+ clientVersion: 'v?.?.?',
+ openUpdateClient: false,
+};
+
+export default Info;
diff --git a/frontend/src/models/Maker.model.ts b/frontend/src/models/Maker.model.ts
index caf880f0..7bf23291 100644
--- a/frontend/src/models/Maker.model.ts
+++ b/frontend/src/models/Maker.model.ts
@@ -1,4 +1,5 @@
export interface Maker {
+ advancedOptions: boolean;
isExplicit: boolean;
amount: string;
paymentMethods: string[];
@@ -18,6 +19,7 @@ export interface Maker {
}
export const defaultMaker: Maker = {
+ advancedOptions: false,
isExplicit: false,
amount: '',
paymentMethods: [],
diff --git a/frontend/src/models/Robot.model.ts b/frontend/src/models/Robot.model.ts
new file mode 100644
index 00000000..1789809d
--- /dev/null
+++ b/frontend/src/models/Robot.model.ts
@@ -0,0 +1,49 @@
+import { systemClient } from '../services/System';
+
+export interface Robot {
+ nickname: string | null;
+ token: string | null;
+ pub_key: string | null;
+ enc_priv_key: string | null;
+ bitsEntropy: number | null;
+ shannonEntropy: number | null;
+ stealthInvoices: boolean;
+ activeOrderId: number | null;
+ lastOrderId: number | null;
+ earnedRewards: number;
+ referralCode: string;
+ tgEnabled: boolean;
+ tgBotName: string;
+ tgToken: string;
+ loading: boolean;
+ avatarLoaded: boolean;
+ copiedToken: boolean;
+}
+
+export const defaultRobot: Robot = {
+ nickname: null,
+ token: systemClient.getCookie('robot_token') ?? null,
+ pub_key:
+ systemClient.getCookie('pub_key') === undefined
+ ? null
+ : systemClient.getCookie('pub_key').split('\\').join('\n'),
+ enc_priv_key:
+ systemClient.getCookie('enc_priv_key') === undefined
+ ? null
+ : systemClient.getCookie('enc_priv_key').split('\\').join('\n'),
+ bitsEntropy: null,
+ shannonEntropy: null,
+ stealthInvoices: true,
+ activeOrderId: null,
+ lastOrderId: null,
+ earnedRewards: 0,
+ referralCode: '',
+ tgEnabled: false,
+ tgBotName: 'unknown',
+ tgToken: 'unknown',
+ loading: true,
+ avatarLoaded: false,
+ copiedToken: false,
+};
+
+export default Robot;
diff --git a/frontend/src/models/Settings.model.ts b/frontend/src/models/Settings.model.ts
new file mode 100644
index 00000000..83cb48ae
--- /dev/null
+++ b/frontend/src/models/Settings.model.ts
@@ -0,0 +1,5 @@
+export interface Settings {}
+
+export const defaultSettings: Settings = {};
+
+export default Settings;
diff --git a/frontend/src/models/index.ts b/frontend/src/models/index.ts
index efa8b176..02155d08 100644
--- a/frontend/src/models/index.ts
+++ b/frontend/src/models/index.ts
@@ -1,5 +1,14 @@
export type { LimitList } from './Limit.model';
export type { Limit } from './Limit.model';
export type { Maker } from './Maker.model';
+export type { Order } from './Book.model';
+export type { Book } from './Book.model';
+export type { Robot } from './Robot.model';
+export type { Info } from './Info.model';
+export type { Settings } from './Settings.model';
+export type { Favorites } from './Favorites.model';
+
export { defaultMaker } from './Maker.model';
-export type { Order } from './Order.model';
+export { defaultRobot } from './Robot.model';
+export { defaultSettings } from './Settings.model';
+export { defaultInfo } from './Info.model';
diff --git a/frontend/src/utils/checkVer.ts b/frontend/src/utils/checkVer.ts
index 771157c8..b5f763eb 100644
--- a/frontend/src/utils/checkVer.ts
+++ b/frontend/src/utils/checkVer.ts
@@ -11,8 +11,8 @@ export const checkVer: (
return { updateAvailable: null };
}
const semver = packageJson.version.split('.');
- const updateAvailable = major > Number(semver[0]) || minor > Number(semver[1]);
- const patchAvailable = !updateAvailable && patch > Number(semver[2]);
+ const updateAvailable: boolean = major > Number(semver[0]) || minor > Number(semver[1]);
+ const patchAvailable: boolean = !updateAvailable && patch > Number(semver[2]);
return {
updateAvailable,
diff --git a/frontend/src/utils/filterOrders.ts b/frontend/src/utils/filterOrders.ts
index 9d00db2f..ba31ef1d 100644
--- a/frontend/src/utils/filterOrders.ts
+++ b/frontend/src/utils/filterOrders.ts
@@ -1,9 +1,4 @@
-import Order from '../models/Order.model';
-
-interface BaseFilter {
- currency: number;
- type: number | null;
-}
+import { Order, Favorites } from '../models';
interface AmountFilter {
amount: string;
@@ -14,12 +9,12 @@ interface AmountFilter {
interface FilterOrders {
orders: Order[];
- baseFilter: BaseFilter;
+ baseFilter: Favorites;
amountFilter?: AmountFilter | null;
paymentMethods?: string[];
}
-const filterByPayment = function (order: Order, paymentMethods: string[]) {
+const filterByPayment = function (order: Order, paymentMethods: any[]) {
if (paymentMethods.length === 0) {
return true;
} else {
@@ -32,17 +27,19 @@ const filterByPayment = function (order: Order, paymentMethods: string[]) {
};
const filterByAmount = function (order: Order, filter: AmountFilter) {
- const filterMaxAmount = filter.amount != '' ? filter.amount : filter.maxAmount;
- const filterMinAmount = filter.amount != '' ? filter.amount : filter.minAmount;
- const orderMinAmount =
- order.amount === '' || order.amount === null ? order.min_amount : order.amount;
- const orderMaxAmount =
- order.amount === '' || order.amount === null ? order.max_amount : order.amount;
+ const filterMaxAmount =
+ Number(filter.amount != '' ? filter.amount : filter.maxAmount) * (1 + filter.threshold);
+ const filterMinAmount =
+ Number(filter.amount != '' ? filter.amount : filter.minAmount) * (1 - filter.threshold);
- return (
- orderMaxAmount < filterMaxAmount * (1 + filter.threshold) &&
- orderMinAmount > filterMinAmount * (1 - filter.threshold)
+ const orderMinAmount = Number(
+ order.amount === '' || order.amount === null ? order.min_amount : order.amount,
);
+ const orderMaxAmount = Number(
+ order.amount === '' || order.amount === null ? order.max_amount : order.amount,
+ );
+
+ return Math.max(filterMinAmount, orderMinAmount) <= Math.min(filterMaxAmount, orderMaxAmount);
};
const filterOrders = function ({
@@ -60,7 +57,6 @@ const filterOrders = function ({
return typeChecks && currencyChecks && paymentMethodChecks && amountChecks;
});
-
return filteredOrders;
};
diff --git a/frontend/static/css/index.css b/frontend/static/css/index.css
index 737ed574..21ba3d65 100644
--- a/frontend/static/css/index.css
+++ b/frontend/static/css/index.css
@@ -79,11 +79,6 @@ input[type='number'] {
-moz-appearance: textfield;
}
-.bottomBar {
- position: fixed;
- bottom: 0;
-}
-
.amboss {
fill: url(#SVGID_1_);
}