Skip to content

Commit d765e47

Browse files
authored
Merge pull request #91 from ethereum-boilerplate/bugs/issue_81
Bugs/issue 81
2 parents 3851483 + 1db3cc4 commit d765e47

File tree

68 files changed

+1798
-1025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1798
-1025
lines changed
-187 KB
Binary file not shown.

Assets/MoralisWeb3ApiSdk/Example/DemoScene.unity

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18732,7 +18732,7 @@ MonoBehaviour:
1873218732
wallets:
1873318733
- Id: 09102e7bbbd3f92001eda104abe23803181629f695e8f1b95af96d88ff7d5890
1873418734
Name: 1inch Wallet
18735-
Selected: 0
18735+
Selected: 1
1873618736
- Id: a0718f5fb1493e4aaac72cff62d162cb85db40ed68fd8700298f36f1d5c4b73d
1873718737
Name: AirGap
1873818738
Selected: 0
@@ -18819,7 +18819,7 @@ MonoBehaviour:
1881918819
Selected: 0
1882018820
- Id: f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d
1882118821
Name: Crypto.com | DeFi Wallet
18822-
Selected: 0
18822+
Selected: 1
1882318823
- Id: a395dbfc92b5519cbd1cc6937a4e79830187daaeb2c6fcdf9b9cce4255f2dcd5
1882418824
Name: CYBAVO Wallet
1882518825
Selected: 0
@@ -18885,10 +18885,10 @@ MonoBehaviour:
1888518885
Selected: 0
1888618886
- Id: bae74827272509a6d63ea25514d9c68ad235c14e45e183518c7ded4572a1b0c4
1888718887
Name: Huobi Wallet
18888-
Selected: 0
18888+
Selected: 1
1888918889
- Id: 9d373b43ad4d2cf190fb1a774ec964a1addf406d6fd24af94ab7596e58c291b2
1889018890
Name: imToken
18891-
Selected: 0
18891+
Selected: 1
1889218892
- Id: d0387325e894a1c4244820260ad7c78bb20d79eeec2fd59ffe3529223f3f84c6
1889318893
Name: Infinito
1889418894
Selected: 0
@@ -18927,7 +18927,7 @@ MonoBehaviour:
1892718927
Selected: 0
1892818928
- Id: c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96
1892918929
Name: MetaMask
18930-
Selected: 0
18930+
Selected: 1
1893118931
- Id: 1e04cf5cddcd84edb1370b12eae1fcecedf125b77209fff80e7ef2a6d3c74719
1893218932
Name: Midas Wallet
1893318933
Selected: 0
@@ -18975,7 +18975,7 @@ MonoBehaviour:
1897518975
Selected: 0
1897618976
- Id: 1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369
1897718977
Name: Rainbow
18978-
Selected: 0
18978+
Selected: 1
1897918979
- Id: b13fcc7e3500a4580c9a5341ed64c49c17d7f864497881048eb160c089be5346
1898018980
Name: RWallet
1898118981
Selected: 0
@@ -19023,7 +19023,7 @@ MonoBehaviour:
1902319023
Selected: 0
1902419024
- Id: 4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0
1902519025
Name: Trust Wallet
19026-
Selected: 0
19026+
Selected: 1
1902719027
- Id: 1ce6dae0fea7114846382391d946784d95d9032460a857bb23b55bd9807259d1
1902819028
Name: Trustee Wallet
1902919029
Selected: 0
@@ -47690,6 +47690,10 @@ PrefabInstance:
4769047690
m_Modification:
4769147691
m_TransformParent: {fileID: 0}
4769247692
m_Modifications:
47693+
- target: {fileID: 6266890725912523073, guid: 116667ed98661304da1568439e2a3426, type: 3}
47694+
propertyPath: Version
47695+
value: 1.0.9
47696+
objectReference: {fileID: 0}
4769347697
- target: {fileID: 6266890725912523073, guid: 116667ed98661304da1568439e2a3426, type: 3}
4769447698
propertyPath: walletConnect
4769547699
value:

Assets/MoralisWeb3ApiSdk/Example/Scripts/AwardableController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private async UniTask ClaimRewardAsync()
160160

161161
// Set gas estimate
162162
HexBigInteger gas = new HexBigInteger(0);
163-
string resp = await MoralisInterface.ExecuteFunction(Constants.MUG_CONTRACT_ADDRESS, Constants.MUG_ABI, Constants.MUG_CLAIM_FUNCTION, pars, new HexBigInteger("0x0"), gas, gas);
163+
string resp = await MoralisInterface.ExecuteContractFunction(Constants.MUG_CONTRACT_ADDRESS, Constants.MUG_ABI, Constants.MUG_CLAIM_FUNCTION, pars, new HexBigInteger("0x0"), gas, gas);
164164
#else
165165

166166
// Convert token id to hex as this is what the contract call expects

Assets/MoralisWeb3ApiSdk/Example/Scripts/MainMenuScript.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
using Moralis.WebGL;
4444
using Moralis.WebGL.Platform;
4545
using Moralis.WebGL.Platform.Objects;
46+
using Moralis.WebGL.Platform.Services.ClientServices;
4647
using Moralis.WebGL.Web3Api.Models;
4748
#else
4849
using System.Threading.Tasks;
@@ -106,6 +107,12 @@ async void Start()
106107
}
107108
}
108109

110+
#if UNITY_WEBGL
111+
private void FixedUpdate()
112+
{
113+
MoralisLiveQueryManager.UpdateWebSockets();
114+
}
115+
#endif
109116
/// <summary>
110117
/// Used to start the authentication process and then run the game. If the
111118
/// user has a valid Moralis session thes user is redirected to the next
@@ -273,12 +280,12 @@ public async void Quit()
273280
{
274281
Debug.Log("QUIT");
275282

283+
// Logout the Moralis User.
284+
await MoralisInterface.LogOutAsync();
276285
// Disconnect wallet subscription.
277286
await walletConnect.Session.Disconnect();
278287
// CLear out the session so it is re-establish on sign-in.
279288
walletConnect.CLearSession();
280-
// Logout the Moralis User.
281-
await MoralisInterface.LogOutAsync();
282289
// Close out the application.
283290
Application.Quit();
284291
}

Assets/MoralisWeb3ApiSdk/Example/Scripts/MouseLook.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2626
* SOFTWARE.
2727
*/
28+
using MoralisWeb3ApiSdk;
2829
using System;
2930
using UnityEngine;
3031

@@ -54,7 +55,10 @@ void Start()
5455
// Update is called once per frame
5556
void Update()
5657
{
57-
Rotate();
58+
if (MoralisInterface.IsLoggedIn())
59+
{
60+
Rotate();
61+
}
5862
}
5963

6064
public void JoystickInput(Vector2 vector2)

Assets/MoralisWeb3ApiSdk/Example/Scripts/PlayerController.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ private async void Update()
8686
isAuthenticated = true;
8787
}
8888
}
89-
90-
Move();
91-
92-
if (Input.GetKeyDown(KeyCode.Mouse0))
89+
else
9390
{
94-
StartCoroutine(Attack());
91+
Move();
92+
93+
if (Input.GetKeyDown(KeyCode.Mouse0))
94+
{
95+
StartCoroutine(Attack());
96+
}
9597
}
9698
}
9799

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.SolanaApi/Api/AccountApi.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Moralis.SolanaApi.Client;
22
using Moralis.SolanaApi.Interfaces;
33
using Moralis.SolanaApi.Models;
4-
using RestSharp;
54
using System;
65
using System.Collections.Generic;
6+
using System.Net.Http;
77
using System.Threading.Tasks;
88

99
namespace Moralis.SolanaApi.Api
@@ -72,14 +72,15 @@ public async Task<NativeBalance> Balance(NetworkTypes network, string address)
7272
// Authentication setting, if any
7373
String[] authSettings = new String[] { "ApiKeyAuth" };
7474

75-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
75+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
76+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
7677

7778
if (((int)response.StatusCode) >= 400)
7879
throw new ApiException((int)response.StatusCode, "Error calling Balance: " + response.Content, response.Content);
7980
else if (((int)response.StatusCode) == 0)
80-
throw new ApiException((int)response.StatusCode, "Error calling Balance: " + response.ErrorMessage, response.ErrorMessage);
81+
throw new ApiException((int)response.StatusCode, "Error calling Balance: " + response.ReasonPhrase, response.ReasonPhrase);
8182

82-
return (NativeBalance)ApiClient.Deserialize(response.Content, typeof(NativeBalance), response.Headers);
83+
return (NativeBalance)(await ApiClient.Deserialize(response.Content, typeof(NativeBalance), response.Headers));
8384

8485
}
8586

