Skip to content

Commit 5b3838e

Browse files
authored
Merge pull request #7 from phantasma-io/dev
Merge Update
2 parents db22e54 + 898028f commit 5b3838e

File tree

6 files changed

+35
-10
lines changed

6 files changed

+35
-10
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[v.1.0.12]
2+
3+
- Updating the package version.
4+
- Fix issue when getting the Leaderboard.
5+
16
[v.1.0.10]
27

38
- Updating the package version.

Runtime/Phantasma/Plugins/Phantasma.Business/VM/DebugInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Collections.Generic;
22
using System.IO;
33
using System.Linq;
4-
using Newtonsoft.Json;
54
using Phantasma.Core.Utils;
65

76
namespace Phantasma.Business.VM
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
using System.Numerics;
2+
using LunarLabs.Parser;
23
using Phantasma.Core.Cryptography;
34

45
namespace Phantasma.Core.Domain
56
{
67
public struct LeaderboardRow
78
{
89
public Address address;
9-
public BigInteger score;
10+
public BigInteger value;
11+
12+
public static LeaderboardRow FromNode(DataNode node)
13+
{
14+
var row = new LeaderboardRow();
15+
row.address = Address.FromText(node.GetString("address"));
16+
row.value = BigInteger.Parse(node.GetString("value"));
17+
return row;
18+
}
1019
}
1120

1221
public struct Leaderboard
1322
{
1423
public string name;
15-
public Address owner;
16-
public BigInteger size;
17-
public BigInteger round;
24+
public LeaderboardRow[] rows;
25+
26+
public static Leaderboard FromNode(DataNode node)
27+
{
28+
var leaderboard = new Leaderboard();
29+
leaderboard.name = node.GetString("name");
30+
var rows = node.GetNode("rows");
31+
var list = new System.Collections.Generic.List<LeaderboardRow>();
32+
foreach (var row in rows.Children)
33+
{
34+
list.Add(LeaderboardRow.FromNode(row));
35+
}
36+
leaderboard.rows = list.ToArray();
37+
return leaderboard;
38+
}
1839
}
1940

2041
}

Runtime/Phantasma/Scripts/Example/ExampleLogin.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections;
22
using System.Collections.Generic;
3+
using Phantasma.SDK;
34
using TMPro;
45
using UnityEngine;
56
using UnityEngine.UI;
@@ -28,5 +29,4 @@ private void Login_OnLoginEvent(string msg, bool error)
2829
Debug.Log(msg);
2930
}
3031
}
31-
3232
}

Runtime/Phantasma/Scripts/PhantasmaAPI.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections;
33
using System.Globalization;
44
using System.Text;
5-
using Newtonsoft.Json;
65
using Phantasma.Core.Cryptography;
76
using Phantasma.Core.Domain;
87
using Phantasma.Core.Numerics;
@@ -350,8 +349,9 @@ public IEnumerator GetContracts(Action<Contract> callback, Action<EPHANTASMA_SDK
350349
/// <returns></returns>
351350
public IEnumerator GetLeaderboard(string name, Action<Leaderboard> callback, Action<EPHANTASMA_SDK_ERROR_TYPE, string> errorHandlingCallback = null)
352351
{
353-
yield return WebClient.RPCRequestJSON(Host, "getLeaderboard", WebClient.NoTimeout, errorHandlingCallback, (node) => {
354-
var result = JsonUtility.FromJson<Leaderboard>(node);
352+
yield return WebClient.RPCRequest(Host, "getLeaderboard", WebClient.NoTimeout, errorHandlingCallback, (node) =>
353+
{
354+
var result = Leaderboard.FromNode(node);
355355
callback(result);
356356
}, name);
357357
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.phantasma.phantasmalinkclient",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"displayName": "Phantasma Unity SDK",
55
"description": "Phantasma Unity SDK, use to connect to the Phantasma Blockchain",
66
"unity": "2020.3",

0 commit comments

Comments
 (0)