account command can now configure the default account
This commit is contained in:
parent
d0d5d0340d
commit
be248dc448
1 changed files with 11 additions and 3 deletions
|
@ -3064,7 +3064,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
seed=None, private_key=None, public_key=None,
|
seed=None, private_key=None, public_key=None,
|
||||||
change_gap=None, change_max_uses=None,
|
change_gap=None, change_max_uses=None,
|
||||||
receiving_gap=None, receiving_max_uses=None,
|
receiving_gap=None, receiving_max_uses=None,
|
||||||
rename=None):
|
rename=None, default=False):
|
||||||
"""
|
"""
|
||||||
Create new account or update some settings on an existing account. If no
|
Create new account or update some settings on an existing account. If no
|
||||||
creation or modification options are provided but the account exists then
|
creation or modification options are provided but the account exists then
|
||||||
|
@ -3075,7 +3075,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
[--seed=<seed> | --private_key=<private_key> | --public_key=<public_key>]
|
[--seed=<seed> | --private_key=<private_key> | --public_key=<public_key>]
|
||||||
[--change_gap=<change_gap>] [--change_max_uses=<change_max_uses>]
|
[--change_gap=<change_gap>] [--change_max_uses=<change_max_uses>]
|
||||||
[--receiving_gap=<receiving_gap>] [--receiving_max_uses=<receiving_max_uses>]
|
[--receiving_gap=<receiving_gap>] [--receiving_max_uses=<receiving_max_uses>]
|
||||||
[--rename=<rename>]
|
[--rename=<rename>] [--default]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--account_name=<account_name> : (str) name of the account to create or update
|
--account_name=<account_name> : (str) name of the account to create or update
|
||||||
|
@ -3092,6 +3092,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
--change_max_uses=<change_max_uses> : (int) set the maximum number of times to
|
--change_max_uses=<change_max_uses> : (int) set the maximum number of times to
|
||||||
use a change address
|
use a change address
|
||||||
--rename=<rename> : (str) change name of existing account
|
--rename=<rename> : (str) change name of existing account
|
||||||
|
--default : (bool) make this account the default
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(map) new or updated account details
|
(map) new or updated account details
|
||||||
|
@ -3151,8 +3152,15 @@ class Daemon(AuthJSONRPCServer):
|
||||||
change_made = True
|
change_made = True
|
||||||
if change_made:
|
if change_made:
|
||||||
wallet.save()
|
wallet.save()
|
||||||
|
|
||||||
|
if default:
|
||||||
|
wallet.accounts.remove(account)
|
||||||
|
wallet.accounts.insert(0, account)
|
||||||
|
wallet.save()
|
||||||
|
|
||||||
result = account.to_dict()
|
result = account.to_dict()
|
||||||
result.pop('certificates', None)
|
result.pop('certificates', None)
|
||||||
|
result['is_default'] = wallet.accounts[0] == account
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@requires("wallet")
|
@requires("wallet")
|
||||||
|
|
Loading…
Reference in a new issue