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
a11f8eaf
Commit
a11f8eaf
authored
May 10, 2017
by
Pieterjan Vanhoof
Committed by
GitHub
May 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #45 from bokobza/feature/build-transaction
Retrieve coin type from DI
parents
135a3452
e83721ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
WalletManager.cs
Breeze/src/Breeze.Wallet/WalletManager.cs
+11
-7
No files found.
Breeze/src/Breeze.Wallet/WalletManager.cs
View file @
a11f8eaf
...
@@ -28,12 +28,14 @@ namespace Breeze.Wallet
...
@@ -28,12 +28,14 @@ namespace Breeze.Wallet
private
const
int
WalletCreationAccountsCount
=
2
;
private
const
int
WalletCreationAccountsCount
=
2
;
private
readonly
CoinType
coinType
;
/// <summary>
/// <summary>
/// Occurs when a transaction is found.
/// Occurs when a transaction is found.
/// </summary>
/// </summary>
public
event
EventHandler
<
TransactionFoundEventArgs
>
TransactionFound
;
public
event
EventHandler
<
TransactionFoundEventArgs
>
TransactionFound
;
public
WalletManager
()
public
WalletManager
(
ConcurrentChain
chain
)
{
{
this
.
Wallets
=
new
List
<
Wallet
>();
this
.
Wallets
=
new
List
<
Wallet
>();
...
@@ -43,10 +45,12 @@ namespace Breeze.Wallet
...
@@ -43,10 +45,12 @@ namespace Breeze.Wallet
this
.
Load
(
this
.
DeserializeWallet
(
path
));
this
.
Load
(
this
.
DeserializeWallet
(
path
));
}
}
this
.
coinType
=
chain
.
GetCoinType
();
// load data in memory for faster lookups
// load data in memory for faster lookups
// TODO get the coin type from somewhere else
// TODO get the coin type from somewhere else
this
.
PubKeys
=
this
.
LoadKeys
(
CoinType
.
Bitcoin
);
this
.
PubKeys
=
this
.
LoadKeys
(
this
.
coinType
);
this
.
TrackedTransactions
=
this
.
LoadTransactions
(
CoinType
.
Bitcoin
);
this
.
TrackedTransactions
=
this
.
LoadTransactions
(
this
.
coinType
);
this
.
TransactionFound
+=
this
.
OnTransactionFound
;
this
.
TransactionFound
+=
this
.
OnTransactionFound
;
}
}
...
@@ -72,14 +76,14 @@ namespace Breeze.Wallet
...
@@ -72,14 +76,14 @@ namespace Breeze.Wallet
// generate multiple accounts and addresses from the get-go
// generate multiple accounts and addresses from the get-go
for
(
int
i
=
0
;
i
<
WalletCreationAccountsCount
;
i
++)
for
(
int
i
=
0
;
i
<
WalletCreationAccountsCount
;
i
++)
{
{
HdAccount
account
=
CreateNewAccount
(
wallet
,
CoinType
.
Bitcoin
,
password
);
HdAccount
account
=
CreateNewAccount
(
wallet
,
this
.
coinType
,
password
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
,
true
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
,
true
);
}
}
// save the changes to the file and add addresses to be tracked
// save the changes to the file and add addresses to be tracked
this
.
SaveToFile
(
wallet
);
this
.
SaveToFile
(
wallet
);
this
.
PubKeys
=
this
.
LoadKeys
(
CoinType
.
Bitcoin
);
this
.
PubKeys
=
this
.
LoadKeys
(
this
.
coinType
);
this
.
Load
(
wallet
);
this
.
Load
(
wallet
);
return
mnemonic
;
return
mnemonic
;
...
@@ -117,14 +121,14 @@ namespace Breeze.Wallet
...
@@ -117,14 +121,14 @@ namespace Breeze.Wallet
// generate multiple accounts and addresses from the get-go
// generate multiple accounts and addresses from the get-go
for
(
int
i
=
0
;
i
<
WalletRecoveryAccountsCount
;
i
++)
for
(
int
i
=
0
;
i
<
WalletRecoveryAccountsCount
;
i
++)
{
{
HdAccount
account
=
CreateNewAccount
(
wallet
,
CoinType
.
Bitcoin
,
password
);
HdAccount
account
=
CreateNewAccount
(
wallet
,
this
.
coinType
,
password
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
,
true
);
this
.
CreateAddressesInAccount
(
account
,
coinNetwork
,
UnusedAddressesBuffer
,
true
);
}
}
// save the changes to the file and add addresses to be tracked
// save the changes to the file and add addresses to be tracked
this
.
SaveToFile
(
wallet
);
this
.
SaveToFile
(
wallet
);
this
.
PubKeys
=
this
.
LoadKeys
(
CoinType
.
Bitcoin
);
this
.
PubKeys
=
this
.
LoadKeys
(
this
.
coinType
);
this
.
Load
(
wallet
);
this
.
Load
(
wallet
);
return
wallet
;
return
wallet
;
...
...
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