Skip to content

Commit 8243485

Browse files
author
nicehashdev
committed
Compatibility fix
NiceHashBot now compatible with NiceHash API v1.2.0
1 parent b7e46ba commit 8243485

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ $RECYCLE.BIN/
4141
Network Trash Folder
4242
Temporary Items
4343
.apdisk
44+
*.cache
45+
src/NHB.v12.suo
46+
*.exe
47+
src/NiceHashBot/bin/Debug/NiceHashBot.exe.config
48+
*.config
49+
src/NiceHashBot/bin/Debug/NiceHashBot.vshost.exe.manifest
50+
src/NiceHashBot/bin/Release/NiceHashBot.vshost.exe.manifest
51+
src/NiceHashBot/obj/x86/Debug/NiceHashBot.csproj.FileListAbsolute.txt

src/NiceHashBot/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.1.4")]
36-
[assembly: AssemblyFileVersion("1.0.1.4")]
35+
[assembly: AssemblyVersion("1.0.2.0")]
36+
[assembly: AssemblyFileVersion("1.0.2.0")]

src/NiceHashBotLib/APIWrapper.cs

+21-4
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ public class APIWrapper
1313
/// <summary>
1414
/// API Version compatible with.
1515
/// </summary>
16-
public readonly static string API_VERSION_COMPATIBLE = "1.0.10";
16+
public readonly static string API_VERSION_COMPATIBLE = "1.2.0";
1717

1818
/// <summary>
1919
/// URLs for NiceHash services.
2020
/// </summary>
21-
public readonly static string[] SERVICE_LOCATION = { "https://www.nicehash.com", "https://www.westhash.com" };
21+
public readonly static string SERVICE_LOCATION = "https://www.nicehash.com";
2222

2323
/// <summary>
2424
/// Names for NiceHash services.
2525
/// </summary>
26-
public readonly static string[] SERVICE_NAME = { "NiceHash", "WestHash" };
26+
public readonly static string[] SERVICE_NAME = { "Europe (NiceHash)", " USA (WestHash)" };
2727

2828
/// <summary>
2929
/// Names for algorithms.
@@ -161,6 +161,20 @@ public static List<Order> GetAllOrders(int ServiceLocation, int Algorithm, bool
161161
{
162162
CachedOList[ServiceLocation, Algorithm] = new CachedOrderList();
163163
CachedOList[ServiceLocation, Algorithm].OrderList = GetOrders(ServiceLocation, Algorithm, "orders.get", false);
164+
165+
// Get missing data for my orders
166+
List<Order> MyOrders = GetMyOrders(ServiceLocation, Algorithm);
167+
168+
// Fill missing data
169+
foreach (Order O1 in MyOrders)
170+
{
171+
foreach (Order O2 in CachedOList[ServiceLocation, Algorithm].OrderList)
172+
{
173+
if (O2.ID == O1.ID)
174+
O2.BTCAvailable = O1.BTCAvailable;
175+
}
176+
}
177+
164178
CachedOList[ServiceLocation, Algorithm].ObtainTime = DateTime.Now;
165179
}
166180

@@ -381,7 +395,7 @@ private static double GetTotalSpeedForAlgorithm(int ServiceLocation, int Algorit
381395

382396
private static T Request<T>(int ServiceLocation, string Method, bool AppendCredentials, Dictionary<string, string> Parameters)
383397
{
384-
string URL = SERVICE_LOCATION[ServiceLocation] + "/api";
398+
string URL = SERVICE_LOCATION + "/api";
385399

386400
if (Method != null)
387401
{
@@ -392,6 +406,9 @@ private static T Request<T>(int ServiceLocation, string Method, bool AppendCrede
392406
URL += "&key=" + APIKey;
393407
}
394408

409+
// Append location
410+
URL += "&location=" + ServiceLocation.ToString();
411+
395412
if (Parameters != null)
396413
{
397414
// Append all parameters

0 commit comments

Comments
 (0)