[{"/home/giulio/dev/gkaching/websrc/src/components/App.tsx":"1","/home/giulio/dev/gkaching/websrc/src/components/Cards.tsx":"2","/home/giulio/dev/gkaching/websrc/src/components/Overlays.tsx":"3","/home/giulio/dev/gkaching/websrc/src/index.tsx":"4"},{"size":4418,"mtime":1609342346604,"results":"5","hashOfConfig":"6"},{"size":5688,"mtime":1609342346604,"results":"7","hashOfConfig":"6"},{"size":5235,"mtime":1609342346604,"results":"8","hashOfConfig":"6"},{"size":371,"mtime":1609358781834,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"12"},"1ev2e5",{"filePath":"13","messages":"14","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"15"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"18","messages":"19","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/home/giulio/dev/gkaching/websrc/src/components/App.tsx",["20"],"import React, { Component } from \"react\";\nimport {\n    Balance,\n    CurrencyPair,\n    EventName,\n    EventProp,\n    FirstConnectMessage,\n    NewEventMessage,\n    NewTickMessage,\n    PositionProp\n} from \"../types\";\nimport { socket } from \"../index\";\nimport { symbolToPair } from \"../utils\";\nimport { Helmet } from \"react-helmet\";\nimport { Navbar, Sidebar } from \"./Navbars\";\nimport { Statusbar } from \"./Statusbar\";\nimport { PositionsTable } from \"./Tables\";\nimport RPlot from \"./RPlot\";\n\ntype AppState = {\n    current_price: number,\n    current_tick: number,\n    last_update: Date,\n    positions: Array<PositionProp>,\n    events: Array<EventProp>,\n    active_pair: CurrencyPair,\n    available_pairs: Array<CurrencyPair>,\n    balances: Array<Balance>\n}\n\nclass App extends Component<{}, AppState> {\n    event_id = 0;\n\n    state = {\n        current_price: 0,\n        current_tick: 0,\n        last_update: new Date(),\n        positions: [],\n        events: [],\n        balances: [],\n        active_pair: symbolToPair(\"tBTCUSD\"),\n        available_pairs: []\n    }\n\n    constructor(props: {}) {\n        super(props)\n    }\n\n    componentDidMount() {\n        socket.on(EventName.FirstConnect, (data: FirstConnectMessage) => {\n            this.setState({\n                current_price: data.prices[data.prices.length - 1],\n                current_tick: data.ticks[data.ticks.length - 1],\n                last_update: new Date(),\n                positions: data.positions,\n                balances: data.balances\n            })\n        })\n\n        socket.on(EventName.NewTick, (data: NewTickMessage) => {\n            this.setState({\n                current_price: data.price,\n                current_tick: data.tick,\n                last_update: new Date(),\n                positions: data.positions,\n                balances: data.balances\n            })\n        })\n\n        socket.on(EventName.NewEvent, (data: NewEventMessage) => {\n            // ignore new tick\n            if (!data.kind.toLowerCase().includes(\"new_tick\")) {\n                const new_event: EventProp = {\n                    id: this.event_id,\n                    name: data.kind,\n                    tick: data.tick\n                }\n\n                this.event_id += 1\n\n                this.setState((state) => ({\n                    events: [...state.events, new_event]\n                }))\n            }\n        })\n    }\n\n    render() {\n        return (\n            <>\n                <Helmet>\n                    <title> Rustico\n                        - {String(this.state.current_price.toLocaleString())} {String(this.state.active_pair.base) + \"/\" + String(this.state.active_pair.quote)} </title>\n                </Helmet>\n                <div className=\"bg-gray-800\">\n                    <div className=\"h-screen max-w-screen flex mx-auto\">\n                        <Navbar />\n\n                        <main\n                            className=\"my-1 py-2 px-10 flex-1 bg-gray-200 dark:bg-black rounded-l-lg*\n                    transition duration-500 ease-in-out overflow-y-auto flex flex-col\">\n                            <div className=\"flex justify-center text-2xl my-2\">\n                                <Statusbar balances={this.state.balances} positions={this.state.positions}\n                                    price={this.state.current_price}\n                                    tick={this.state.current_tick} />\n                            </div>\n\n                            <div className=\"flex flex-col flex-grow my-8 shadow-md hover:shadow-lg\">\n                                <div\n                                    className=\"py-2 flex-grow bg-white min-width dark:bg-gray-600 rounded-lg overflow-hidden\">\n                                    <RPlot />\n                                </div>\n                            </div>\n\n                            {this.state.positions.length > 0 ?\n                                <PositionsTable positions={this.state.positions} /> : null}\n\n                            <footer className=\"flex rounded-lg justify-center bg-gray-600 mt-4 border-t text-gray-300\">\n                                <span className=\"my-1 mx-1\">Made with ❤️ by the Peperone in a scantinato</span>\n                            </footer>\n                        </main>\n\n                        <Sidebar />\n                    </div>\n                </div>\n            </>\n        )\n    }\n}\n\nexport default App;","/home/giulio/dev/gkaching/websrc/src/components/Cards.tsx",["21","22","23","24"],"import React, { Component } from 'react';\nimport { Balance, EventName, FirstConnectMessage, NewTickMessage } from \"../types\";\nimport { socket } from \"../index\";\n\nexport type CoinBalanceProps = {\n    name: string,\n    amount: number,\n    percentage: number,\n    quote_equivalent: number,\n    quote_symbol: string,\n}\n\nclass CoinBalance extends Component<CoinBalanceProps> {\n    constructor(props: CoinBalanceProps) {\n        super(props);\n    }\n\n    render() {\n        // do not print equivalent if this element is the quote itself\n        const quoteBlock = this.props.name != this.props.quote_symbol ? this.props.quote_symbol.concat(\" \").concat(this.props.quote_equivalent.toLocaleString()) : null\n\n        // const accessory = SymbolAccessories.filter((accessory) => {\n        //     return accessory.name == this.props.name\n        // })\n        //\n        // const icon = accessory.length > 0 ? accessory.pop().icon : null\n\n        return (\n            <div className=\"flex-grow flex px-6 py-3 text-gray-800 items-center border-b -mx-4 align-middle\">\n                <div className={\"w-1/8\"}>\n                    {/*{icon}*/}\n                </div>\n                <div className=\"w-2/5 xl:w-1/4 px-4 flex items-center\">\n                    <span className=\"text-lg\">{this.props.name}</span>\n                </div>\n                <div className=\"hidden md:flex lg:hidden xl:flex w-1/4 px-1 flex-col\">\n                    <div className={\"italic w-full text-center\"}>\n                        {Math.trunc(this.props.percentage)}%\n                    </div>\n                    <div className=\"w-full bg-transparent mt-2\">\n                        <div className={\"bg-blue-400 rounded-lg text-xs leading-none py-1 text-center text-white\"}\n                            style={{ width: this.props.percentage.toString().concat(\"%\") }} />\n                    </div>\n                </div>\n                <div className=\"flex w-3/5 md:w/12\">\n                    <div className=\"w-1/2 px-4\">\n                        <div className=\"text-right\">\n                            {this.props.amount.toFixed(5)} {this.props.name}\n                        </div>\n                    </div>\n                    <div className=\"w-1/2 px-4 my-auto\">\n                        <div\n                            className={\"px-2 inline-flex text-center text-xs leading-5 font-semibold rounded-full bg-gray-200 text-gray-800\"}>\n                            {quoteBlock}\n                        </div>\n                    </div>\n                </div>\n            </div>\n        )\n    }\n\n}\n\nexport type WalletCardProps = {\n    quote: string,\n}\n\nexport class WalletCard extends Component\n    <{}, { balances: Array<Balance> }> {\n    // constructor(props) {\n    //     super(props);\n    // }\n\n    state =\n        {\n            balances: []\n        }\n\n    totalQuoteBalance() {\n        let total = 0\n\n        this.state.balances.forEach((balance: Balance) => {\n            if (balance.currency == balance.quote) {\n                total += balance.amount\n            } else {\n                total += balance.quote_equivalent\n            }\n        })\n\n        return total\n    }\n\n    renderCoinBalances() {\n        return (\n            this.state.balances.map((balance: Balance) => {\n                const percentage_amount = balance.quote == balance.currency ? balance.amount : balance.quote_equivalent;\n\n                return (\n                    <CoinBalance key={balance.currency.concat(balance.kind)} name={balance.currency}\n                        amount={balance.amount} quote_equivalent={balance.quote_equivalent}\n                        percentage={percentage_amount / this.totalQuoteBalance() * 100}\n                        quote_symbol={balance.quote} />\n                )\n            })\n        )\n    }\n\n    componentDidMount() {\n        socket.on(EventName.NewTick, (data: NewTickMessage) => {\n            this.setState({\n                balances: data.balances\n            })\n        })\n\n        socket.on(EventName.FirstConnect, (data: FirstConnectMessage) => {\n            this.setState({\n                balances: data.balances\n            })\n        })\n    }\n\n    render() {\n        return (\n            <div className=\"w-full mb-6 lg:mb-0 px-4 flex flex-col\">\n                <div\n                    className=\"flex-grow flex bg-white flex-col border-t border-b sm:rounded-lg sm:border shadow overflow-hidden\">\n                    <div className=\"border-b bg-gray-50\">\n                        <div className=\"flex justify-between px-6 -mb-px\">\n                            <h3 className=\"text-blue-700 py-4 font-normal text-lg\">Your Wallets</h3>\n                            <div className=\"flex\">\n                                <button type=\"button\"\n                                    className=\"appearance-none py-4 text-blue-700 border-b border-blue-dark mr-3\">\n                                    Margin\n                                </button>\n                                <button type=\"button\"\n                                    className=\"appearance-none py-4 text-gray-600 border-b border-transparent hover:border-grey-dark\">\n                                    Chart\n                                </button>\n                            </div>\n                        </div>\n                    </div>\n\n                    {this.renderCoinBalances()}\n\n                    <div className=\"px-6 py-4\">\n                        <div className=\"text-center text-gray-400\">\n                            Total Balance &asymp; USD {this.totalQuoteBalance().toLocaleString()}\n                        </div>\n                    </div>\n                </div>\n            </div>\n        )\n    }\n}","/home/giulio/dev/gkaching/websrc/src/components/Overlays.tsx",["25"],"/home/giulio/dev/gkaching/websrc/src/index.tsx",["26"],{"ruleId":"27","severity":1,"message":"28","line":45,"column":5,"nodeType":"29","messageId":"30","endLine":47,"endColumn":6},{"ruleId":"27","severity":1,"message":"28","line":14,"column":5,"nodeType":"29","messageId":"30","endLine":16,"endColumn":6},{"ruleId":"31","severity":1,"message":"32","line":20,"column":44,"nodeType":"33","messageId":"34","endLine":20,"endColumn":46},{"ruleId":"31","severity":1,"message":"35","line":83,"column":34,"nodeType":"33","messageId":"34","endLine":83,"endColumn":36},{"ruleId":"31","severity":1,"message":"35","line":96,"column":57,"nodeType":"33","messageId":"34","endLine":96,"endColumn":59},{"ruleId":"27","severity":1,"message":"28","line":12,"column":5,"nodeType":"29","messageId":"30","endLine":14,"endColumn":6},{"ruleId":"36","severity":1,"message":"37","line":13,"column":7,"nodeType":"38","messageId":"39","endLine":13,"endColumn":9},"@typescript-eslint/no-useless-constructor","Useless constructor.","MethodDefinition","noUselessConstructor","eqeqeq","Expected '!==' and instead saw '!='.","BinaryExpression","unexpected","Expected '===' and instead saw '=='.","@typescript-eslint/no-unused-vars","'ws' is assigned a value but never used.","Identifier","unusedVar"]