From 378a588b4c37768d56f4e90d1b673df4ffe63d97 Mon Sep 17 00:00:00 2001 From: sneakzttv Date: Tue, 31 Oct 2023 12:11:06 +0800 Subject: [PATCH 1/4] Goerli check A simple check on the sample scene that throws an exception informing the user that they need to be on the goerli chain to see the examples functioning. --- .../Scenes/SampleMain.unity | 46 ++++++++++++++++++- .../Scripts/Scenes/SampleMain/GoerliCheck.cs | 14 ++++++ .../Scenes/SampleMain/GoerliCheck.cs.meta | 11 +++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs create mode 100644 src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scenes/SampleMain.unity b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scenes/SampleMain.unity index 00470c7c2..9ca47f1de 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scenes/SampleMain.unity +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scenes/SampleMain.unity @@ -1509,7 +1509,7 @@ MonoBehaviour: m_HandleRect: {fileID: 37375165} m_Direction: 0 m_Value: 0 - m_Size: 0.47125128 + m_Size: 0.24156472 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -6726,6 +6726,50 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &1764495626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1764495628} + - component: {fileID: 1764495627} + m_Layer: 0 + m_Name: GoerliCheck + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1764495627 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1764495626} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f180489f7a552ad4c98731cb95b99f08, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1764495628 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1764495626} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -35.540485, y: -78.78714, z: -4.2523} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1800123346 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs new file mode 100644 index 000000000..1822f82f1 --- /dev/null +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs @@ -0,0 +1,14 @@ +using System; +using ChainSafe.Gaming.UnityPackage; +using UnityEngine; + +public class GoerliCheck : MonoBehaviour +{ + void Start() + { + if (Web3Accessor.Web3.ChainConfig.ChainId != "5") + { + throw new SystemException("Please set your chain to Goerli to see the examples functioning correctly"); + } + } +} diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta new file mode 100644 index 000000000..eb4af4b77 --- /dev/null +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f180489f7a552ad4c98731cb95b99f08 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From bb033b72b937c5917c56961d8d99ffe4760c219b Mon Sep 17 00:00:00 2001 From: sneakzttv Date: Tue, 31 Oct 2023 04:15:08 +0000 Subject: [PATCH 2/4] Auto-duplicate Package Samples --- .../Web3.Unity/Scenes/SampleMain.unity | 46 ++++++++++++++++++- .../Scripts/Scenes/SampleMain/GoerliCheck.cs | 14 ++++++ .../Scenes/SampleMain/GoerliCheck.cs.meta | 11 +++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs create mode 100644 Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta diff --git a/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes/SampleMain.unity b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes/SampleMain.unity index 00470c7c2..9ca47f1de 100644 --- a/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes/SampleMain.unity +++ b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes/SampleMain.unity @@ -1509,7 +1509,7 @@ MonoBehaviour: m_HandleRect: {fileID: 37375165} m_Direction: 0 m_Value: 0 - m_Size: 0.47125128 + m_Size: 0.24156472 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -6726,6 +6726,50 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &1764495626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1764495628} + - component: {fileID: 1764495627} + m_Layer: 0 + m_Name: GoerliCheck + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1764495627 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1764495626} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f180489f7a552ad4c98731cb95b99f08, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1764495628 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1764495626} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -35.540485, y: -78.78714, z: -4.2523} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1800123346 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs new file mode 100644 index 000000000..1822f82f1 --- /dev/null +++ b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs @@ -0,0 +1,14 @@ +using System; +using ChainSafe.Gaming.UnityPackage; +using UnityEngine; + +public class GoerliCheck : MonoBehaviour +{ + void Start() + { + if (Web3Accessor.Web3.ChainConfig.ChainId != "5") + { + throw new SystemException("Please set your chain to Goerli to see the examples functioning correctly"); + } + } +} diff --git a/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta new file mode 100644 index 000000000..eb4af4b77 --- /dev/null +++ b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f180489f7a552ad4c98731cb95b99f08 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 37f7ee8f40ae77c37c5a0093d1cffd1d126ca2a0 Mon Sep 17 00:00:00 2001 From: sneakzttv Date: Tue, 31 Oct 2023 16:40:55 +0800 Subject: [PATCH 3/4] Web3 exception Web3 exception --- .../Runtime/Web3AuthWalletExtensions.cs | 2 +- .../Scripts/Scenes/SampleMain/GoerliCheck.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthWalletExtensions.cs b/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthWalletExtensions.cs index eb110ecba..ef5d67dfd 100644 --- a/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthWalletExtensions.cs +++ b/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthWalletExtensions.cs @@ -47,7 +47,7 @@ public static IWeb3ServiceCollection UseWeb3AuthWallet(this IWeb3ServiceCollecti /// The modified IWeb3ServiceCollection with the Web3AuthWallet configuration replaced. public static IWeb3ServiceCollection ConfigureWeb3AuthWallet(this IWeb3ServiceCollection collection, Web3AuthWalletConfig configuration) { - collection.Replace(ServiceDescriptor.Singleton(typeof(Web3AuthWalletConfig), configuration); + collection.Replace(ServiceDescriptor.Singleton(typeof(Web3AuthWalletConfig), configuration)); return collection; } } diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs index 1822f82f1..8e8588598 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/GoerliCheck.cs @@ -1,5 +1,6 @@ using System; using ChainSafe.Gaming.UnityPackage; +using ChainSafe.Gaming.Web3; using UnityEngine; public class GoerliCheck : MonoBehaviour @@ -8,7 +9,7 @@ void Start() { if (Web3Accessor.Web3.ChainConfig.ChainId != "5") { - throw new SystemException("Please set your chain to Goerli to see the examples functioning correctly"); + throw new Web3Exception("Please set your chain to Goerli to see the examples functioning correctly"); } } } From f91099480794feca46c7f7d097bbffef913307cb Mon Sep 17 00:00:00 2001 From: sneakzttv Date: Tue, 31 Oct 2023 08:41:19 +0000 Subject: [PATCH 4/4] Auto-duplicate Package Samples --- .../Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs index 1822f82f1..8e8588598 100644 --- a/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs +++ b/Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts/Scenes/SampleMain/GoerliCheck.cs @@ -1,5 +1,6 @@ using System; using ChainSafe.Gaming.UnityPackage; +using ChainSafe.Gaming.Web3; using UnityEngine; public class GoerliCheck : MonoBehaviour @@ -8,7 +9,7 @@ void Start() { if (Web3Accessor.Web3.ChainConfig.ChainId != "5") { - throw new SystemException("Please set your chain to Goerli to see the examples functioning correctly"); + throw new Web3Exception("Please set your chain to Goerli to see the examples functioning correctly"); } } }