这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ public virtual IEnumerator TearDown()

internal static ValueTask<Web3> BuildTestWeb3(Web3Builder.ConfigureServicesDelegate customConfiguration = null)
{
// Set project config, fallback is for github as it doesn't load
var projectConfigScriptableObject = ProjectConfigUtilities.Load();
if (projectConfigScriptableObject == null)
{
projectConfigScriptableObject = ProjectConfigUtilities.Create("3dc3e125-71c4-4511-a367-e981a6a94371", "11155111",
"Ethereum", "Sepolia", "Seth", "https://sepolia.infura.io/v3/287318045c6e455ab34b81d6bcd7a65f", "https://sepolia.etherscan.io/", false, "wss://sepolia.drpc.org");
}
var projectConfigScriptableObject = ProjectConfigUtilities.Create("3dc3e125-71c4-4511-a367-e981a6a94371",
"11155111",
"Ethereum", "Sepolia", "Seth", "https://sepolia.infura.io/v3/287318045c6e455ab34b81d6bcd7a65f",
"https://sepolia.etherscan.io/", false, "wss://sepolia.drpc.org");

// Create web3builder & assign services
var web3Builder = new Web3Builder(projectConfigScriptableObject).Configure(services =>
Expand Down
17 changes: 13 additions & 4 deletions src/ChainSafe.Gaming.Unity/UnityHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@ public UnityHttpClient(IMainThreadRunner mainThreadRunner)
/// <returns>Converted Network Response.</returns>
private static NetworkResponse<string> UnityWebRequestToNetworkResponse(UnityWebRequest request)
{
Assert.AreNotEqual(request.result, UnityWebRequest.Result.InProgress);

if (request.result != UnityWebRequest.Result.Success)
// Assert response is successful
{
throw new Web3Exception($"HTTP.{request.method} to {request.url} responded with error: {request.downloadHandler.text}");
Assert.AreNotEqual(UnityWebRequest.Result.InProgress, request.result);

if (request.result == UnityWebRequest.Result.ConnectionError)
{
throw new Web3Exception($"HTTP.{request.method} to '{request.url}' - connection error.");
}

if (request.result != UnityWebRequest.Result.Success)
{
throw new Web3Exception(
$"HTTP.{request.method} to '{request.url}' responded with error: {request.downloadHandler.text}");
}
}

return NetworkResponse<string>.Success(request.downloadHandler.text);
Expand Down