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
1563efa9
Commit
1563efa9
authored
Apr 21, 2017
by
Pieterjan Vanhoof
Committed by
GitHub
Apr 21, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Created a WalletManager to manage the user's wallets (#32).
Created a WalletManager to manage the user's wallets.
parents
f4a62d20
d6b9e6fe
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
360 additions
and
15 deletions
+360
-15
Breeze.vs2017.sln
Breeze/Breeze.vs2017.sln
+1
-1
ControllersTests.cs
Breeze/src/Breeze.Api.Tests/ControllersTests.cs
+2
-1
WalletController.cs
Breeze/src/Breeze.Wallet/Controllers/WalletController.cs
+6
-1
IWalletManager.cs
Breeze/src/Breeze.Wallet/IWalletManager.cs
+47
-0
ByteArrayConverter.cs
...ze/src/Breeze.Wallet/JsonConverters/ByteArrayConverter.cs
+32
-0
DateTimeOffsetConverter.cs
...c/Breeze.Wallet/JsonConverters/DateTimeOffsetConverter.cs
+30
-0
NetworkConverter.cs
Breeze/src/Breeze.Wallet/JsonConverters/NetworkConverter.cs
+32
-0
Wallet.cs
Breeze/src/Breeze.Wallet/Wallet.cs
+36
-0
WalletFeature.cs
Breeze/src/Breeze.Wallet/WalletFeature.cs
+1
-0
WalletFile.cs
Breeze/src/Breeze.Wallet/WalletFile.cs
+40
-0
WalletManager.cs
Breeze/src/Breeze.Wallet/WalletManager.cs
+115
-0
WalletWrapper.cs
Breeze/src/Breeze.Wallet/Wrappers/WalletWrapper.cs
+18
-12
No files found.
Breeze/Breeze.vs2017.sln
View file @
1563efa9
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
# Visual Studio 15
VisualStudioVersion = 15.0.26403.
0
VisualStudioVersion = 15.0.26403.
7
MinimumVisualStudioVersion = 10.0.40219.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{807563C4-7259-434D-B604-A14C3DCF8E30}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{807563C4-7259-434D-B604-A14C3DCF8E30}"
EndProject
EndProject
...
...
Breeze/src/Breeze.Api.Tests/ControllersTests.cs
View file @
1563efa9
...
@@ -6,6 +6,7 @@ using Moq;
...
@@ -6,6 +6,7 @@ using Moq;
using
Breeze.Wallet.Wrappers
;
using
Breeze.Wallet.Wrappers
;
using
Breeze.Wallet
;
using
Breeze.Wallet
;
using
Breeze.Wallet.Controllers
;
using
Breeze.Wallet.Controllers
;
using
Breeze.Wallet.Errors
;
using
Breeze.Wallet.Models
;
using
Breeze.Wallet.Models
;
namespace
Breeze.Api.Tests
namespace
Breeze.Api.Tests
...
@@ -122,7 +123,7 @@ namespace Breeze.Api.Tests
...
@@ -122,7 +123,7 @@ namespace Breeze.Api.Tests
// Assert
// Assert
mockWalletWrapper
.
VerifyAll
();
mockWalletWrapper
.
VerifyAll
();
var
viewResult
=
Assert
.
IsType
<
Object
Result
>(
result
);
var
viewResult
=
Assert
.
IsType
<
Error
Result
>(
result
);
Assert
.
NotNull
(
viewResult
);
Assert
.
NotNull
(
viewResult
);
Assert
.
Equal
(
404
,
viewResult
.
StatusCode
);
Assert
.
Equal
(
404
,
viewResult
.
StatusCode
);
}
}
...
...
Breeze/src/Breeze.Wallet/Controllers/WalletController.cs
View file @
1563efa9
...
@@ -48,7 +48,7 @@ namespace Breeze.Wallet.Controllers
...
@@ -48,7 +48,7 @@ namespace Breeze.Wallet.Controllers
var
mnemonic
=
this
.
walletWrapper
.
Create
(
request
.
Password
,
walletFolder
.
FullName
,
request
.
Name
,
request
.
Network
);
var
mnemonic
=
this
.
walletWrapper
.
Create
(
request
.
Password
,
walletFolder
.
FullName
,
request
.
Name
,
request
.
Network
);
return
this
.
Json
(
mnemonic
);
return
this
.
Json
(
mnemonic
);
}
}
catch
(
NotSupported
Exception
e
)
catch
(
InvalidOperation
Exception
e
)
{
{
// indicates that this wallet already exists
// indicates that this wallet already exists
return
ErrorHelpers
.
BuildErrorResponse
(
HttpStatusCode
.
Conflict
,
"This wallet already exists."
,
e
.
ToString
());
return
ErrorHelpers
.
BuildErrorResponse
(
HttpStatusCode
.
Conflict
,
"This wallet already exists."
,
e
.
ToString
());
...
@@ -119,6 +119,11 @@ namespace Breeze.Wallet.Controllers
...
@@ -119,6 +119,11 @@ namespace Breeze.Wallet.Controllers
var
wallet
=
this
.
walletWrapper
.
Recover
(
request
.
Password
,
walletFolder
.
FullName
,
request
.
Name
,
request
.
Network
,
request
.
Mnemonic
);
var
wallet
=
this
.
walletWrapper
.
Recover
(
request
.
Password
,
walletFolder
.
FullName
,
request
.
Name
,
request
.
Network
,
request
.
Mnemonic
);
return
this
.
Json
(
wallet
);
return
this
.
Json
(
wallet
);
}
}
catch
(
InvalidOperationException
e
)
{
// indicates that this wallet already exists
return
ErrorHelpers
.
BuildErrorResponse
(
HttpStatusCode
.
Conflict
,
"This wallet already exists."
,
e
.
ToString
());
}
catch
(
FileNotFoundException
e
)
catch
(
FileNotFoundException
e
)
{
{
// indicates that this wallet does not exist
// indicates that this wallet does not exist
...
...
Breeze/src/Breeze.Wallet/IWalletManager.cs
0 → 100644
View file @
1563efa9
using
System
;
using
NBitcoin
;
namespace
Breeze.Wallet
{
/// <summary>
/// Interface for a manager providing operations on wallets.
/// </summary>
public
interface
IWalletManager
:
IDisposable
{
/// <summary>
/// Creates a wallet and persist it as a file on the local system.
/// </summary>
/// <param name="password">The password used to encrypt sensitive info.</param>
/// <param name="passphrase">The passphrase used in the seed.</param>
/// <param name="walletFilePath">The path where the wallet file will be created.</param>
/// <param name="network">The network this wallet is for.</param>
/// <returns>A mnemonic defining the wallet's seed used to generate addresses.</returns>
Mnemonic
CreateWallet
(
string
password
,
string
walletFilePath
,
Network
network
,
string
passphrase
=
null
);
/// <summary>
/// Loads a wallet from a file.
/// </summary>
/// <param name="password">The password used to encrypt sensitive info.</param>
/// <param name="walletFilePath">The location of the wallet file.</param>
/// <returns>The wallet.</returns>
Wallet
LoadWallet
(
string
password
,
string
walletFilePath
);
/// <summary>
/// Recovers a wallet.
/// </summary>
/// <param name="mnemonic">A mnemonic defining the wallet's seed used to generate addresses.</param>
/// <param name="password">The password used to encrypt sensitive info.</param>
/// <param name="walletFilePath">The location of the wallet file.</param>
/// <param name="network">The network this wallet is for.</param>
/// <param name="passphrase">The passphrase used in the seed.</param>
/// <param name="creationTime">The time this wallet was created.</param>
/// <returns>The recovered wallet.</returns>
Wallet
RecoverWallet
(
Mnemonic
mnemonic
,
string
password
,
string
walletFilePath
,
Network
network
,
string
passphrase
=
null
,
DateTimeOffset
?
creationTime
=
null
);
/// <summary>
/// Deleted a wallet.
/// </summary>
/// <param name="walletFilePath">The location of the wallet file.</param>
void
DeleteWallet
(
string
walletFilePath
);
}
}
Breeze/src/Breeze.Wallet/JsonConverters/ByteArrayConverter.cs
0 → 100644
View file @
1563efa9
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Newtonsoft.Json
;
namespace
Breeze.Wallet.JsonConverters
{
/// <summary>
/// Converter used to convert <see cref="byte"/> arrays to and from JSON.
/// </summary>
/// <seealso cref="Newtonsoft.Json.JsonConverter" />
public
class
ByteArrayConverter
:
JsonConverter
{
/// <inheritdoc />
public
override
bool
CanConvert
(
Type
objectType
)
{
return
objectType
==
typeof
(
byte
[]);
}
/// <inheritdoc />
public
override
object
ReadJson
(
JsonReader
reader
,
Type
objectType
,
object
existingValue
,
JsonSerializer
serializer
)
{
return
Convert
.
FromBase64String
((
string
)
reader
.
Value
);
}
/// <inheritdoc />
public
override
void
WriteJson
(
JsonWriter
writer
,
object
value
,
JsonSerializer
serializer
)
{
writer
.
WriteValue
(
Convert
.
ToBase64String
((
byte
[])
value
));
}
}
}
Breeze/src/Breeze.Wallet/JsonConverters/DateTimeOffsetConverter.cs
0 → 100644
View file @
1563efa9
using
Newtonsoft.Json
;
using
System
;
namespace
Breeze.Wallet.JsonConverters
{
/// <summary>
/// Converter used to convert <see cref="DateTimeOffset"/> to and from Unix time.
/// </summary>
/// <seealso cref="Newtonsoft.Json.JsonConverter" />
public
class
DateTimeOffsetConverter
:
JsonConverter
{
/// <inheritdoc />
public
override
bool
CanConvert
(
Type
objectType
)
{
return
objectType
==
typeof
(
DateTimeOffset
);
}
/// <inheritdoc />
public
override
object
ReadJson
(
JsonReader
reader
,
Type
objectType
,
object
existingValue
,
JsonSerializer
serializer
)
{
return
DateTimeOffset
.
FromUnixTimeMilliseconds
(
long
.
Parse
((
string
)
reader
.
Value
));
}
/// <inheritdoc />
public
override
void
WriteJson
(
JsonWriter
writer
,
object
value
,
JsonSerializer
serializer
)
{
writer
.
WriteValue
(((
DateTimeOffset
)
value
).
ToUnixTimeMilliseconds
().
ToString
());
}
}
}
Breeze/src/Breeze.Wallet/JsonConverters/NetworkConverter.cs
0 → 100644
View file @
1563efa9
using
System
;
using
Breeze.Wallet.Helpers
;
using
NBitcoin
;
using
Newtonsoft.Json
;
namespace
Breeze.Wallet.JsonConverters
{
/// <summary>
/// Converter used to convert <see cref="Network"/> to and from JSON.
/// </summary>
/// <seealso cref="Newtonsoft.Json.JsonConverter" />
public
class
NetworkConverter
:
JsonConverter
{
/// <inheritdoc />
public
override
bool
CanConvert
(
Type
objectType
)
{
return
objectType
==
typeof
(
Network
);
}
/// <inheritdoc />
public
override
object
ReadJson
(
JsonReader
reader
,
Type
objectType
,
object
existingValue
,
JsonSerializer
serializer
)
{
return
WalletHelpers
.
GetNetwork
((
string
)
reader
.
Value
);
}
/// <inheritdoc />
public
override
void
WriteJson
(
JsonWriter
writer
,
object
value
,
JsonSerializer
serializer
)
{
writer
.
WriteValue
(((
Network
)
value
).
ToString
());
}
}
}
Breeze/src/Breeze.Wallet/Wallet.cs
0 → 100644
View file @
1563efa9
using
System
;
using
NBitcoin
;
namespace
Breeze.Wallet
{
/// <summary>
/// A wallet
/// </summary>
public
class
Wallet
{
/// <summary>
/// The chain code.
/// </summary>
public
byte
[]
ChainCode
{
get
;
set
;
}
/// <summary>
/// The network this wallet is for.
/// </summary>
public
Network
Network
{
get
;
set
;
}
/// <summary>
/// The time this wallet was created.
/// </summary>
public
DateTimeOffset
CreationTime
{
get
;
set
;
}
/// <summary>
/// The location of the wallet file on the local system.
/// </summary>
public
string
WalletFilePath
{
get
;
set
;
}
/// <summary>
/// The key used to generate keys.
/// </summary>
public
ExtKey
ExtendedKey
{
get
;
set
;
}
}
}
\ No newline at end of file
Breeze/src/Breeze.Wallet/WalletFeature.cs
View file @
1563efa9
...
@@ -41,6 +41,7 @@ namespace Breeze.Wallet
...
@@ -41,6 +41,7 @@ namespace Breeze.Wallet
{
{
services
.
AddTransient
<
IWalletWrapper
,
WalletWrapper
>();
services
.
AddTransient
<
IWalletWrapper
,
WalletWrapper
>();
services
.
AddTransient
<
ITrackerWrapper
,
TrackerWrapper
>();
services
.
AddTransient
<
ITrackerWrapper
,
TrackerWrapper
>();
services
.
AddSingleton
<
IWalletManager
,
WalletManager
>();
services
.
AddSingleton
<
WalletController
>();
services
.
AddSingleton
<
WalletController
>();
});
});
});
});
...
...
Breeze/src/Breeze.Wallet/WalletFile.cs
0 → 100644
View file @
1563efa9
using
System
;
using
NBitcoin
;
using
Newtonsoft.Json
;
using
Breeze.Wallet.JsonConverters
;
namespace
Breeze.Wallet
{
/// <summary>
/// An object representing a wallet on a local file system.
/// </summary>
public
class
WalletFile
{
/// <summary>
/// The seed for this wallet, password encrypted.
/// </summary>
[
JsonProperty
(
PropertyName
=
"encryptedSeed"
)]
public
string
EncryptedSeed
{
get
;
set
;
}
/// <summary>
/// The chain code.
/// </summary>
[
JsonProperty
(
PropertyName
=
"chainCode"
)]
[
JsonConverter
(
typeof
(
ByteArrayConverter
))]
public
byte
[]
ChainCode
{
get
;
set
;
}
/// <summary>
/// The network this wallet is for.
/// </summary>
[
JsonProperty
(
PropertyName
=
"network"
)]
[
JsonConverter
(
typeof
(
NetworkConverter
))]
public
Network
Network
{
get
;
set
;
}
/// <summary>
/// The time this wallet was created.
/// </summary>
[
JsonProperty
(
PropertyName
=
"creationTime"
)]
[
JsonConverter
(
typeof
(
DateTimeOffsetConverter
))]
public
DateTimeOffset
CreationTime
{
get
;
set
;
}
}
}
Breeze/src/Breeze.Wallet/WalletManager.cs
0 → 100644
View file @
1563efa9
using
System
;
using
System.IO
;
using
NBitcoin
;
using
Newtonsoft.Json
;
namespace
Breeze.Wallet
{
/// <summary>
/// A manager providing operations on wallets.
/// </summary>
public
class
WalletManager
:
IWalletManager
{
/// <inheritdoc />
public
Mnemonic
CreateWallet
(
string
password
,
string
walletFilePath
,
Network
network
,
string
passphrase
=
null
)
{
// generate the root seed used to generate keys from a mnemonic picked at random
// and a passphrase optionally provided by the user
Mnemonic
mnemonic
=
new
Mnemonic
(
Wordlist
.
English
,
WordCount
.
Twelve
);
ExtKey
extendedKey
=
mnemonic
.
DeriveExtKey
(
passphrase
);
// create a wallet file
this
.
GenerateWalletFile
(
password
,
walletFilePath
,
network
,
extendedKey
);
return
mnemonic
;
}
/// <inheritdoc />
public
Wallet
LoadWallet
(
string
password
,
string
walletFilePath
)
{
if
(!
File
.
Exists
(
walletFilePath
))
throw
new
FileNotFoundException
(
$"No wallet file found at
{
walletFilePath
}
"
);
// load the file from the local system
WalletFile
walletFile
=
JsonConvert
.
DeserializeObject
<
WalletFile
>(
File
.
ReadAllText
(
walletFilePath
));
// decrypt the private key and use it to regenerate the seed
var
privateKey
=
Key
.
Parse
(
walletFile
.
EncryptedSeed
,
password
,
walletFile
.
Network
);
var
seedExtKey
=
new
ExtKey
(
privateKey
,
walletFile
.
ChainCode
);
Wallet
wallet
=
new
Wallet
{
ChainCode
=
walletFile
.
ChainCode
,
CreationTime
=
walletFile
.
CreationTime
,
Network
=
walletFile
.
Network
,
WalletFilePath
=
walletFilePath
,
ExtendedKey
=
seedExtKey
};
return
wallet
;
}
/// <inheritdoc />
public
Wallet
RecoverWallet
(
Mnemonic
mnemonic
,
string
password
,
string
walletFilePath
,
Network
network
,
string
passphrase
=
null
,
DateTimeOffset
?
creationTime
=
null
)
{
// generate the root seed used to generate keys
ExtKey
extendedKey
=
mnemonic
.
DeriveExtKey
(
passphrase
);
// create a wallet file
WalletFile
walletFile
=
this
.
GenerateWalletFile
(
password
,
walletFilePath
,
network
,
extendedKey
,
creationTime
);
Wallet
wallet
=
new
Wallet
{
ChainCode
=
walletFile
.
ChainCode
,
CreationTime
=
walletFile
.
CreationTime
,
Network
=
walletFile
.
Network
,
WalletFilePath
=
walletFilePath
,
ExtendedKey
=
extendedKey
};
return
wallet
;
}
/// <inheritdoc />
public
void
DeleteWallet
(
string
walletFilePath
)
{
File
.
Delete
(
walletFilePath
);
}
/// <inheritdoc />
public
void
Dispose
()
{
// TODO Safely persist the wallet before disposing
}
/// <summary>
/// Generates the wallet file.
/// </summary>
/// <param name="password">The password used to encrypt sensitive info.</param>
/// <param name="walletFilePath">The location of the wallet file.</param>
/// <param name="network">The network this wallet is for.</param>
/// <param name="extendedKey">The root key used to generate keys.</param>
/// <param name="creationTime">The time this wallet was created.</param>
/// <returns></returns>
/// <exception cref="System.NotSupportedException"></exception>
private
WalletFile
GenerateWalletFile
(
string
password
,
string
walletFilePath
,
Network
network
,
ExtKey
extendedKey
,
DateTimeOffset
?
creationTime
=
null
)
{
if
(
File
.
Exists
(
walletFilePath
))
throw
new
InvalidOperationException
(
$"Wallet already exists at
{
walletFilePath
}
"
);
WalletFile
walletFile
=
new
WalletFile
{
EncryptedSeed
=
extendedKey
.
PrivateKey
.
GetEncryptedBitcoinSecret
(
password
,
network
).
ToWif
(),
ChainCode
=
extendedKey
.
ChainCode
,
CreationTime
=
creationTime
??
DateTimeOffset
.
Now
,
Network
=
network
};
// create a folder if none exists and persist the file
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
Path
.
GetFullPath
(
walletFilePath
)));
File
.
WriteAllText
(
walletFilePath
,
JsonConvert
.
SerializeObject
(
walletFile
,
Formatting
.
Indented
));
return
walletFile
;
}
}
}
Breeze/src/Breeze.Wallet/Wrappers/WalletWrapper.cs
View file @
1563efa9
...
@@ -13,7 +13,14 @@ namespace Breeze.Wallet.Wrappers
...
@@ -13,7 +13,14 @@ namespace Breeze.Wallet.Wrappers
/// </summary>
/// </summary>
public
class
WalletWrapper
:
IWalletWrapper
public
class
WalletWrapper
:
IWalletWrapper
{
{
/// <summary>
private
readonly
IWalletManager
walletManager
;
public
WalletWrapper
(
IWalletManager
walletManager
)
{
this
.
walletManager
=
walletManager
;
}
/// <summary>
/// Creates a wallet on the local device.
/// Creates a wallet on the local device.
/// </summary>
/// </summary>
/// <param name="password">The user's password.</param>
/// <param name="password">The user's password.</param>
...
@@ -22,9 +29,8 @@ namespace Breeze.Wallet.Wrappers
...
@@ -22,9 +29,8 @@ namespace Breeze.Wallet.Wrappers
/// <param name="network">The network for which to create a wallet.</param>
/// <param name="network">The network for which to create a wallet.</param>
/// <returns>A mnemonic allowing recovery of the wallet.</returns>
/// <returns>A mnemonic allowing recovery of the wallet.</returns>
public
string
Create
(
string
password
,
string
folderPath
,
string
name
,
string
network
)
public
string
Create
(
string
password
,
string
folderPath
,
string
name
,
string
network
)
{
{
Mnemonic
mnemonic
;
Mnemonic
mnemonic
=
this
.
walletManager
.
CreateWallet
(
password
,
Path
.
Combine
(
folderPath
,
$"
{
name
}
.json"
),
WalletHelpers
.
GetNetwork
(
network
),
password
);
Safe
wallet
=
Safe
.
Create
(
out
mnemonic
,
password
,
Path
.
Combine
(
folderPath
,
$"
{
name
}
.json"
),
WalletHelpers
.
GetNetwork
(
network
));
return
mnemonic
.
ToString
();
return
mnemonic
.
ToString
();
}
}
...
@@ -36,14 +42,14 @@ namespace Breeze.Wallet.Wrappers
...
@@ -36,14 +42,14 @@ namespace Breeze.Wallet.Wrappers
/// <param name="name">The name of the wallet.</param>
/// <param name="name">The name of the wallet.</param>
/// <returns>The wallet loaded from the local device</returns>
/// <returns>The wallet loaded from the local device</returns>
public
WalletModel
Load
(
string
password
,
string
folderPath
,
string
name
)
public
WalletModel
Load
(
string
password
,
string
folderPath
,
string
name
)
{
{
Safe
wallet
=
Safe
.
Load
(
password
,
Path
.
Combine
(
folderPath
,
$"
{
name
}
.json"
));
Wallet
wallet
=
this
.
walletManager
.
LoadWallet
(
password
,
Path
.
Combine
(
folderPath
,
$"
{
name
}
.json"
));
//TODO review here which data should be returned
//TODO review here which data should be returned
return
new
WalletModel
return
new
WalletModel
{
{
Network
=
wallet
.
Network
.
Name
,
Network
=
wallet
.
Network
.
Name
,
Addresses
=
wallet
.
GetFirstNAddresses
(
10
).
Select
(
a
=>
a
.
ToWif
()),
//
Addresses = wallet.GetFirstNAddresses(10).Select(a => a.ToWif()),
FileName
=
wallet
.
WalletFilePath
FileName
=
wallet
.
WalletFilePath
};
};
}
}
...
@@ -59,13 +65,13 @@ namespace Breeze.Wallet.Wrappers
...
@@ -59,13 +65,13 @@ namespace Breeze.Wallet.Wrappers
/// <returns></returns>
/// <returns></returns>
public
WalletModel
Recover
(
string
password
,
string
folderPath
,
string
name
,
string
network
,
string
mnemonic
)
public
WalletModel
Recover
(
string
password
,
string
folderPath
,
string
name
,
string
network
,
string
mnemonic
)
{
{
Safe
wallet
=
Safe
.
Recover
(
new
Mnemonic
(
mnemonic
),
password
,
Path
.
Combine
(
folderPath
,
$"
{
name
}
.json"
),
WalletHelpers
.
GetNetwork
(
network
)
);
Wallet
wallet
=
this
.
walletManager
.
RecoverWallet
(
new
Mnemonic
(
mnemonic
),
password
,
Path
.
Combine
(
folderPath
,
$"
{
name
}
.json"
),
WalletHelpers
.
GetNetwork
(
network
),
password
);
//TODO review here which data should be returned
//TODO review here which data should be returned
return
new
WalletModel
return
new
WalletModel
{
{
Network
=
wallet
.
Network
.
Name
,
Network
=
wallet
.
Network
.
Name
,
Addresses
=
wallet
.
GetFirstNAddresses
(
10
).
Select
(
a
=>
a
.
ToWif
()),
//
Addresses = wallet.GetFirstNAddresses(10).Select(a => a.ToWif()),
FileName
=
wallet
.
WalletFilePath
FileName
=
wallet
.
WalletFilePath
};
};
}
}
...
...
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