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
7 years ago
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added method to get an account by name
parent
f3647040
Hide 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
var
index
=
unusedAccounts
.
Min
(
a
=>
a
.
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>
...
...
@@ -257,7 +274,7 @@ namespace Breeze.Wallet
{
var
addresses
=
this
.
ExternalAddresses
.
Concat
(
this
.
InternalAddresses
);
return
addresses
.
SelectMany
(
a
=>
a
.
Transactions
.
Where
(
t
=>
t
.
Id
==
id
));
}
}
}
/// <summary>
...
...
This diff is collapsed.
Click to expand it.
Breeze/src/Breeze.Wallet/WalletManager.cs
View file @
9cf65ea3
...
...
@@ -203,18 +203,14 @@ namespace Breeze.Wallet
return
newAccount
;
}
/// <inheritdoc />
public
string
GetUnusedAddress
(
string
walletName
,
CoinType
coinType
,
string
accountName
)
{
Wallet
wallet
=
this
.
GetWalletByName
(
walletName
);
// get the account
HdAccount
account
=
wallet
.
AccountsRoot
.
Single
(
a
=>
a
.
CoinType
==
coinType
).
Accounts
.
SingleOrDefault
(
a
=>
a
.
Name
==
accountName
);
if
(
account
==
null
)
{
throw
new
Exception
(
$"No account with name
{
accountName
}
could be found."
);
}
HdAccount
account
=
wallet
.
AccountsRoot
.
Single
(
a
=>
a
.
CoinType
==
coinType
).
GetAccountByName
(
accountName
);
// validate address creation
if
(
account
.
ExternalAddresses
.
Any
())
...
...
This diff is collapsed.
Click to expand it.
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