Skip to content

Commit

Permalink
feat: ethereum api & sdk provider through dApp (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorux0 authored Jan 11, 2024
1 parent f517c6b commit bac0543
Show file tree
Hide file tree
Showing 114 changed files with 827 additions and 543 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
using DCL.Browser;
using DCL.Diagnostics;
using DCL.Profiles;
using DCL.Web3Authentication;
using DCL.Web3Authentication.Authenticators;
using DCL.Web3Authentication.Identities;
using DCL.Web3.Authenticators;
using DCL.Web3.Identities;
using MVC;
using System;
using System.Threading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
using DCL.DebugUtilities;
using DCL.DebugUtilities.UIBindings;
using DCL.Diagnostics;
using DCL.Web3Authentication;
using DCL.Web3Authentication.Authenticators;
using DCL.Web3.Authenticators;
using ECS;
using ECS.Abstract;
using MVC;
Expand Down
2 changes: 1 addition & 1 deletion Explorer/Assets/DCL/Backpack/AvatarController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using DCL.AssetsProvision;
using DCL.Backpack.BackpackBus;
using DCL.UI;
using DCL.Web3Authentication.Identities;
using DCL.Web3.Identities;
using System;
using System.Threading;
using UnityEngine;
Expand Down
2 changes: 1 addition & 1 deletion Explorer/Assets/DCL/Backpack/BackpackControler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using DCL.Backpack.BackpackBus;
using DCL.Profiles;
using DCL.UI;
using DCL.Web3Authentication.Identities;
using DCL.Web3.Identities;
using ECS.StreamableLoading.Common;
using System;
using System.Collections.Generic;
Expand Down
4 changes: 2 additions & 2 deletions Explorer/Assets/DCL/Backpack/BackpackGridController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
using DCL.AvatarRendering.Wearables.Components;
using DCL.AvatarRendering.Wearables.Components.Intentions;
using DCL.Backpack.BackpackBus;
using DCL.Web3Authentication.Identities;
using DCL.Web3.Identities;
using ECS.Prioritization.Components;
using ECS.StreamableLoading.Common;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using UnityEngine.Pool;
using Utility;
using Object = UnityEngine.Object;
using ParamPromise = ECS.StreamableLoading.Common.AssetPromise<DCL.AvatarRendering.Wearables.Components.IWearable[], DCL.AvatarRendering.Wearables.Components.Intentions.GetWearableByParamIntention>;

namespace DCL.Backpack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using DCL.PlacesAPIService;
using DCL.Profiles;
using DCL.Settings;
using DCL.Web3Authentication.Identities;
using DCL.Web3.Identities;
using DCL.WebRequests;
using Global.Dynamic;
using MVC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
using DCL.Browser;
using DCL.DebugUtilities;
using DCL.Profiles;
using DCL.Web3Authentication;
using DCL.Web3Authentication.Authenticators;
using DCL.Web3Authentication.Identities;
using DCL.Web3.Authenticators;
using DCL.Web3.Identities;
using ECS;
using MVC;
using System;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
using Cysharp.Threading.Tasks;
using DCL.PluginSystem;
using DCL.PluginSystem.World;
using DCL.Web3Authentication.Authenticators;
using DCL.Web3Authentication.Identities;
using DCL.Web3;
using DCL.Web3.Authenticators;
using DCL.Web3.Identities;
using ECS.Prioritization.Components;
using ECS.StreamableLoading.AudioClips;
using Global;
using NSubstitute;
using NUnit.Framework;
using SceneRunner;
using UnityEngine.TestTools;
using System.Collections;
using SceneRunner.Scene;
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -81,7 +82,8 @@ private async UniTask InitializationFlowAsync(CancellationToken ct)

SceneSharedContainer sceneSharedContainer;

(staticContainer, sceneSharedContainer) = await InstallAsync(globalPluginSettings, scenePluginSettings, identityCache, ct);
(staticContainer, sceneSharedContainer) = await InstallAsync(globalPluginSettings, scenePluginSettings, identityCache,
Substitute.For<IEthereumApi>(), ct);

currentScene = await sceneSharedContainer
.SceneFactory
Expand All @@ -97,14 +99,14 @@ private async UniTask InitializationFlowAsync(CancellationToken ct)
}
}

private static async UniTask<(StaticContainer staticContainer, SceneSharedContainer sceneSharedContainer)> InstallAsync(
IPluginSettingsContainer globalSettingsContainer,
private static async UniTask<(StaticContainer staticContainer, SceneSharedContainer sceneSharedContainer)> InstallAsync(IPluginSettingsContainer globalSettingsContainer,
IPluginSettingsContainer sceneSettingsContainer,
IWeb3IdentityCache web3IdentityCache,
IEthereumApi ethereumApi,
CancellationToken ct)
{
// First load the common global plugin
(StaticContainer staticContainer, bool isLoaded) = await StaticContainer.CreateAsync(globalSettingsContainer, web3IdentityCache, ct);
(StaticContainer staticContainer, bool isLoaded) = await StaticContainer.CreateAsync(globalSettingsContainer, web3IdentityCache, ethereumApi, ct);

if (!isLoaded)
GameReports.PrintIsDead();
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace DCL.Web3Authentication.Accounts
namespace DCL.Web3.Accounts
{
public interface IWeb3Account
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Nethereum.Signer;

namespace DCL.Web3Authentication.Accounts
namespace DCL.Web3.Accounts
{
public class NethereumAccount : IWeb3Account
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace DCL.Web3.Authenticators
{
public partial class DappWeb3Authenticator
{
[Serializable]
private struct LoginResponse
{
public string requestId;
public string result;
public string sender;
}

[Serializable]
private struct MethodResponse<T>
{
public string requestId;
public T result;
public string sender;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using DCL.Web3.Chains;
using System;

namespace DCL.Web3.Authenticators
{
public partial class DappWeb3Authenticator
{
[Serializable]
private struct AuthorizedEthApiRequest
{
public string method;
public object[] @params;
public AuthLink[] authChain;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace DCL.Web3Authentication.Authenticators
namespace DCL.Web3.Authenticators
{
public partial class DappWeb3Authenticator
{
Expand All @@ -10,6 +10,7 @@ private struct SignatureIdResponse
public string requestId;
public string? expiration;
public int code;
public string? error;
}
}
}
Loading

0 comments on commit bac0543

Please sign in to comment.