@@ -268,7 +268,8 @@ module.exports = function (password) {
268
268
subscribed : false ,
269
269
chain : [ ] ,
270
270
representative : "" ,
271
- label : ""
271
+ label : "" ,
272
+ color : ""
272
273
}
273
274
for ( let k in o ) {
274
275
key [ k ] = o [ k ] ;
@@ -375,6 +376,7 @@ module.exports = function (password) {
375
376
balance : bigInt ( keys [ i ] . balance ) ,
376
377
pendingBalance : bigInt ( keys [ i ] . pendingBalance ) ,
377
378
label : keys [ i ] . label ,
379
+ color : keys [ i ] . color ,
378
380
lastHash : keys [ i ] . chain . length > 0 ? keys [ i ] . chain [ keys [ i ] . chain . length - 1 ] : false
379
381
} ) ;
380
382
}
@@ -690,6 +692,16 @@ module.exports = function (password) {
690
692
return false ;
691
693
}
692
694
695
+ api . setColor = function ( acc , color ) {
696
+ for ( let i in keys ) {
697
+ if ( keys [ i ] . account == acc ) {
698
+ keys [ i ] . color = color ;
699
+ return true ;
700
+ }
701
+ }
702
+ return false ;
703
+ }
704
+
693
705
api . removePendingBlocks = function ( ) {
694
706
current . pendingBlocks = [ ] ;
695
707
}
@@ -1306,13 +1318,15 @@ module.exports = function (password) {
1306
1318
pack . accounts . push ( {
1307
1319
type : KEY_TYPE . SEEDED ,
1308
1320
label : key . label ,
1321
+ color : key . color ,
1309
1322
seedIndex : key . seedIndex ,
1310
1323
} ) ;
1311
1324
break ;
1312
1325
case KEY_TYPE . EXPLICIT :
1313
1326
pack . accounts . push ( {
1314
1327
type : KEY_TYPE . EXPLICIT ,
1315
1328
label : key . label ,
1329
+ color : key . color ,
1316
1330
secretKey : uint8_hex ( key . priv ) ,
1317
1331
} ) ;
1318
1332
break ;
@@ -1387,13 +1401,15 @@ module.exports = function (password) {
1387
1401
case KEY_TYPE . SEEDED : {
1388
1402
let key = _private . newKeyDataFromSeed ( acc . seedIndex ) ;
1389
1403
key . label = acc . label ;
1404
+ key . color = acc . color || '' ;
1390
1405
_private . addKey ( key ) ;
1391
1406
lastKeyFromSeed = Math . max ( lastKeyFromSeed , acc . seedIndex ) ;
1392
1407
break ;
1393
1408
}
1394
1409
case KEY_TYPE . EXPLICIT : {
1395
1410
let key = _private . newKeyDataFromSecret ( hex_uint8 ( acc . secretKey ) ) ;
1396
1411
key . label = acc . label ;
1412
+ key . color = acc . color || '' ;
1397
1413
_private . addKey ( key ) ;
1398
1414
break ;
1399
1415
}
0 commit comments