This repository has been archived by the owner on Aug 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce WalletAccountReference type
- Loading branch information
1 parent
845f7b7
commit b7785f3
Showing
7 changed files
with
109 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Stratis.Bitcoin.Wallet | ||
{ | ||
public class WalletAccountReference | ||
{ | ||
public WalletAccountReference() | ||
{ | ||
|
||
} | ||
public WalletAccountReference(string walletName, string accountName) | ||
{ | ||
if(walletName == null) | ||
throw new ArgumentNullException("walletName"); | ||
if(accountName == null) | ||
throw new ArgumentNullException("accountName"); | ||
this.WalletName = walletName; | ||
this.AccountName = accountName; | ||
} | ||
|
||
public string WalletName | ||
{ | ||
get; set; | ||
} | ||
|
||
public string AccountName | ||
{ | ||
get; set; | ||
} | ||
|
||
|
||
public override bool Equals(object obj) | ||
{ | ||
WalletAccountReference item = obj as WalletAccountReference; | ||
if(item == null) | ||
return false; | ||
return GetId().Equals(item.GetId()); | ||
} | ||
public static bool operator ==(WalletAccountReference a, WalletAccountReference b) | ||
{ | ||
if(System.Object.ReferenceEquals(a, b)) | ||
return true; | ||
if(((object)a == null) || ((object)b == null)) | ||
return false; | ||
return a.GetId().Equals(b.GetId()); | ||
} | ||
|
||
public static bool operator !=(WalletAccountReference a, WalletAccountReference b) | ||
{ | ||
return !(a == b); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return GetId().GetHashCode(); | ||
} | ||
|
||
Tuple<string, string> GetId() | ||
{ | ||
return Tuple.Create(this.WalletName, this.AccountName); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"{WalletName}:{AccountName}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters