Skip to content

Commit 669aafc

Browse files
authored
Merge pull request #62 from ethereum-boilerplate/bugs/web3gl-native-fix
Remove Speedy Node Requirement and Defects
2 parents bdbcfdc + efef1bd commit 669aafc

22 files changed

+262
-55
lines changed

Assembly-CSharp.Player.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<LangVersion>8.0</LangVersion>
4+
<LangVersion>latest</LangVersion>
55
</PropertyGroup>
66
<PropertyGroup>
77
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -52,9 +52,6 @@
5252
<UnityBuildTarget>WebGL:20</UnityBuildTarget>
5353
<UnityVersion>2020.3.26f1</UnityVersion>
5454
</PropertyGroup>
55-
<ItemGroup>
56-
<Analyzer Include="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
57-
</ItemGroup>
5855
<ItemGroup>
5956
<Compile Include="Assets\MoralisWeb3ApiSdk\Example\Scripts\NftObjectController.cs" />
6057
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.BlockchainProcessing\BlockStorage\Repositories\ITransactionVMStackRepository.cs" />
@@ -230,6 +227,7 @@
230227
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.SolanaApi\Client\ApiException.cs" />
231228
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Contracts\ContractHandlers\IContractTransactionHandler.cs" />
232229
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\MoralisDotNet\Platform\Abstractions\IInstallationService.cs" />
230+
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.WebGL\Moralis.Web3Api.Core\Models\LogEventResponse.cs" />
233231
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Contracts\TransactionHandlers\MultiSend\MultiSend.cs" />
234232
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.BlockchainProcessing\Orchestrator\OrchestrationProgress.cs" />
235233
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.JsonRpc.Client\IRpcRequestHandler.cs" />
@@ -355,6 +353,7 @@
355353
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.SolanaApi\Models\NftMetadata.cs" />
356354
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Signer\SignedTransactionBase.cs" />
357355
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Hex\HexConvertors\IHexConvertor.cs" />
356+
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.Web3Api.Core\Models\LogEventResponse.cs" />
358357
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Contracts\Exceptions\FilterInputNotForEventException.cs" />
359358
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.SolanaApi\Models\CloudFunctionResult.cs" />
360359
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.ABI\Model\ContractABI.cs" />
@@ -1262,6 +1261,7 @@
12621261
<Compile Include="Assets\MoralisWeb3ApiSdk\WalletConnectSharp\WalletConnectSharp.Core\Models\WCSessionUpdate.cs" />
12631262
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.WebGL\Moralis.SolanaApi\Interfaces\IAccountApi.cs" />
12641263
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\MoralisDotNet\Platform\Services\ServiceHub.cs" />
1264+
<Compile Include="Assets\MoralisWeb3ApiSdk\DeadRpcReadClient.cs" />
12651265
</ItemGroup>
12661266
<ItemGroup>
12671267
<None Include="Assets\MoralisWeb3ApiSdk\Example\3rdParty\TextMesh Pro\Shaders\TMPro.cginc" />

Assembly-CSharp.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<LangVersion>8.0</LangVersion>
4+
<LangVersion>latest</LangVersion>
55
</PropertyGroup>
66
<PropertyGroup>
77
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -52,9 +52,6 @@
5252
<UnityBuildTarget>WebGL:20</UnityBuildTarget>
5353
<UnityVersion>2020.3.26f1</UnityVersion>
5454
</PropertyGroup>
55-
<ItemGroup>
56-
<Analyzer Include="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
57-
</ItemGroup>
5855
<ItemGroup>
5956
<Compile Include="Assets\MoralisWeb3ApiSdk\Example\Scripts\NftObjectController.cs" />
6057
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.BlockchainProcessing\BlockStorage\Repositories\ITransactionVMStackRepository.cs" />
@@ -230,6 +227,7 @@
230227
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.SolanaApi\Client\ApiException.cs" />
231228
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Contracts\ContractHandlers\IContractTransactionHandler.cs" />
232229
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\MoralisDotNet\Platform\Abstractions\IInstallationService.cs" />
230+
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.WebGL\Moralis.Web3Api.Core\Models\LogEventResponse.cs" />
233231
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Contracts\TransactionHandlers\MultiSend\MultiSend.cs" />
234232
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.BlockchainProcessing\Orchestrator\OrchestrationProgress.cs" />
235233
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.JsonRpc.Client\IRpcRequestHandler.cs" />
@@ -355,6 +353,7 @@
355353
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.SolanaApi\Models\NftMetadata.cs" />
356354
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Signer\SignedTransactionBase.cs" />
357355
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Hex\HexConvertors\IHexConvertor.cs" />
356+
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.Web3Api.Core\Models\LogEventResponse.cs" />
358357
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.Contracts\Exceptions\FilterInputNotForEventException.cs" />
359358
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.SolanaApi\Models\CloudFunctionResult.cs" />
360359
<Compile Include="Assets\MoralisWeb3ApiSdk\Nethereum\Nethereum.ABI\Model\ContractABI.cs" />
@@ -1262,6 +1261,7 @@
12621261
<Compile Include="Assets\MoralisWeb3ApiSdk\WalletConnectSharp\WalletConnectSharp.Core\Models\WCSessionUpdate.cs" />
12631262
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\Moralis.WebGL\Moralis.SolanaApi\Interfaces\IAccountApi.cs" />
12641263
<Compile Include="Assets\MoralisWeb3ApiSdk\Moralis\MoralisDotNet\Platform\Services\ServiceHub.cs" />
1264+
<Compile Include="Assets\MoralisWeb3ApiSdk\DeadRpcReadClient.cs" />
12651265
</ItemGroup>
12661266
<ItemGroup>
12671267
<None Include="Assets\MoralisWeb3ApiSdk\Example\3rdParty\TextMesh Pro\Shaders\TMPro.cginc" />
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Nethereum.JsonRpc.Client;
4+
5+
namespace MoralisWeb3ApiSdk
6+
{
7+
/// <summary>
8+
///
9+
/// </summary>
10+
public class DeadRpcReadClient : IClient
11+
{
12+
private Action<string> messageHandler;
13+
public DeadRpcReadClient(Action<string> msgHandler)
14+
{
15+
messageHandler = msgHandler;
16+
}
17+
18+
public RequestInterceptor OverridingRequestInterceptor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
19+
20+
public Task<T> SendRequestAsync<T>(RpcRequest request, string route = null)
21+
{
22+
if (messageHandler != null)
23+
{
24+
messageHandler($"Method {request.Method} is not supported by this RPC handler");
25+
}
26+
27+
return null;
28+
}
29+
30+
public Task<T> SendRequestAsync<T>(string method, string route = null, params object[] paramList)
31+
{
32+
if (messageHandler != null)
33+
{
34+
messageHandler($"Method {method} is not supported by this RPC handler");
35+
}
36+
37+
return null;
38+
}
39+
40+
public Task SendRequestAsync(RpcRequest request, string route = null)
41+
{
42+
if (messageHandler != null)
43+
{
44+
messageHandler($"Method {request.Method} is not supported by this RPC handler");
45+
}
46+
47+
return null;
48+
}
49+
50+
public Task SendRequestAsync(string method, string route = null, params object[] paramList)
51+
{
52+
if (messageHandler != null)
53+
{
54+
messageHandler($"Method {method} is not supported by this RPC handler");
55+
}
56+
57+
return null;
58+
}
59+
}
60+
}

Assets/MoralisWeb3ApiSdk/DeadRpcReadClient.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.Web3Api.Core/Interfaces/INativeApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public interface INativeApi
114114
/// <param name="offset">offset</param>
115115
/// <param name="limit">limit</param>
116116
/// <returns>Returns a collection of events by topic</returns>
117-
Task<List<LogEvent>> GetContractEvents (string address, string topic, RunContractDto abi, ChainList chain, string subdomain=null, string providerUrl=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null);
117+
Task<List<LogEvent>> GetContractEvents (string address, string topic, object abi, ChainList chain, string subdomain=null, string providerUrl=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null);
118118

119119
/// <summary>
120120
/// Runs a given function of a contract abi and returns readonly data

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.Web3Api.Core/Interfaces/INativeApi.cs.bak.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Runtime.Serialization;
4+
using System.Text;
5+
using Moralis.Web3Api.Models;
6+
using Newtonsoft.Json;
7+
8+
namespace Moralis.Web3Api.Models
9+
{
10+
[DataContract]
11+
public class LogEventResponse
12+
{
13+
[DataMember(Name = "total", EmitDefaultValue = true)]
14+
[JsonProperty(PropertyName = "total")]
15+
public long Total { get; set; }
16+
17+
[DataMember(Name = "page", EmitDefaultValue = true)]
18+
[JsonProperty(PropertyName = "page")]
19+
public long Page { get; set; }
20+
21+
[DataMember(Name = "page_size", EmitDefaultValue = true)]
22+
[JsonProperty(PropertyName = "page_size")]
23+
public long PageSize { get; set; }
24+
25+
[DataMember(Name = "result", EmitDefaultValue = true)]
26+
[JsonProperty(PropertyName = "result")]
27+
public List<LogEvent> Events { get; set; }
28+
}
29+
}

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.Web3Api.Core/Models/LogEventResponse.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.Web3Api/Api/NativeApi.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public async Task<BlockTransaction> GetTransaction (string transactionHash, Chai
359359
/// <param name="offset">offset</param>
360360
/// <param name="limit">limit</param>
361361
/// <returns>Returns a collection of events by topic</returns>
362-
public async Task<List<LogEvent>> GetContractEvents (string address, string topic, RunContractDto abi, ChainList chain, string subdomain=null, string providerUrl=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null)
362+
public async Task<List<LogEvent>> GetContractEvents (string address, string topic, object abi, ChainList chain, string subdomain=null, string providerUrl=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null)
363363
{
364364

365365
// Verify the required parameter 'address' is set
@@ -380,8 +380,6 @@ public async Task<List<LogEvent>> GetContractEvents (string address, string topi
380380
var path = "/{address}/events";
381381
path = path.Replace("{format}", "json");
382382
path = path.Replace("{" + "address" + "}", ApiClient.ParameterToString(address));
383-
if (abi != null) postBody.Add("abi", abi.Abi);
384-
if (abi != null) postBody.Add("params", abi.Params);
385383
if (topic != null) queryParams.Add("topic", ApiClient.ParameterToString(topic));
386384
if(chain != null) queryParams.Add("chain", ApiClient.ParameterToHex((long)chain));
387385
if(subdomain != null) queryParams.Add("subdomain", ApiClient.ParameterToString(subdomain));
@@ -396,7 +394,7 @@ public async Task<List<LogEvent>> GetContractEvents (string address, string topi
396394
// Authentication setting, if any
397395
String[] authSettings = new String[] { "ApiKeyAuth" };
398396

399-
string bodyData = postBody.Count > 0 ? JsonConvert.SerializeObject(postBody) : null;
397+
string bodyData = JsonConvert.SerializeObject(abi);
400398

401399
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.POST, queryParams, bodyData, headerParams, formParams, fileParams, authSettings));
402400

@@ -405,7 +403,9 @@ public async Task<List<LogEvent>> GetContractEvents (string address, string topi
405403
else if (((int)response.StatusCode) == 0)
406404
throw new ApiException((int)response.StatusCode, "Error calling GetContractEvents: " + response.ErrorMessage, response.ErrorMessage);
407405

408-
return (List<LogEvent>)ApiClient.Deserialize(response.Content, typeof(List<LogEvent>), response.Headers);
406+
LogEventResponse resp = (LogEventResponse)ApiClient.Deserialize(response.Content, typeof(LogEventResponse), response.Headers);
407+
408+
return resp.Events;
409409
}
410410
/// <summary>
411411
/// Runs a given function of a contract abi and returns readonly data

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.Web3Api/Api/NativeApi.cs.bak.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)