@@ -97,14 +98,15 @@ public async Task<List<SplTokenBalanace>> GetSplTokens(NetworkTypes network, str
9798
// Authentication setting, if any
9899
String[] authSettings = new String[] { "ApiKeyAuth" };
99100

100-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
101+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
102+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
101103

102104
if (((int)response.StatusCode) >= 400)
103105
throw new ApiException((int)response.StatusCode, "Error calling GetSplTokens: " + response.Content, response.Content);
104106
else if (((int)response.StatusCode) == 0)
105-
throw new ApiException((int)response.StatusCode, "Error calling GetSplTokens: " + response.ErrorMessage, response.ErrorMessage);
107+
throw new ApiException((int)response.StatusCode, "Error calling GetSplTokens: " + response.ReasonPhrase, response.ReasonPhrase);
106108

107-
return (List<SplTokenBalanace>)ApiClient.Deserialize(response.Content, typeof(List<SplTokenBalanace>), response.Headers);
109+
return (List<SplTokenBalanace>)(await ApiClient.Deserialize(response.Content, typeof(List<SplTokenBalanace>), response.Headers));
108110
}
109111

110112
public async Task<List<SplNft>> GetNFTs(NetworkTypes network, string address)
@@ -121,14 +123,15 @@ public async Task<List<SplNft>> GetNFTs(NetworkTypes network, string address)
121123
// Authentication setting, if any
122124
String[] authSettings = new String[] { "ApiKeyAuth" };
123125

124-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
126+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
127+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
125128

126129
if (((int)response.StatusCode) >= 400)
127130
throw new ApiException((int)response.StatusCode, "Error calling GetNFTs: " + response.Content, response.Content);
128131
else if (((int)response.StatusCode) == 0)
129-
throw new ApiException((int)response.StatusCode, "Error calling GetNFTs: " + response.ErrorMessage, response.ErrorMessage);
132+
throw new ApiException((int)response.StatusCode, "Error calling GetNFTs: " + response.ReasonPhrase, response.ReasonPhrase);
130133

131-
return (List<SplNft>)ApiClient.Deserialize(response.Content, typeof(List<SplNft>), response.Headers);
134+
return (List<SplNft>)(await ApiClient .Deserialize(response.Content, typeof(List<SplNft>), response.Headers));
132135
}
133136

134137
public async Task<Portfolio> GetPortfolio(NetworkTypes network, string address)
@@ -145,14 +148,15 @@ public async Task<Portfolio> GetPortfolio(NetworkTypes network, string address)
145148
// Authentication setting, if any
146149
String[] authSettings = new String[] { "ApiKeyAuth" };
147150

148-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
151+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
152+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
149153

150154
if (((int)response.StatusCode) >= 400)
151155
throw new ApiException((int)response.StatusCode, "Error calling GetPortfolio: " + response.Content, response.Content);
152156
else if (((int)response.StatusCode) == 0)
153-
throw new ApiException((int)response.StatusCode, "Error calling GetPortfolio: " + response.ErrorMessage, response.ErrorMessage);
157+
throw new ApiException((int)response.StatusCode, "Error calling GetPortfolio: " + response.ReasonPhrase, response.ReasonPhrase);
154158

155-
return (Portfolio)ApiClient.Deserialize(response.Content, typeof(Portfolio), response.Headers);
159+
return (Portfolio)(await ApiClient.Deserialize(response.Content, typeof(Portfolio), response.Headers));
156160
}
157161
}
158162
}

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.SolanaApi/Api/NftApi.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Moralis.SolanaApi.Client;
22
using Moralis.SolanaApi.Interfaces;
33
using Moralis.SolanaApi.Models;
4-
using RestSharp;
54
using System;
65
using System.Collections.Generic;
6+
using System.Net.Http;
77
using System.Threading.Tasks;
88

99
namespace Moralis.SolanaApi.Api
@@ -73,14 +73,15 @@ public async Task<NftMetadata> GetNFTMetadata(NetworkTypes network, string addre
7373
// Authentication setting, if any
7474
String[] authSettings = new String[] { "ApiKeyAuth" };
7575

76-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
76+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
77+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
7778

7879
if (((int)response.StatusCode) >= 400)
7980
throw new ApiException((int)response.StatusCode, "Error calling GetNFTMetadata: " + response.Content, response.Content);
8081
else if (((int)response.StatusCode) == 0)
81-
throw new ApiException((int)response.StatusCode, "Error calling GetNFTMetadata: " + response.ErrorMessage, response.ErrorMessage);
82+
throw new ApiException((int)response.StatusCode, "Error calling GetNFTMetadata: " + response.ReasonPhrase, response.ReasonPhrase);
8283

83-
return (NftMetadata)ApiClient.Deserialize(response.Content, typeof(NftMetadata), response.Headers);
84+
return (NftMetadata)(await ApiClient.Deserialize(response.Content, typeof(NftMetadata), response.Headers)) ;
8485
}
8586
}
8687
}

0 commit comments

Comments
 (0)