robosats/frontend/src/models/Robot.model.ts

47 lines
1.2 KiB
TypeScript
Raw Normal View History

import { systemClient } from '../services/System';
export interface Robot {
nickname: string | null;
token: string | null;
2022-10-31 18:03:34 +00:00
pubKey: string | null;
encPrivKey: 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;
}
2022-10-31 16:20:20 +00:00
const pubKeyCookie = systemClient.getCookie('pub_key');
const privKeyCookie = systemClient.getCookie('enc_priv_key');
export const defaultRobot: Robot = {
nickname: null,
token: systemClient.getCookie('robot_token') ?? null,
2022-10-31 18:03:34 +00:00
pubKey: pubKeyCookie ? pubKeyCookie.split('\\').join('\n') : null,
encPrivKey: privKeyCookie ? privKeyCookie.split('\\').join('\n') : null,
bitsEntropy: null,
shannonEntropy: null,
stealthInvoices: true,
activeOrderId: null,
lastOrderId: null,
earnedRewards: 0,
referralCode: '',
tgEnabled: false,
tgBotName: 'unknown',
tgToken: 'unknown',
2022-10-26 09:47:50 +00:00
loading: false,
avatarLoaded: false,
copiedToken: false,
};
export default Robot;