@@ -114,7 +114,6 @@ function set_callbacks(socket) {
114114 console . log ( "Received command: " + command ) ;
115115
116116 if ( command == "start_server" ) {
117- get_wallets ( ) ;
118117 get_colour ( g_wallet_id )
119118 get_colour_name ( g_wallet_id )
120119 get_transactions ( ) ;
@@ -194,6 +193,44 @@ function get_wallet_summaries_response(data){
194193 // {id: {"type": type, "balance": balance, "name": name, "colour": colour}}
195194 // {id: {"type": type, "balance": balance}}
196195 wallets_details = data
196+ wallets_tab . innerHTML = ""
197+ var new_innerHTML = ""
198+ for ( var i in data ) {
199+ var wallet = data [ i ] ;
200+ var type = wallet [ "type" ]
201+ var id = i
202+ var name = wallet [ "type" ]
203+ if ( type == "STANDARD_WALLET" ) {
204+ name = "Chia Wallet"
205+ type = "Chia"
206+ } else if ( name == "COLOURED_COIN" ) {
207+ name = "CC Wallet"
208+ type = wallet [ "name" ]
209+ if ( type . length > 20 ) {
210+ type = type . substring ( 0 , 20 ) ;
211+ type = type . concat ( "..." )
212+ }
213+ }
214+ get_wallet_balance ( id )
215+ //href, wallet_name, wallet_description, wallet_amount
216+ var href = ""
217+ if ( type == "STANDARD_WALLET" ) {
218+ href = "../wallet-dark.html"
219+ } else if ( type == "RATE_LIMITED" ) {
220+ href = "../rl_wallet/rl_wallet.html"
221+ } else if ( type == "COLOURED_COIN" ) {
222+ href = "../cc_wallet/cc_wallet.html"
223+ }
224+
225+ if ( id == g_wallet_id ) {
226+ new_innerHTML += create_side_wallet ( id , href , name , type , 0 , true )
227+ } else {
228+ new_innerHTML += create_side_wallet ( id , href , name , type , 0 , false )
229+ }
230+
231+ }
232+ new_innerHTML += create_wallet_button ( )
233+ wallets_tab . innerHTML = new_innerHTML
197234}
198235
199236async function get_wallet_balance ( id ) {
@@ -363,48 +400,6 @@ function handle_state_changed(data) {
363400 }
364401}
365402
366- function get_wallets ( ) {
367- /*
368- Sends websocket request to get list of all wallets available
369- */
370- data = {
371- "command" : "get_wallets" ,
372- }
373- json_data = JSON . stringify ( data ) ;
374- ws . send ( json_data ) ;
375- }
376-
377- function get_wallets_response ( data ) {
378- wallets_tab . innerHTML = ""
379- new_innerHTML = ""
380- const wallets = data [ "wallets" ]
381- for ( var i = 0 ; i < wallets . length ; i ++ ) {
382- var wallet = wallets [ i ] ;
383- var type = wallet [ "type" ]
384- var id = wallet [ "id" ]
385- var name = wallet [ "name" ]
386- get_wallet_balance ( id )
387- //href, wallet_name, wallet_description, wallet_amount
388- var href = ""
389- if ( type == "STANDARD_WALLET" ) {
390- href = "../wallet-dark.html"
391- } else if ( type == "RATE_LIMITED" ) {
392- href = "../rl_wallet/rl_wallet.html"
393- } else if ( type == "COLOURED_COIN" ) {
394- href = "../cc_wallet/cc_wallet.html"
395- }
396-
397- if ( id == g_wallet_id ) {
398- new_innerHTML += create_side_wallet ( id , href , name , type , 0 , true )
399- } else {
400- new_innerHTML += create_side_wallet ( id , href , name , type , 0 , false )
401- }
402-
403- }
404- new_innerHTML += create_wallet_button ( )
405- wallets_tab . innerHTML = new_innerHTML
406- }
407-
408403function get_colour ( id ) {
409404 /*
410405 Sends websocket request to get the colour
0 commit comments