diff --git a/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll b/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll
index f1c65ef3c..81ef0a179 100644
Binary files a/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll and b/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll differ
diff --git a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll
index 1a2f3fbaa..1a7f27878 100644
Binary files a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll and b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll differ
diff --git a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll
index 8fecd65de..60ad9b627 100644
Binary files a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll and b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll differ
diff --git a/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll b/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll
index d789b51f9..8231a228d 100644
Binary files a/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll and b/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll differ
diff --git a/Packages/io.chainsafe.web3-unity.web3auth/Runtime/WalletGUI/Scripts/Web3AuthWalletGUITokenManager.cs b/Packages/io.chainsafe.web3-unity.web3auth/Runtime/WalletGUI/Scripts/Web3AuthWalletGUITokenManager.cs
index 875592232..dd40357c3 100644
--- a/Packages/io.chainsafe.web3-unity.web3auth/Runtime/WalletGUI/Scripts/Web3AuthWalletGUITokenManager.cs
+++ b/Packages/io.chainsafe.web3-unity.web3auth/Runtime/WalletGUI/Scripts/Web3AuthWalletGUITokenManager.cs
@@ -83,7 +83,7 @@ private async void SetTokens()
customTokenDisplay.SetActive(false);
}
// Set native token
- nativeTokenSymbolText.text = Web3Unity.Web3.ChainConfig.Symbol.ToUpper();
+ nativeTokenSymbolText.text = Web3Unity.Web3.ChainConfig.NativeCurrency.Symbol.ToUpper();
var hexBalance = await Web3Unity.Web3.RpcProvider.GetBalance(Web3Unity.Web3.Signer.PublicAddress);
var weiBalance = BigInteger.Parse(hexBalance.ToString());
decimal ethBalance = (decimal)weiBalance / (decimal)Math.Pow(10, 18);
diff --git a/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthConnectionProvider.cs b/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthConnectionProvider.cs
index d13277187..fba8abe9c 100644
--- a/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthConnectionProvider.cs
+++ b/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthConnectionProvider.cs
@@ -92,7 +92,7 @@ public override async Task Initialize(bool rememberSession)
//1155 is a decimal number, we need to convert it to an integer
InitWeb3Auth(clientId, new HexBigInteger(BigInteger.Parse(chainConfig.ChainId)).HexValue,
- chainConfig.Rpc, chainConfig.Network, "", chainConfig.Symbol, "", network.ToString().ToLower(), Initialized, InitializeError);
+ chainConfig.Rpc, chainConfig.Network, "", chainConfig.NativeCurrency.Symbol, "", network.ToString().ToLower(), Initialized, InitializeError);
await _initializeTcs.Task;
}
diff --git a/Packages/io.chainsafe.web3-unity/Editor/OpenPersistenDataPath.cs b/Packages/io.chainsafe.web3-unity/Editor/OpenPersistenDataPath.cs
new file mode 100644
index 000000000..a280eb808
--- /dev/null
+++ b/Packages/io.chainsafe.web3-unity/Editor/OpenPersistenDataPath.cs
@@ -0,0 +1,21 @@
+using UnityEditor;
+using UnityEngine;
+using System.IO;
+
+public class OpenPersistentDataPath
+{
+ [MenuItem("Edit/Open Persistent Data Path")]
+ private static void OpenPersistentDataPathFolder()
+ {
+ string path = Application.persistentDataPath;
+
+ // Check if the directory exists
+ if (!Directory.Exists(path))
+ {
+ Directory.CreateDirectory(path);
+ }
+
+ // Open the folder in the file explorer
+ EditorUtility.RevealInFinder(path);
+ }
+}
\ No newline at end of file
diff --git a/Packages/io.chainsafe.web3-unity/Editor/OpenPersistenDataPath.cs.meta b/Packages/io.chainsafe.web3-unity/Editor/OpenPersistenDataPath.cs.meta
new file mode 100644
index 000000000..cf96c6d4b
--- /dev/null
+++ b/Packages/io.chainsafe.web3-unity/Editor/OpenPersistenDataPath.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: e81dc37649c94b29bd15993aa11ecc7d
+timeCreated: 1732802488
\ No newline at end of file
diff --git a/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs b/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs
index 041b372e3..8e4189ad1 100644
--- a/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs
+++ b/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs
@@ -1,9 +1,11 @@
using System;
using System.Linq;
using ChainSafe.Gaming;
+using ChainSafe.Gaming.Web3;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
+using NativeCurrency = ChainSafe.Gaming.Web3.NativeCurrency;
namespace ChainSafe.GamingSdk.Editor
{
@@ -85,7 +87,13 @@ public void OnGUI()
chainConfig.Network = EditorGUILayout.TextField("Network", chainConfig.Network);
chainConfig.ChainId = EditorGUILayout.TextField("Chain ID", chainConfig.ChainId);
- chainConfig.Symbol = EditorGUILayout.TextField("Symbol", chainConfig.Symbol);
+ EditorGUILayout.LabelField("Native Currency", EditorStyles.boldLabel);
+ EditorGUI.indentLevel++;
+ // Draw fields for NativeCurrency
+ chainConfig.NativeCurrency.Name = EditorGUILayout.TextField("Name", chainConfig.NativeCurrency.Name);
+ chainConfig.NativeCurrency.Symbol = EditorGUILayout.TextField("Symbol", chainConfig.NativeCurrency.Symbol);
+ chainConfig.NativeCurrency.Decimals = EditorGUILayout.IntField("Decimals", chainConfig.NativeCurrency.Decimals);
+ EditorGUI.indentLevel--;
chainConfig.BlockExplorerUrl = EditorGUILayout.TextField("Block Explorer", chainConfig.BlockExplorerUrl);
GUI.enabled = true;
@@ -195,7 +203,12 @@ private void UpdateServerMenuInfo(bool chainSwitched = false)
{
chainConfig.Network = chainPrototype.chain;
chainConfig.ChainId = chainPrototype.chainId.ToString();
- chainConfig.Symbol = chainPrototype.nativeCurrency.symbol;
+ chainConfig.NativeCurrency = new NativeCurrency()
+ {
+ Name = chainPrototype.nativeCurrency.Name,
+ Symbol = chainPrototype.nativeCurrency.Symbol,
+ Decimals = chainPrototype.nativeCurrency.Decimals
+ };
if (chainPrototype.explorers != null)
{
chainConfig.BlockExplorerUrl = chainPrototype.explorers[0].url;
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll
index da3ebd09b..042e4ebfc 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll
index eed487db5..adcb47440 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll
index 8fade8f60..dfa4afff6 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll
index 105810e93..f78e5de60 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Marketplace.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Marketplace.dll
index ceb57cbbd..9ff0efaa5 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Marketplace.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Marketplace.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Reown.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Reown.dll
index dc37c5fc3..695e646df 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Reown.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Reown.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll
index 0cb44a360..e11a1a857 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll
index faecc8d03..312b18c29 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll
index 9577dd66d..b58fb7314 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll
index 7f4f953bc..e47bb456b 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll
index bce890a82..d70affe2d 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll
index bdccc0526..1fadb3289 100644
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/System.Numerics.Vectors.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/System.Numerics.Vectors.dll
index a808165ac..10205772c 100755
Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/System.Numerics.Vectors.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/System.Numerics.Vectors.dll differ
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ChainConfigEntry.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ChainConfigEntry.cs
index 72e21bd25..a07a9ea31 100644
--- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ChainConfigEntry.cs
+++ b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ChainConfigEntry.cs
@@ -1,5 +1,6 @@
using System;
using ChainSafe.Gaming.Web3;
+using ChainSafe.Gaming.Web3.Core.Chains;
using UnityEngine;
namespace ChainSafe.Gaming
@@ -10,13 +11,32 @@ public class ChainConfigEntry : IChainConfig
private const string ChainIdDefault = "11155111";
private const string ChainDefault = "Sepolia";
private const string NetworkDefault = "Sepolia";
- private const string SymbolDefault = "Seth";
+
+ private static readonly NativeCurrencyUnityWrapper DefaultNativeCurrency = new()
+ {
+ Name = "Sepolia Ether",
+ Symbol = "ETH",
+ Decimals = 18
+ };
+
private const string RpcDefault = "https://rpc.sepolia.org";
private const string BlockExplorerUrlDefault = "https://sepolia.etherscan.io";
private const string WsDefault = "";
[field: SerializeField] public string ChainId { get; set; }
- [field: SerializeField] public string Symbol { get; set; }
+
+ public INativeCurrency NativeCurrency
+ {
+ get => nativeCurrency;
+ set => nativeCurrency = new NativeCurrencyUnityWrapper()
+ {
+ Name = value.Name,
+ Symbol = value.Symbol,
+ Decimals = value.Decimals
+ };
+ }
+
+ [SerializeField] private NativeCurrencyUnityWrapper nativeCurrency ;
[field: SerializeField] public string Chain { get; set; }
[field: SerializeField] public string Network { get; set; }
[field: SerializeField] public string Rpc { get; set; }
@@ -26,7 +46,7 @@ public class ChainConfigEntry : IChainConfig
public static ChainConfigEntry Default => new()
{
ChainId = ChainIdDefault,
- Symbol = SymbolDefault,
+ NativeCurrency = DefaultNativeCurrency,
Chain = ChainDefault,
Network = NetworkDefault,
Rpc = RpcDefault,
@@ -37,7 +57,7 @@ public class ChainConfigEntry : IChainConfig
public static ChainConfigEntry Empty => new()
{
ChainId = string.Empty,
- Symbol = string.Empty,
+ NativeCurrency = new NativeCurrencyUnityWrapper(),
Chain = "Custom",
Network = string.Empty,
Rpc = string.Empty,
@@ -45,4 +65,15 @@ public class ChainConfigEntry : IChainConfig
Ws = string.Empty
};
}
+
+ ///
+ /// This is basically a wrapper for the INativeCurrency interface to allow for Unity serialization.
+ ///
+ [Serializable]
+ public class NativeCurrencyUnityWrapper : INativeCurrency
+ {
+ [field: SerializeField] public string Name { get; set; } = "Ether";
+ [field: SerializeField] public string Symbol { get; set; } = "ETH";
+ [field: SerializeField] public int Decimals { get; set; } = 18;
+ }
}
\ No newline at end of file
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Model/ChainInfoModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Model/ChainInfoModel.cs
index 63afdd884..20d9bbf09 100644
--- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Model/ChainInfoModel.cs
+++ b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Model/ChainInfoModel.cs
@@ -1,10 +1,17 @@
using System.Collections.Generic;
+using Newtonsoft.Json;
namespace ChainSafe.Gaming.UnityPackage.Model
{
public struct NativeCurrency
{
- public string symbol { get; set; }
+ [JsonProperty(PropertyName = "symbol")]
+ public string Symbol { get; set; }
+
+ [JsonProperty(PropertyName = "decimals")]
+ public int Decimals { get; set; }
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
}
public struct Explorer
diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs
index 3dff368a3..a40b6366f 100644
--- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs
+++ b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using ChainSafe.Gaming.Web3;
+using ChainSafe.Gaming.Web3.Core.Chains;
using UnityEngine;
namespace ChainSafe.Gaming.UnityPackage
@@ -39,7 +40,12 @@ public static Web3ConfigAsset Create(string projectId, string chainId, string ch
ChainId = chainId,
Chain = chain,
Network = network,
- Symbol = symbol,
+ NativeCurrency = new NativeCurrencyUnityWrapper()
+ {
+ Name = symbol,
+ Symbol = symbol,
+ Decimals = 18
+ },
Rpc = rpc,
Ws = ws,
BlockExplorerUrl = blockExplorerUrl,
@@ -91,7 +97,7 @@ public LocalhostChainConfig(string chainId, string symbol, string chain, string
var localhostEndPoint = $"127.0.0.1:{port}";
ChainId = chainId;
- Symbol = symbol;
+ NativeCurrency = new NativeCurrencyUnityWrapper(){ Symbol = symbol, Name = symbol, Decimals = 18 };
Chain = chain;
Network = network;
Rpc = $"http://{localhostEndPoint}";
@@ -100,7 +106,7 @@ public LocalhostChainConfig(string chainId, string symbol, string chain, string
}
public string ChainId { get; }
- public string Symbol { get; }
+ public INativeCurrency NativeCurrency { get; }
public string Chain { get; }
public string Network { get; }
public string Rpc { get; }
diff --git a/scripts/lint.bat b/scripts/lint.bat
index bbf2c9826..d74124bec 100644
--- a/scripts/lint.bat
+++ b/scripts/lint.bat
@@ -8,10 +8,5 @@ cd ..
:: Run format command in project root
dotnet format --verbosity=d --severity=warn ChainSafe.Gaming.sln --exclude /submodules
-:: Navigate to the UnitySampleProject within src and run the format command
-pushd .\src\UnitySampleProject
-dotnet format --verbosity=d --severity=warn .\UnitySampleProject.sln
-popd
-
:: Restore the original directory
popd
\ No newline at end of file
diff --git a/src/ChainSafe.Gaming.Reown/Methods/WalletAddEthereumChain.cs b/src/ChainSafe.Gaming.Reown/Methods/WalletAddEthereumChain.cs
new file mode 100644
index 000000000..a660b5a5c
--- /dev/null
+++ b/src/ChainSafe.Gaming.Reown/Methods/WalletAddEthereumChain.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using ChainSafe.Gaming.Evm.Network;
+using Reown.Core.Common.Utils;
+using Reown.Core.Network.Models;
+
+namespace ChainSafe.Gaming.Reown.Methods
+{
+ [RpcMethod("wallet_addEthereumChain")]
+ [RpcRequestOptions(Clock.ONE_MINUTE, 99993)]
+ public class WalletAddEthereumChain : List