Skip to content

Commit 279f8c8

Browse files
committed
feat: Rename var names ChainConfig, network to web3AuthNetwork
Signed-off-by: Gaurav Goel <[email protected]>
1 parent 301fe71 commit 279f8c8

File tree

6 files changed

+22
-17
lines changed

6 files changed

+22
-17
lines changed

Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void Start()
107107
clientId = "BFuUqebV5I8Pz5F7a5A2ihW7YVmbv_OHXnHYDv6OltAD5NGr6e-ViNvde3U4BHdn6HvwfkgobhVu4VwC-OSJkik",
108108
authBuildEnv = BuildEnv.TESTING,
109109
redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity"),
110-
network = Web3Auth.Network.SAPPHIRE_DEVNET,
110+
web3AuthNetwork = Web3Auth.Network.SAPPHIRE_DEVNET,
111111
sessionTime = 86400
112112
});
113113
web3Auth.onLogin += onLogin;
@@ -259,14 +259,14 @@ private void manageMFA()
259259
private void showWalletUI() {
260260
var selectedProvider = verifierList[verifierDropdown.value].authConnection;
261261

262-
var chainConfig = new ChainsConfig()
262+
var chainConfig = new ChainConfig()
263263
{
264264
chainId = "0x1",
265265
rpcTarget = "https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0",
266266
ticker = "ETH",
267267
chainNamespace = Web3Auth.ChainNamespace.eip155
268268
};
269-
var chainConfigList = new List<ChainsConfig> { chainConfig };
269+
var chainConfigList = new List<ChainConfig> { chainConfig };
270270
foreach (var config in chainConfigList)
271271
{
272272
Debug.Log($"Chain ID: {config.chainId}, RPC Target: {config.rpcTarget}, Ticker: {config.ticker}, Namespace: {config.chainNamespace}");
@@ -277,7 +277,7 @@ private void showWalletUI() {
277277
private void request() {
278278
var selectedProvider = verifierList[verifierDropdown.value].authConnection;
279279

280-
var chainConfig = new ChainsConfig()
280+
var chainConfig = new ChainConfig()
281281
{
282282
chainId = "0x89",
283283
rpcTarget = "https://1rpc.io/matic",

Assets/Plugins/Web3AuthSDK/Types/ChainsConfig.cs renamed to Assets/Plugins/Web3AuthSDK/Types/ChainConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Newtonsoft.Json;
33
using Newtonsoft.Json.Converters;
44
#nullable enable
5-
public class ChainsConfig {
5+
public class ChainConfig {
66

77
[JsonConverter(typeof(StringEnumConverter))]
88
public Web3Auth.ChainNamespace? chainNamespace { get; set; } = Web3Auth.ChainNamespace.eip155;

Assets/Plugins/Web3AuthSDK/Types/UserInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public string groupedAuthConnectionId { get; set; }
77
public string authConnectionId { get; set; }
88
public string userId { get; set; }
9-
public string typeOfLogin { get; set; }
9+
public string authConnection { get; set; }
1010
public string dappShare { get; set; }
1111
public string idToken { get; set; }
1212
public string oAuthIdToken { get; set; }

Assets/Plugins/Web3AuthSDK/Types/Web3AuthOptions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using System;
22
using System.Collections.Generic;
3+
using Newtonsoft.Json;
34
#nullable enable
45

56
public class Web3AuthOptions {
67
public string clientId { get; set; }
7-
public Web3Auth.Network network { get; set; }
8+
[JsonProperty("network")]
9+
public Web3Auth.Network web3AuthNetwork { get; set; }
810

911
public Web3Auth.BuildEnv authBuildEnv { get; set; } = Web3Auth.BuildEnv.PRODUCTION;
1012
public Uri redirectUrl { get; set; }
@@ -37,7 +39,7 @@ public string walletSdkUrl {
3739
public Web3Auth.ChainNamespace? chainNamespace { get; set; } = Web3Auth.ChainNamespace.eip155;
3840
public MfaSettings? mfaSettings { get; set; } = null;
3941
public int sessionTime { get; set; } = 86400;
40-
public ChainsConfig? chainConfig { get; set; }
42+
public ChainConfig? chainConfig { get; set; }
4143
public Dictionary<string, string> originData { get; set; } = null;
4244

4345
public string dashboardUrl

Assets/Plugins/Web3AuthSDK/Types/Web3AuthResponse.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
public class Web3AuthResponse
1+
using Newtonsoft.Json;
2+
public class Web3AuthResponse
23
{
3-
public string privKey { get; set; }
4+
[JsonProperty("privKey")]
5+
public string privateKey { get; set; }
6+
47
public string ed25519PrivKey { get; set; }
58
public UserInfo userInfo { get; set; }
69
public string error { get; set; }

Assets/Plugins/Web3AuthSDK/Web3Auth.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public async void setOptions(Web3AuthOptions web3AuthOptions)
135135
if (this.web3AuthOptions.authBuildEnv != null)
136136
this.initParams["authBuildEnv"] = this.web3AuthOptions.authBuildEnv.ToString().ToLower();
137137

138-
this.initParams["network"] = this.web3AuthOptions.network.ToString().ToLower();
138+
this.initParams["network"] = this.web3AuthOptions.web3AuthNetwork.ToString().ToLower();
139139

140140
if (this.web3AuthOptions.useCoreKitKey.HasValue)
141141
this.initParams["useCoreKitKey"] = this.web3AuthOptions.useCoreKitKey.Value;
@@ -354,7 +354,7 @@ private async void processRequest(string path, LoginParams loginParams = null)
354354
}
355355
}
356356

357-
public async void showWalletUI(List<ChainsConfig> chainConfig, string chainId, string path = "wallet")
357+
public async void showWalletUI(List<ChainConfig> chainConfig, string chainId, string path = "wallet")
358358
{
359359
string sessionId = KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID);
360360
if (!string.IsNullOrEmpty(sessionId))
@@ -614,7 +614,7 @@ public void manageMFA(LoginParams loginParams)
614614
}
615615
}
616616

617-
public async void request(ChainsConfig chainConfig, string method, JArray requestParams, string path = "wallet/request") {
617+
public async void request(ChainConfig chainConfig, string method, JArray requestParams, string path = "wallet/request") {
618618
string sessionId = KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID);
619619
if (!string.IsNullOrEmpty(sessionId))
620620
{
@@ -630,7 +630,7 @@ public async void request(ChainsConfig chainConfig, string method, JArray reques
630630
this.initParams["redirectUrl"] = Utils.GetCurrentURL();
631631
#endif
632632

633-
var chainConfigList = new List<ChainsConfig> { chainConfig };
633+
var chainConfigList = new List<ChainConfig> { chainConfig };
634634
string chainConfigListJson = JsonConvert.SerializeObject(chainConfigList, Formatting.Indented);
635635
this.initParams["chains"] = chainConfigListJson;
636636
this.initParams["chainId"] = chainConfig.chainId;
@@ -749,7 +749,7 @@ private void authorizeSession(string newSessionId, string origin)
749749
);
750750
}
751751

752-
if (string.IsNullOrEmpty(this.web3AuthResponse.privKey) || string.IsNullOrEmpty(this.web3AuthResponse.privKey.Trim('0')))
752+
if (string.IsNullOrEmpty(this.web3AuthResponse.privateKey) || string.IsNullOrEmpty(this.web3AuthResponse.privateKey.Trim('0')))
753753
this.Enqueue(() => this.onLogout?.Invoke());
754754
else
755755
this.Enqueue(() => this.onLogin?.Invoke(this.web3AuthResponse));
@@ -885,7 +885,7 @@ private async Task<string> createSession(string data, long sessionTime, string a
885885
private async Task<bool> fetchProjectConfig()
886886
{
887887
TaskCompletionSource<bool> fetchProjectConfigResponse = new TaskCompletionSource<bool>();
888-
StartCoroutine(Web3AuthApi.getInstance().fetchProjectConfig(this.web3AuthOptions.clientId, this.web3AuthOptions.network.ToString().ToLower(), (response =>
888+
StartCoroutine(Web3AuthApi.getInstance().fetchProjectConfig(this.web3AuthOptions.clientId, this.web3AuthOptions.web3AuthNetwork.ToString().ToLower(), (response =>
889889
{
890890
if (response != null)
891891
{
@@ -930,7 +930,7 @@ public string getPrivKey()
930930
if (web3AuthResponse == null)
931931
return "";
932932

933-
return web3AuthOptions.useCoreKitKey.Value ? web3AuthResponse.coreKitKey : web3AuthResponse.privKey;
933+
return web3AuthOptions.useCoreKitKey.Value ? web3AuthResponse.coreKitKey : web3AuthResponse.privateKey;
934934
}
935935

936936
public string getEd25519PrivKey()

0 commit comments

Comments
 (0)