Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
9cf65ea3
Commit
9cf65ea3
authored
May 11, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added method to get an account by name
parent
f3647040
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
Wallet.cs
Breeze/src/Breeze.Wallet/Wallet.cs
+18
-1
WalletManager.cs
Breeze/src/Breeze.Wallet/WalletManager.cs
+2
-6
No files found.
Breeze/src/Breeze.Wallet/Wallet.cs
View file @
9cf65ea3
...
@@ -125,6 +125,23 @@ namespace Breeze.Wallet
...
@@ -125,6 +125,23 @@ namespace Breeze.Wallet
var
index
=
unusedAccounts
.
Min
(
a
=>
a
.
Index
);
var
index
=
unusedAccounts
.
Min
(
a
=>
a
.
Index
);
return
unusedAccounts
.
Single
(
a
=>
a
.
Index
==
index
);
return
unusedAccounts
.
Single
(
a
=>
a
.
Index
==
index
);
}
}
/// <summary>
/// Gets the account matching the name passed as a parameter.
/// </summary>
/// <param name="accountName">The name of the account to get.</param>
/// <returns></returns>
/// <exception cref="System.Exception"></exception>
public
HdAccount
GetAccountByName
(
string
accountName
)
{
// get the account
HdAccount
account
=
this
.
Accounts
.
SingleOrDefault
(
a
=>
a
.
Name
==
accountName
);
if
(
account
==
null
)
{
throw
new
Exception
(
$"No account with name
{
accountName
}
could be found."
);
}
return
account
;
}
}
}
/// <summary>
/// <summary>
...
...
Breeze/src/Breeze.Wallet/WalletManager.cs
View file @
9cf65ea3
...
@@ -210,11 +210,7 @@ namespace Breeze.Wallet
...
@@ -210,11 +210,7 @@ namespace Breeze.Wallet
Wallet
wallet
=
this
.
GetWalletByName
(
walletName
);
Wallet
wallet
=
this
.
GetWalletByName
(
walletName
);
// get the account
// get the account
HdAccount
account
=
wallet
.
AccountsRoot
.
Single
(
a
=>
a
.
CoinType
==
coinType
).
Accounts
.
SingleOrDefault
(
a
=>
a
.
Name
==
accountName
);
HdAccount
account
=
wallet
.
AccountsRoot
.
Single
(
a
=>
a
.
CoinType
==
coinType
).
GetAccountByName
(
accountName
);
if
(
account
==
null
)
{
throw
new
Exception
(
$"No account with name
{
accountName
}
could be found."
);
}
// validate address creation
// validate address creation
if
(
account
.
ExternalAddresses
.
Any
())
if
(
account
.
ExternalAddresses
.
Any
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment