Skip to content

Commit 18686f7

Browse files
committed
Hope.Ethereum.Unity bug fixes
1 parent 08eeead commit 18686f7

File tree

7 files changed

+24
-29
lines changed

7 files changed

+24
-29
lines changed
Binary file not shown.

Hope.Ethereum/Hope.Ethereum.Unity.Tests/Assets/Test.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,10 @@ private void Start()
1818

1919
private void FakeERC20Test()
2020
{
21-
QuerySymbol().OnSuccess(_ => Debug.Log("Success")).OnError(_ => Debug.Log("Error"));
22-
//ERC20 erc20 = new ERC20("0x0000000000000000000000000000000000000000");
23-
//erc20.OnInitializationSuccessful(() => Debug.Log("Initialization Successful"));
24-
//erc20.OnInitializationUnsuccessful(() => Debug.Log("Initialization Unsuccessful"));
25-
}
26-
27-
public EthCallPromise<string> QuerySymbol()
28-
{
29-
EthCallPromise<string> promise = new EthCallPromise<string>();
30-
SimpleContractQueries.QueryStringOutput(new ERC20.Queries.Symbol(), "0x0000000000000000000000000000000000000000", null)
31-
.OnSuccess(symbol => promise.Build(() => symbol?.Value))
32-
.OnError(error => promise.Build(() => "error", () => error));
33-
34-
return promise;
21+
// Attempt to initialize a fake ERC20 token will result in OnInitializationUnsuccessful.
22+
ERC20 erc20 = new ERC20("0x0000000000000000000000000000000000000000");
23+
erc20.OnInitializationSuccessful(() => Debug.Log("Initialization Successful"));
24+
erc20.OnInitializationUnsuccessful(() => Debug.Log("Initialization Unsuccessful"));
3525
}
3626

3727
private void ERC721Tests()

Hope.Ethereum/Hope.Ethereum.Unity.Tests/Library/CurrentLayout.dwlt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ MonoBehaviour:
109109
m_MinSize: {x: 483, y: 162}
110110
m_MaxSize: {x: 12008, y: 8042}
111111
vertical: 0
112-
controlID: 105
112+
controlID: 26
113113
--- !u!114 &6
114114
MonoBehaviour:
115115
m_ObjectHideFlags: 52
@@ -133,7 +133,7 @@ MonoBehaviour:
133133
m_MinSize: {x: 206, y: 162}
134134
m_MaxSize: {x: 8006, y: 8042}
135135
vertical: 1
136-
controlID: 50
136+
controlID: 27
137137
--- !u!114 &7
138138
MonoBehaviour:
139139
m_ObjectHideFlags: 52
@@ -157,7 +157,7 @@ MonoBehaviour:
157157
m_MinSize: {x: 206, y: 121}
158158
m_MaxSize: {x: 8006, y: 4021}
159159
vertical: 0
160-
controlID: 51
160+
controlID: 28
161161
--- !u!114 &8
162162
MonoBehaviour:
163163
m_ObjectHideFlags: 52
@@ -202,8 +202,8 @@ MonoBehaviour:
202202
y: 0
203203
width: 196
204204
height: 414
205-
m_MinSize: {x: 104, y: 41}
206-
m_MaxSize: {x: 4004, y: 4021}
205+
m_MinSize: {x: 100, y: 20}
206+
m_MaxSize: {x: 4000, y: 4000}
207207
m_ActualView: {fileID: 14}
208208
m_Panes:
209209
- {fileID: 14}
@@ -253,8 +253,8 @@ MonoBehaviour:
253253
y: 0
254254
width: 377
255255
height: 771
256-
m_MinSize: {x: 277, y: 71}
257-
m_MaxSize: {x: 4002, y: 4021}
256+
m_MinSize: {x: 275, y: 50}
257+
m_MaxSize: {x: 4000, y: 4000}
258258
m_ActualView: {fileID: 17}
259259
m_Panes:
260260
- {fileID: 17}
@@ -445,9 +445,9 @@ MonoBehaviour:
445445
m_PersistentViewDataDictionary: {fileID: 0}
446446
m_TreeViewState:
447447
scrollPos: {x: 0, y: 0}
448-
m_SelectedIDs: b4290000
449-
m_LastClickedID: 10676
450-
m_ExpandedIDs: d6f9ffff00000000
448+
m_SelectedIDs:
449+
m_LastClickedID: 0
450+
m_ExpandedIDs: 98fbffff00000000
451451
m_RenameOverlay:
452452
m_UserAcceptedRename: 0
453453
m_Name:
@@ -521,7 +521,7 @@ MonoBehaviour:
521521
scrollPos: {x: 0, y: 0}
522522
m_SelectedIDs: 70290000
523523
m_LastClickedID: 10608
524-
m_ExpandedIDs: 0000000038290000
524+
m_ExpandedIDs: 00000000be270000
525525
m_RenameOverlay:
526526
m_UserAcceptedRename: 0
527527
m_Name:
@@ -549,7 +549,7 @@ MonoBehaviour:
549549
scrollPos: {x: 0, y: 0}
550550
m_SelectedIDs: c2060000
551551
m_LastClickedID: 1730
552-
m_ExpandedIDs: 0000000038290000
552+
m_ExpandedIDs: 00000000be270000
553553
m_RenameOverlay:
554554
m_UserAcceptedRename: 0
555555
m_Name:
Binary file not shown.

Hope.Ethereum/Hope.Ethereum.Unity/src/Contracts/Concrete/Tokens/Abstract/Token.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@ protected Token(string mainnetAddress, string rinkebyAddress, string name, strin
6262

6363
protected Token(string mainnetAddress, string rinkebyAddress) : base(mainnetAddress, rinkebyAddress)
6464
{
65-
QueryName().OnSuccess(name => Name = name).OnSuccess(_ => CheckInitializationStatus());
66-
QuerySymbol().OnSuccess(symbol => Symbol = symbol).OnSuccess(_ => CheckInitializationStatus());
67-
QueryDecimals().OnSuccess(decimals => Decimals = decimals).OnSuccess(_ => CheckInitializationStatus());
65+
InitializationQuery(QueryName, name => Name = name, _ => Name = null);
66+
InitializationQuery(QuerySymbol, symbol => Symbol = symbol, _ => Symbol = null);
67+
InitializationQuery(QueryDecimals, decimals => Decimals = decimals, _ => Decimals = null);
68+
}
69+
70+
private void InitializationQuery<T>(Func<EthCallPromise<T>> query, Action<T> onSuccess, Action<string> onError)
71+
{
72+
query().OnSuccess(onSuccess).OnError(onError).OnSuccess(_ => CheckInitializationStatus()).OnError(_ => CheckInitializationStatus());
6873
}
6974

7075
public void OnInitializationSuccessful(Action onInitializationSuccessful)

0 commit comments

Comments
 (0)