From a06acffaa73106a7419ec8dbf2a193a9ac2bdd28 Mon Sep 17 00:00:00 2001 From: Brian Levinstein Date: Sat, 15 Jan 2022 02:12:06 -0700 Subject: [PATCH 01/13] Add CallContract (and helper methods) for calling contracts via Metamask (alternative to EVM.Call) --- Web3Unity/Scripts/Library/WebGL/Web3GL.cs | 36 ++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Web3Unity/Scripts/Library/WebGL/Web3GL.cs b/Web3Unity/Scripts/Library/WebGL/Web3GL.cs index 0cffcc56e..2e40944e4 100644 --- a/Web3Unity/Scripts/Library/WebGL/Web3GL.cs +++ b/Web3Unity/Scripts/Library/WebGL/Web3GL.cs @@ -17,6 +17,18 @@ public class Web3GL [DllImport("__Internal")] private static extern void SetContractResponse(string value); + [DllImport("__Internal")] + private static extern void CallContractJs(string method, string abi, string contract, string args); + + [DllImport("__Internal")] + private static extern void ResetCallContractResponse(); + + [DllImport("__Internal")] + private static extern string CallContractResponse(); + + [DllImport("__Internal")] + private static extern string CallContractError(); + [DllImport("__Internal")] private static extern void SendTransactionJs(string to, string value, string gasLimit, string gasPrice); @@ -38,6 +50,28 @@ public class Web3GL [DllImport("__Internal")] private static extern int GetNetwork(); + async public static Task CallContract(string _method, string _abi, string _contract, string _args, float _waitSeconds = 0.1f) + { + ResetCallContractResponse(); + CallContractJs(_method, _abi, _contract, _args); + string response = CallContractResponse(); + string error = CallContractError(); + while (response == "" && error == "") + { + await new WaitForSeconds(_waitSeconds); + response = CallContractResponse(); + error = CallContractError(); + } + ResetCallContractResponse(); + if (error.Length > 0) + { + throw new Exception(error); + } else + { + return response; + } + } + // this function will create a metamask tx for user to confirm. async public static Task SendContract(string _method, string _abi, string _contract, string _args, string _value, string _gasLimit = "", string _gasPrice = "") { @@ -113,4 +147,4 @@ public static int Network() } } -#endif \ No newline at end of file +#endif From a8ae96d82b3947b2175f267c74d816836ba60393 Mon Sep 17 00:00:00 2001 From: Nathan_Duft <86027898+nathanduft44@users.noreply.github.com> Date: Thu, 5 May 2022 12:56:20 -0700 Subject: [PATCH 02/13] Added Telos chain ID to network.js --- WebGLTemplates/Cronos_Defi_Wallet/network.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WebGLTemplates/Cronos_Defi_Wallet/network.js b/WebGLTemplates/Cronos_Defi_Wallet/network.js index d9deb447f..58a386dd0 100644 --- a/WebGLTemplates/Cronos_Defi_Wallet/network.js +++ b/WebGLTemplates/Cronos_Defi_Wallet/network.js @@ -20,6 +20,8 @@ Used to set the network: https://chainlist.org/ 1666600000 Harmony Mainnet Shard0 25 Cronos Mainnet Beta 338 Cronos Testnet +40 Telos Mainnet +41 Telos Testnet */ window.web3ChainId = 1; From f402b63cdaa3c5a641f7a3c2456b1bafdb551957 Mon Sep 17 00:00:00 2001 From: kwame Date: Tue, 9 Aug 2022 21:40:44 -0400 Subject: [PATCH 03/13] CreateApproval WebGL/WebWallet and Models / Create Approve Model / Updated ERC Balance examples as it xdai has been removed. --- .../Minter/ApproveTransactionWebGL.prefab | 429 ++++++++++++++++++ .../ApproveTransactionWebGL.prefab.meta | 7 + .../Minter/ApproveTransactionWebWallet.prefab | 429 ++++++++++++++++++ .../ApproveTransactionWebWallet.prefab.meta | 7 + .../Prefabs/Minter/WebGL/ListItemWebGL.prefab | 6 +- .../Minter/WebWallet/ListItemWebWallet.prefab | 90 +++- .../WebWallet/MinterWebWallet1155.prefab | 2 +- .../WebWallet/MinterWebWallet721.prefab | 4 +- .../VoucherMinterWeb3Wallet1155.prefab | 2 +- .../VoucherMinterWeb3Wallet721.prefab | 2 +- Web3Unity/Scripts/Library/EVM.cs | 13 +- .../Prefabs/ERC20/ERC20BalanceOfExample.cs | 4 +- .../Prefabs/ERC20/ERC20DecimalsExample.cs | 4 +- .../Scripts/Prefabs/ERC20/ERC20NameExample.cs | 4 +- .../Prefabs/Minter/CreateApprovalWebGL.cs | 40 ++ .../Minter/CreateApprovalWebGL.cs.meta | 11 + .../Prefabs/Minter/CreateApprovalWebWallet.cs | 42 ++ .../Minter/CreateApprovalWebWallet.cs.meta | 11 + .../Prefabs/Minter/GetListedNFTWebGL.cs | 202 ++++----- .../Prefabs/Minter/GetListedNFTWebWallet.cs | 1 + .../Scripts/Prefabs/Minter/ListNFTWebGL.cs | 178 ++++---- .../Prefabs/Minter/ListNFTWebWallet.cs | 73 +-- Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs | 2 +- .../Prefabs/Minter/MintWeb3Wallet1155.cs | 90 ++-- .../Prefabs/Minter/MintWeb3Wallet721.cs | 73 ++- .../Scripts/Prefabs/Minter/MintWebGL1155.cs | 29 +- .../Scripts/Prefabs/Minter/MintWebGL721.cs | 6 +- .../Minter/Model/CreateApprovalModel.cs | 43 ++ .../Minter/Model/CreateApprovalModel.cs.meta | 11 + .../Scripts/Prefabs/Minter/Model/MintedNFT.cs | 6 +- WebGLTemplates/Web3GL-2020x/network.js | 2 +- 31 files changed, 1481 insertions(+), 342 deletions(-) create mode 100644 Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab create mode 100644 Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab.meta create mode 100644 Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab create mode 100644 Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab.meta create mode 100644 Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs create mode 100644 Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs.meta create mode 100644 Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs create mode 100644 Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs.meta create mode 100644 Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs create mode 100644 Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs.meta diff --git a/Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab b/Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab new file mode 100644 index 000000000..172addaf1 --- /dev/null +++ b/Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab @@ -0,0 +1,429 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &876154593149325209 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3878305427068847659} + - component: {fileID: 1713174434311318708} + - component: {fileID: 1912493306358107683} + - component: {fileID: 2626719895068634725} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3878305427068847659 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 7455392642327436758} + m_Father: {fileID: 8193968085053257331} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &1713174434311318708 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &1912493306358107683 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &2626719895068634725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!1 &1194607908984202551 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7455392642327436758} + - component: {fileID: 3068094292720373368} + - component: {fileID: 2857004803660735988} + - component: {fileID: 5848637710539718353} + - component: {fileID: 5725375638126771104} + m_Layer: 5 + m_Name: ApproveTransaction + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7455392642327436758 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3346215808139107429} + m_Father: {fileID: 3878305427068847659} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 21.068298, y: 40.749084} + m_SizeDelta: {x: 220, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3068094292720373368 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_CullTransparentMesh: 1 +--- !u!114 &2857004803660735988 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5848637710539718353 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2857004803660735988} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 5725375638126771104} + m_TargetAssemblyTypeName: CreateApprovalWebGL, Assembly-CSharp + m_MethodName: ApproveTransaction + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &5725375638126771104 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bee6d2ef00e0fc445ac34964f0acbf24, type: 3} + m_Name: + m_EditorClassIdentifier: + chain: ethereum + network: goerli + account: + tokenType: 1155 +--- !u!1 &3740520113679879029 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3346215808139107429} + - component: {fileID: 2092123609195711457} + - component: {fileID: 2819960501460086039} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3346215808139107429 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3740520113679879029} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7455392642327436758} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2092123609195711457 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3740520113679879029} + m_CullTransparentMesh: 1 +--- !u!114 &2819960501460086039 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3740520113679879029} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Approve Transaction +--- !u!1 &7424244350142682644 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8193968085053257331} + m_Layer: 0 + m_Name: ApproveTransactionWebGL + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8193968085053257331 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7424244350142682644} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 704.1049, y: 424.79797, z: -1.7642212} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3878305427068847659} + - {fileID: 1616921521127880578} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &7966339067187644181 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1616921521127880578} + - component: {fileID: 2228138053946581734} + - component: {fileID: 6146836717029830817} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1616921521127880578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7966339067187644181} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -704.1049, y: -424.79797, z: 1.7642212} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8193968085053257331} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2228138053946581734 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7966339067187644181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!114 &6146836717029830817 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7966339067187644181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 diff --git a/Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab.meta b/Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab.meta new file mode 100644 index 000000000..8f1d854ce --- /dev/null +++ b/Web3Unity/Prefabs/Minter/ApproveTransactionWebGL.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c65aefadd67db7344911b12bf20e7174 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab b/Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab new file mode 100644 index 000000000..79fafbb86 --- /dev/null +++ b/Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab @@ -0,0 +1,429 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &876154593149325209 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3878305427068847659} + - component: {fileID: 1713174434311318708} + - component: {fileID: 1912493306358107683} + - component: {fileID: 2626719895068634725} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3878305427068847659 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 7455392642327436758} + m_Father: {fileID: 8193968085053257331} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &1713174434311318708 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &1912493306358107683 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &2626719895068634725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 876154593149325209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!1 &1194607908984202551 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7455392642327436758} + - component: {fileID: 3068094292720373368} + - component: {fileID: 2857004803660735988} + - component: {fileID: 5848637710539718353} + - component: {fileID: 809832919944141113} + m_Layer: 5 + m_Name: ApproveTransaction + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7455392642327436758 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3346215808139107429} + m_Father: {fileID: 3878305427068847659} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 21.068298, y: 40.749084} + m_SizeDelta: {x: 220, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3068094292720373368 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_CullTransparentMesh: 1 +--- !u!114 &2857004803660735988 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5848637710539718353 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2857004803660735988} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 809832919944141113} + m_TargetAssemblyTypeName: CreateApproval, Assembly-CSharp + m_MethodName: ApproveTransaction + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &809832919944141113 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194607908984202551} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 668cc0cec6fbbdb43b4a45004c327180, type: 3} + m_Name: + m_EditorClassIdentifier: + chain: ethereum + network: goerli + account: + tokenType: 1155 +--- !u!1 &3740520113679879029 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3346215808139107429} + - component: {fileID: 2092123609195711457} + - component: {fileID: 2819960501460086039} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3346215808139107429 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3740520113679879029} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7455392642327436758} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2092123609195711457 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3740520113679879029} + m_CullTransparentMesh: 1 +--- !u!114 &2819960501460086039 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3740520113679879029} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Approve Transaction +--- !u!1 &7424244350142682644 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8193968085053257331} + m_Layer: 0 + m_Name: ApproveTransactionWebWallet + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8193968085053257331 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7424244350142682644} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 704.1049, y: 424.79797, z: -1.7642212} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3878305427068847659} + - {fileID: 1616921521127880578} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &7966339067187644181 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1616921521127880578} + - component: {fileID: 2228138053946581734} + - component: {fileID: 6146836717029830817} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1616921521127880578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7966339067187644181} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -704.1049, y: -424.79797, z: 1.7642212} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8193968085053257331} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2228138053946581734 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7966339067187644181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!114 &6146836717029830817 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7966339067187644181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 diff --git a/Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab.meta b/Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab.meta new file mode 100644 index 000000000..98697c241 --- /dev/null +++ b/Web3Unity/Prefabs/Minter/ApproveTransactionWebWallet.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 895f3eaa5c6bb6a449947bc0abe2bce3 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Web3Unity/Prefabs/Minter/WebGL/ListItemWebGL.prefab b/Web3Unity/Prefabs/Minter/WebGL/ListItemWebGL.prefab index c43173892..df502edc4 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/ListItemWebGL.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/ListItemWebGL.prefab @@ -344,7 +344,7 @@ GameObject: - component: {fileID: 3320835638743597960} - component: {fileID: 5337679207975425507} - component: {fileID: 2097097020288793545} - - component: {fileID: 111573341408847214} + - component: {fileID: 4516948571124645769} m_Layer: 5 m_Name: List NFT m_TagString: Untagged @@ -454,7 +454,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 111573341408847214} + - m_Target: {fileID: 4516948571124645769} m_TargetAssemblyTypeName: ListNFTWebGL, Assembly-CSharp m_MethodName: ListItem m_Mode: 1 @@ -466,7 +466,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 ---- !u!114 &111573341408847214 +--- !u!114 &4516948571124645769 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Web3Unity/Prefabs/Minter/WebWallet/ListItemWebWallet.prefab b/Web3Unity/Prefabs/Minter/WebWallet/ListItemWebWallet.prefab index 3a27b9a51..e281d307b 100644 --- a/Web3Unity/Prefabs/Minter/WebWallet/ListItemWebWallet.prefab +++ b/Web3Unity/Prefabs/Minter/WebWallet/ListItemWebWallet.prefab @@ -1,5 +1,84 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &462757546801617581 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4477965018655690729} + - component: {fileID: 7732519554742696678} + - component: {fileID: 7414384245332148802} + m_Layer: 5 + m_Name: NoListed + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4477965018655690729 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 462757546801617581} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2785930264698737631} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 22.431885, y: 26} + m_SizeDelta: {x: 687.4098, y: 22} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7732519554742696678 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 462757546801617581} + m_CullTransparentMesh: 1 +--- !u!114 &7414384245332148802 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 462757546801617581} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: --- !u!1 &1248448515727594353 GameObject: m_ObjectHideFlags: 0 @@ -39,6 +118,7 @@ RectTransform: - {fileID: 369880677028123527} - {fileID: 2244590598163439963} - {fileID: 3943508050788800891} + - {fileID: 4477965018655690729} m_Father: {fileID: 6412277166927740745} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -344,7 +424,7 @@ GameObject: - component: {fileID: 3320835638743597960} - component: {fileID: 5337679207975425507} - component: {fileID: 2097097020288793545} - - component: {fileID: 3310715326433666598} + - component: {fileID: 3682407228455330276} m_Layer: 5 m_Name: List NFT m_TagString: Untagged @@ -454,8 +534,9 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 3310715326433666598} - m_TargetAssemblyTypeName: ListNFTWebWallet, Assembly-CSharp + - m_Target: {fileID: 3682407228455330276} + m_TargetAssemblyTypeName: Web3Unity.Scripts.Prefabs.Minter.ListNftWebWallet, + Assembly-CSharp m_MethodName: ListItem m_Mode: 1 m_Arguments: @@ -466,7 +547,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 ---- !u!114 &3310715326433666598 +--- !u!114 &3682407228455330276 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -484,6 +565,7 @@ MonoBehaviour: contractAddr: {fileID: 2718362954267046474} isApproved: {fileID: 2561369982256801256} itemPrice: {fileID: 8613641514179503747} + noListedItems: {fileID: 7414384245332148802} playerAccount: {fileID: 1251711576109685082} --- !u!1 &3976548911116731797 GameObject: diff --git a/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet1155.prefab b/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet1155.prefab index 74d19887b..1c0da0638 100644 --- a/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet1155.prefab +++ b/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet1155.prefab @@ -124,7 +124,7 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 2090303264410817348} m_TargetAssemblyTypeName: MintWeb3Wallet1155, Assembly-CSharp - m_MethodName: MintNFT1155 + m_MethodName: MintNft1155 m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} diff --git a/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet721.prefab b/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet721.prefab index f9ae13291..c376bc46b 100644 --- a/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet721.prefab +++ b/Web3Unity/Prefabs/Minter/WebWallet/MinterWebWallet721.prefab @@ -124,7 +124,7 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 8493851505887001244} m_TargetAssemblyTypeName: MintWeb3Wallet721, Assembly-CSharp - m_MethodName: MintNFT721 + m_MethodName: MintNft721 m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -150,7 +150,7 @@ MonoBehaviour: network: goerli account: to: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c - cid721: QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj + cid721: f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c chainId: 5 type721: 721 --- !u!1 &3131669594263551518 diff --git a/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet1155.prefab b/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet1155.prefab index 2613e941d..4a309cbf6 100644 --- a/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet1155.prefab +++ b/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet1155.prefab @@ -226,7 +226,7 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 5940802294771442294} m_TargetAssemblyTypeName: MintWeb3Wallet1155, Assembly-CSharp - m_MethodName: VoucherMintNFT1155 + m_MethodName: VoucherMintNft1155 m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} diff --git a/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet721.prefab b/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet721.prefab index d77d814d2..460081bca 100644 --- a/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet721.prefab +++ b/Web3Unity/Prefabs/Minter/WebWallet/VoucherMinterWeb3Wallet721.prefab @@ -226,7 +226,7 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 6700418422729324537} m_TargetAssemblyTypeName: MintWeb3Wallet721, Assembly-CSharp - m_MethodName: VoucherMintNFT721 + m_MethodName: VoucherMintNft721 m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} diff --git a/Web3Unity/Scripts/Library/EVM.cs b/Web3Unity/Scripts/Library/EVM.cs index 58116cb6b..0c9de368c 100755 --- a/Web3Unity/Scripts/Library/EVM.cs +++ b/Web3Unity/Scripts/Library/EVM.cs @@ -11,8 +11,8 @@ public class EVM { public class Response { public T response; } - private readonly static string host = "https://api.gaming.chainsafe.io/evm"; - private readonly static string hostVoucher = "https://lazy-minting-voucher-signer.herokuapp.com"; + private static readonly string host = "https://api.gaming.chainsafe.io/evm"; + private static readonly string hostVoucher = "https://lazy-minting-voucher-signer.herokuapp.com"; public static async Task BalanceOf(string _chain, string _network, string _account, string _rpc = "") { @@ -180,8 +180,11 @@ public static async Task TxStatus(string _chain, string _network, string form.AddField("network", _network); form.AddField("account", _account); form.AddField("tokenId", _tokenId); + Debug.Log("Token ID: " + _tokenId); form.AddField("priceHex", _priceHex); + Debug.Log("Price Hex: " + _priceHex); form.AddField("tokenType", _tokenType); + Debug.Log("Token Type: " + _tokenType); string url = host + "/createListNftTransaction"; using (UnityWebRequest webRequest = UnityWebRequest.Post(url, form)) { @@ -234,17 +237,19 @@ public static async Task TxStatus(string _chain, string _network, string } } - public static async Task> CreateApproveTransaction(string _chain, string _network, string _account) + public static async Task CreateApproveTransaction(string _chain, string _network, string _account, string _tokenType) { WWWForm form = new WWWForm(); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); + form.AddField("tokenType", _tokenType); + string url = host + "/createApproveTransaction"; using (UnityWebRequest webRequest = UnityWebRequest.Post(url, form)) { await webRequest.SendWebRequest(); - GetNftListModel.Root data = JsonUtility.FromJson(System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); + CreateApprovalModel.Root data = JsonUtility.FromJson(System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); return data.response; } } diff --git a/Web3Unity/Scripts/Prefabs/ERC20/ERC20BalanceOfExample.cs b/Web3Unity/Scripts/Prefabs/ERC20/ERC20BalanceOfExample.cs index f2edd8c14..b3979338e 100644 --- a/Web3Unity/Scripts/Prefabs/ERC20/ERC20BalanceOfExample.cs +++ b/Web3Unity/Scripts/Prefabs/ERC20/ERC20BalanceOfExample.cs @@ -7,9 +7,9 @@ public class ERC20BalanceOfExample : MonoBehaviour { async void Start() { - string chain = "xdai"; + string chain = "ethereum"; string network = "mainnet"; - string contract = "0xa106739de31fa7a9df4a93c9bea3e1bade0924e2"; + string contract = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; string account = "0x000000ea89990a17Ec07a35Ac2BBb02214C50152"; BigInteger balanceOf = await ERC20.BalanceOf(chain, network, contract, account); diff --git a/Web3Unity/Scripts/Prefabs/ERC20/ERC20DecimalsExample.cs b/Web3Unity/Scripts/Prefabs/ERC20/ERC20DecimalsExample.cs index e46d05c47..82317688c 100644 --- a/Web3Unity/Scripts/Prefabs/ERC20/ERC20DecimalsExample.cs +++ b/Web3Unity/Scripts/Prefabs/ERC20/ERC20DecimalsExample.cs @@ -7,9 +7,9 @@ public class ERC20DecimalsExample : MonoBehaviour { async void Start() { - string chain = "xdai"; + string chain = "ethereum"; string network = "mainnet"; - string contract = "0xa106739de31fa7a9df4a93c9bea3e1bade0924e2"; + string contract = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; BigInteger decimals = await ERC20.Decimals(chain, network, contract); print(decimals); diff --git a/Web3Unity/Scripts/Prefabs/ERC20/ERC20NameExample.cs b/Web3Unity/Scripts/Prefabs/ERC20/ERC20NameExample.cs index 6813df7ae..741d3f473 100644 --- a/Web3Unity/Scripts/Prefabs/ERC20/ERC20NameExample.cs +++ b/Web3Unity/Scripts/Prefabs/ERC20/ERC20NameExample.cs @@ -6,9 +6,9 @@ public class ERC20NameExample : MonoBehaviour { async void Start() { - string chain = "xdai"; + string chain = "ethereum"; string network = "mainnet"; - string contract = "0xa106739de31fa7a9df4a93c9bea3e1bade0924e2"; + string contract = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; string name = await ERC20.Name(chain, network, contract); print(name); diff --git a/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs new file mode 100644 index 000000000..a3d0ec5f9 --- /dev/null +++ b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CreateApprovalWebGL : MonoBehaviour +{ + // Start is called before the first frame update + public string chain = "ethereum"; + public string network = "goerli"; + public string account; + public string tokenType = "1155"; + + private void Awake() + { + account = PlayerPrefs.GetString("Account"); + } + + public async void ApproveTransaction() + { + var response = await EVM.CreateApproveTransaction(chain, network, account, tokenType); + Debug.Log("Response: " + response.connection.chain); + + try + { + + string responseNft = await Web3GL.SendTransactionData(response.tx.to, "0", response.tx.gasPrice, response.tx.gasLimit,response.tx.data); + if (responseNft == null) + { + Debug.Log("Empty Response Object:"); + } + print(responseNft); + Debug.Log(responseNft); + } + catch (Exception e) + { + Debug.LogException(e, this); + } + } +} \ No newline at end of file diff --git a/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs.meta b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs.meta new file mode 100644 index 000000000..ac9e3e603 --- /dev/null +++ b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bee6d2ef00e0fc445ac34964f0acbf24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs new file mode 100644 index 000000000..851b82adf --- /dev/null +++ b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CreateApprovalWebWallet : MonoBehaviour +{ + // Start is called before the first frame update + public string chain = "ethereum"; + public string network = "goerli"; + public string account; + public string tokenType = "1155"; + string chainID = "5"; + + private void Awake() + { + account = PlayerPrefs.GetString("Account"); + } + + public async void ApproveTransaction() + { + var response = await EVM.CreateApproveTransaction(chain, network, account, tokenType); + Debug.Log("Response: " + response.connection.chain); + + try + { + + string responseNft = await Web3Wallet.SendTransaction(chainID, response.tx.to, "0", + response.tx.data, response.tx.gasLimit, response.tx.gasPrice); + if (responseNft == null) + { + Debug.Log("Empty Response Object:"); + } + print(responseNft); + Debug.Log(responseNft); + } + catch (Exception e) + { + Debug.LogException(e, this); + } + } +} diff --git a/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs.meta b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs.meta new file mode 100644 index 000000000..9fe00effb --- /dev/null +++ b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebWallet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 668cc0cec6fbbdb43b4a45004c327180 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebGL.cs b/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebGL.cs index 1224440ee..2928eab0b 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebGL.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebGL.cs @@ -7,130 +7,130 @@ using UnityEngine.Networking; using UnityEngine.UI; - #if UNITY_WEBGL -public class GetListedNFTWebGL : MonoBehaviour +namespace Web3Unity.Scripts.Prefabs.Minter { - private string chain = "ethereum"; - public Renderer textureObject; - private string network = "goerli"; - public Text price; - public Text seller; - public Text description; - public Text listPercentage; - public Text contractAddr; - public Text tokenId; - public Text itemId; - private string _itemPrice = ""; - private string _tokenType = ""; + public class GetListedNFTWebGL : MonoBehaviour + { + private string chain = "ethereum"; + public Renderer textureObject; + private string network = "goerli"; + public Text price; + public Text seller; + public Text description; + public Text listPercentage; + public Text contractAddr; + public Text tokenId; + public Text itemId; + private string _itemPrice = ""; + private string _tokenType = ""; - private string _itemID = ""; + private string _itemID = ""; - public void Awake() - { - - price.text = ""; - seller.text = ""; - description.text = ""; - listPercentage.text = ""; - tokenId.text = ""; - itemId.text = ""; - contractAddr.text = ""; - } - - // Start is called before the first frame update - async void Start() - { - List response = await EVM.GetNftMarket(chain, network); - price.text = response[0].price; - seller.text = response[0].seller; - if (response[0].uri.StartsWith("ipfs://")) + public void Awake() { - response[0].uri = response[0].uri.Replace("ipfs://", "https://ipfs.io/ipfs/"); - Debug.Log("Response URI" + response[0].uri); + + price.text = ""; + seller.text = ""; + description.text = ""; + listPercentage.text = ""; + tokenId.text = ""; + itemId.text = ""; + contractAddr.text = ""; } - UnityWebRequest webRequest = UnityWebRequest.Get(response[0].uri); - await webRequest.SendWebRequest(); - RootGetNFT data = - JsonConvert.DeserializeObject( - System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); - description.text = data.description; - // parse json to get image uri - string imageUri = data.image; - if (imageUri.StartsWith("ipfs://")) + // Start is called before the first frame update + async void Start() { - imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); - StartCoroutine(DownloadImage(imageUri)); - } + List response = await EVM.GetNftMarket(chain, network); + price.text = response[0].price; + seller.text = response[0].seller; + if (response[0].uri.StartsWith("ipfs://")) + { + response[0].uri = response[0].uri.Replace("ipfs://", "https://ipfs.io/ipfs/"); + Debug.Log("Response URI" + response[0].uri); + } - if (data.properties != null) - { - foreach (var prop in data.properties.additionalFiles) + UnityWebRequest webRequest = UnityWebRequest.Get(response[0].uri); + await webRequest.SendWebRequest(); + RootGetNFT data = + JsonConvert.DeserializeObject( + System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); + description.text = data.description; + // parse json to get image uri + string imageUri = data.image; + if (imageUri.StartsWith("ipfs://")) + { + imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); + StartCoroutine(DownloadImage(imageUri)); + } + + if (data.properties != null) { - if (prop.StartsWith("ipfs://")) + foreach (var prop in data.properties.additionalFiles) { - var additionalURi = prop.Replace("ipfs://", "https://ipfs.io/ipfs/"); + if (prop.StartsWith("ipfs://")) + { + var additionalURi = prop.Replace("ipfs://", "https://ipfs.io/ipfs/"); + } } } + listPercentage.text = response[0].listedPercentage; + contractAddr.text = response[0].nftContract; + itemId.text = response[0].itemId; + _itemID = response[0].itemId; + _itemPrice = response[0].price; + _tokenType = response[0].tokenType; + tokenId.text = response[0].tokenId; } - listPercentage.text = response[0].listedPercentage; - contractAddr.text = response[0].nftContract; - itemId.text = response[0].itemId; - _itemID = response[0].itemId; - _itemPrice = response[0].price; - _tokenType = response[0].tokenType; - tokenId.text = response[0].tokenId; - } - // ReSharper disable Unity.PerformanceAnalysis - IEnumerator DownloadImage(string MediaUrl) - { - UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl); - yield return request.SendWebRequest(); - if (request.result == UnityWebRequest.Result.ProtocolError) - Debug.Log(request.error); - else + // ReSharper disable Unity.PerformanceAnalysis + IEnumerator DownloadImage(string MediaUrl) { - Texture2D webTexture = ((DownloadHandlerTexture) request.downloadHandler).texture as Texture2D; - Sprite webSprite = SpriteFromTexture2D(webTexture); - textureObject.GetComponent().sprite = webSprite; + UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl); + yield return request.SendWebRequest(); + if (request.result == UnityWebRequest.Result.ProtocolError) + Debug.Log(request.error); + else + { + Texture2D webTexture = ((DownloadHandlerTexture) request.downloadHandler).texture as Texture2D; + Sprite webSprite = SpriteFromTexture2D(webTexture); + textureObject.GetComponent().sprite = webSprite; + } } - } - Sprite SpriteFromTexture2D(Texture2D texture) - { - return Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), - 100.0f); - } + Sprite SpriteFromTexture2D(Texture2D texture) + { + return Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), + 100.0f); + } - public async void PurchaseItem() - { - - - BuyNFT.Response response = await EVM.CreatePurchaseNftTransaction(chain, network, - PlayerPrefs.GetString("Account"), _itemID, _itemPrice, _tokenType); - Debug.Log("Account: " + response.tx.account); - Debug.Log("To : " + response.tx.to); - Debug.Log("Value : " + response.tx.value); - Debug.Log("Data : " + response.tx.data); - Debug.Log("Gas Price : " + response.tx.gasPrice); - Debug.Log("Gas Limit : " + response.tx.gasLimit); + public async void PurchaseItem() + { + BuyNFT.Response response = await EVM.CreatePurchaseNftTransaction(chain, network, + PlayerPrefs.GetString("Account"), _itemID, _itemPrice, _tokenType); + Debug.Log("Account: " + response.tx.account); + Debug.Log("To : " + response.tx.to); + Debug.Log("Value : " + response.tx.value); + Debug.Log("Data : " + response.tx.data); + Debug.Log("Gas Price : " + response.tx.gasPrice); + Debug.Log("Gas Limit : " + response.tx.gasLimit); - try - { - string responseNft = await Web3GL.SendTransaction( response.tx.to, response.tx.value, response.tx.gasLimit, response.tx.gasLimit); - if (responseNft == null) + try + { + string responseNft = await Web3GL.SendTransaction( response.tx.to, response.tx.value, response.tx.gasLimit, response.tx.gasLimit); + if (responseNft == null) + { + Debug.Log("Empty Response Object:"); + } + print(responseNft); + Debug.Log(responseNft); + } + catch (Exception e) { - Debug.Log("Empty Response Object:"); + Debug.LogError(e, this); } - print(responseNft); - Debug.Log(responseNft); - } - catch (Exception e) - { - Debug.LogError(e, this); } } } diff --git a/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs b/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs index 63c75a608..f0ae3968e 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs @@ -46,6 +46,7 @@ async void Start() List response = await EVM.GetNftMarket(chain, network); price.text = response[0].price; seller.text = response[0].seller; + Debug.Log("Seller: " + response[0].seller); if (response[0].uri.StartsWith("ipfs://")) { response[0].uri = response[0].uri.Replace("ipfs://", "https://ipfs.io/ipfs/"); diff --git a/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebGL.cs b/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebGL.cs index e6a8ec084..f3cc389d4 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebGL.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebGL.cs @@ -3,118 +3,114 @@ using System.Collections.Generic; using Models; using Newtonsoft.Json; -using UnityEditor; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; - #if UNITY_WEBGL public class ListNFTWebGL : MonoBehaviour +{ + private string chain = "ethereum"; + private string network = "goerli"; + private string _itemPrice = "0.001"; + private string _tokenType = ""; + private string _itemID = ""; + private string account; + + public Renderer textureObject; + public Text description; + public Text tokenURI; + public Text contractAddr; + public Text isApproved; + public InputField itemPrice; + public Text playerAccount; + + public void Awake() { - private string chain = "ethereum"; - private string network = "goerli"; - private string chainID = "5"; - private string _itemPrice = "0.001"; - private string _tokenType = ""; - private string _itemID = ""; - private string account; - - public Renderer textureObject; - public Text description; - public Text tokenURI; - public Text contractAddr; - public Text isApproved; - public InputField itemPrice; - public Text playerAccount; - - public void Awake() - { - account = PlayerPrefs.GetString("Account"); - description.text = ""; - tokenURI.text = ""; - isApproved.text = ""; - contractAddr.text = ""; - } + account = PlayerPrefs.GetString("Account"); + description.text = ""; + tokenURI.text = ""; + isApproved.text = ""; + contractAddr.text = ""; + } - // Start is called before the first frame update - async void Start() - { - playerAccount.text = account; - List response = await EVM.GetMintedNFT(chain, network,account); - - if (response[0].uri.StartsWith("ipfs://")) - { - response[0].uri = response[0].uri.Replace("ipfs://", "https://ipfs.io/ipfs/"); - } - - UnityWebRequest webRequest = UnityWebRequest.Get(response[0].uri); - await webRequest.SendWebRequest(); - RootGetNFT data = - JsonConvert.DeserializeObject( - System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); - description.text = data.description; - // parse json to get image uri - string imageUri = data.image; - if (imageUri.StartsWith("ipfs://")) - { - imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); - StartCoroutine(DownloadImage(imageUri)); - } + // Start is called before the first frame update + async void Start() + { + playerAccount.text = account; + List response = await EVM.GetMintedNFT(chain, network, account); - tokenURI.text = response[0].uri; - Debug.Log(response[0].uri); - contractAddr.text = response[0].nftContract; - isApproved.text = response[0].isApproved.ToString(); - _itemID = response[0].id; - _itemPrice = itemPrice.text; - _tokenType = response[0].tokenType; + if (response[0].uri.StartsWith("ipfs://")) + { + response[0].uri = response[0].uri.Replace("ipfs://", "https://ipfs.io/ipfs/"); } - // ReSharper disable Unity.PerformanceAnalysis - IEnumerator DownloadImage(string MediaUrl) + UnityWebRequest webRequest = UnityWebRequest.Get(response[0].uri); + await webRequest.SendWebRequest(); + RootGetNFT data = + JsonConvert.DeserializeObject( + System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); + description.text = data.description; + // parse json to get image uri + string imageUri = data.image; + if (imageUri.StartsWith("ipfs://")) { - UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl); - yield return request.SendWebRequest(); - if (request.result == UnityWebRequest.Result.ProtocolError) - Debug.Log(request.error); - else - { - Texture2D webTexture = ((DownloadHandlerTexture) request.downloadHandler).texture as Texture2D; - Sprite webSprite = SpriteFromTexture2D(webTexture); - textureObject.GetComponent().sprite = webSprite; - } + imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); + StartCoroutine(DownloadImage(imageUri)); } - Sprite SpriteFromTexture2D(Texture2D texture) + tokenURI.text = response[0].uri; + Debug.Log(response[0].uri); + contractAddr.text = response[0].nftContract; + isApproved.text = response[0].isApproved.ToString(); + _itemID = response[0].id; + _itemPrice = itemPrice.text; + _tokenType = response[0].tokenType; + } + + // ReSharper disable Unity.PerformanceAnalysis + IEnumerator DownloadImage(string MediaUrl) + { + UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl); + yield return request.SendWebRequest(); + if (request.result == UnityWebRequest.Result.ProtocolError) + Debug.Log(request.error); + else { - return Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), - 100.0f); + Texture2D webTexture = ((DownloadHandlerTexture) request.downloadHandler).texture as Texture2D; + Sprite webSprite = SpriteFromTexture2D(webTexture); + textureObject.GetComponent().sprite = webSprite; } + } - public async void ListItem() - { + Sprite SpriteFromTexture2D(Texture2D texture) + { + return Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), + 100.0f); + } - float eth = float.Parse(_itemPrice); - float decimals = 1000000000000000000; // 18 decimals - float wei = eth * decimals; - ListNFT.Response response = - await EVM.CreateListNftTransaction(chain, network, account, _itemID, Convert.ToDecimal(wei).ToString(), _tokenType); - int value = Convert.ToInt32(response.tx.value.hex, 16); - try - { - string responseNft = await Web3GL.SendTransactionData(response.tx.to, value.ToString(), - response.tx.gasPrice, response.tx.gasLimit, response.tx.data); - if (responseNft == null) - { - Debug.Log("Empty Response Object:"); - } - } - catch (Exception e) + public async void ListItem() + { + float eth = float.Parse(_itemPrice); + float decimals = 1000000000000000000; // 18 decimals + float wei = eth * decimals; + ListNFT.Response response = + await EVM.CreateListNftTransaction(chain, network, account, _itemID, Convert.ToDecimal(wei).ToString(), _tokenType); + int value = Convert.ToInt32(response.tx.value.hex, 16); + try + { + string responseNft = await Web3GL.SendTransactionData(response.tx.to, value.ToString(), + response.tx.gasPrice, response.tx.gasLimit, response.tx.data); + if (responseNft == null) { - Debug.Log("Revoked Transaction"); + Debug.Log("Empty Response Object:"); } } + catch (Exception e) + { + Debug.Log("Revoked Transaction" + e); + } } +} #endif diff --git a/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs b/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs index 1a21b4563..82daeba85 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs @@ -9,7 +9,7 @@ namespace Web3Unity.Scripts.Prefabs.Minter { - public class ListNFTWebWallet : MonoBehaviour + public class ListNftWebWallet : MonoBehaviour { private string chain = "ethereum"; private string network = "goerli"; @@ -25,6 +25,7 @@ public class ListNFTWebWallet : MonoBehaviour public Text contractAddr; public Text isApproved; public InputField itemPrice; + public Text noListedItems; public Text playerAccount; public void Awake() @@ -40,34 +41,50 @@ public void Awake() async void Start() { playerAccount.text = account; - List response = await EVM.GetMintedNFT(chain, network,account); - - if (response[0].uri.StartsWith("ipfs://")) + try { - response[0].uri = response[0].uri.Replace("ipfs://", "https://ipfs.io/ipfs/"); - } + List response = await EVM.GetMintedNFT(chain, network,account); + + if (response[1].uri == null) + { + Debug.Log("Not Listed Items"); + return; + } + if (response[1].uri.StartsWith("ipfs://")) + { + response[1].uri = response[1].uri.Replace("ipfs://", "https://ipfs.io/ipfs/"); + } - UnityWebRequest webRequest = UnityWebRequest.Get(response[0].uri); - await webRequest.SendWebRequest(); - RootGetNFT data = - JsonConvert.DeserializeObject( - System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); - description.text = data.description; - // parse json to get image uri - string imageUri = data.image; - if (imageUri.StartsWith("ipfs://")) + UnityWebRequest webRequest = UnityWebRequest.Get(response[1].uri); + await webRequest.SendWebRequest(); + RootGetNFT data = + JsonConvert.DeserializeObject( + System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); + description.text = data.description; + // parse json to get image uri + string imageUri = data.image; + if (imageUri.StartsWith("ipfs://")) + { + imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); + StartCoroutine(DownloadImage(imageUri)); + } + + tokenURI.text = response[1].uri; + Debug.Log(response[1].uri); + contractAddr.text = response[1].nftContract; + Debug.Log("NFT Contract: " + response[1].nftContract); + isApproved.text = response[1].isApproved.ToString(); + _itemID = response[1].id; + _itemPrice = itemPrice.text; + Debug.Log("Token Type: " + response[1].tokenType); + _tokenType = response[1].tokenType; + } + catch (Exception e) { - imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); - StartCoroutine(DownloadImage(imageUri)); + noListedItems.text = "NO LISTED ITEM for " + account; + Debug.Log("No Listed Items" + e); } - - tokenURI.text = response[0].uri; - Debug.Log(response[0].uri); - contractAddr.text = response[0].nftContract; - isApproved.text = response[0].isApproved.ToString(); - _itemID = response[0].id; - _itemPrice = itemPrice.text; - _tokenType = response[0].tokenType; + } // ReSharper disable Unity.PerformanceAnalysis @@ -97,12 +114,14 @@ public async void ListItem() float eth = float.Parse(_itemPrice); float decimals = 1000000000000000000; // 18 decimals float wei = eth * decimals; + Debug.Log("ItemID: " + _itemID); ListNFT.Response response = await EVM.CreateListNftTransaction(chain, network, account, _itemID, Convert.ToDecimal(wei).ToString(), _tokenType); int value = Convert.ToInt32(response.tx.value.hex, 16); + Debug.Log("Response: " + response); try { - string responseNft = await Web3Wallet.SendTransaction(chainID, response.tx.to, value.ToString(), + string responseNft = await Web3Wallet.SendTransaction(chainID, response.tx.to, value.ToString(), response.tx.data, response.tx.gasLimit, response.tx.gasPrice); if (responseNft == null) { @@ -111,7 +130,7 @@ public async void ListItem() } catch (Exception e) { - Debug.Log("Revoked Transaction"); + Debug.Log("Error: " + e); } } } diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs index e98382ccd..2b0604001 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs @@ -12,7 +12,7 @@ public class MintPK721 : MonoBehaviour public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli public string account = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; - public string cid = "bafkzvzacdl6fujsdcv5omhiiy35h4w4upua7k7q5ngvcfawl2pca"; + public string cid = "QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj"; public string type = "721"; async public void MintButtonPK() diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs index 7daefc044..af6908d53 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs @@ -2,58 +2,62 @@ using Models; using UnityEngine; - -public class MintWeb3Wallet1155 : MonoBehaviour +namespace Web3Unity.Scripts.Prefabs.Minter { + public class MintWeb3Wallet1155 : MonoBehaviour + { - private string chain = "ethereum"; - private string network = "goerli"; // mainnet ropsten kovan rinkeby goerli - private string account; - private string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; - public string cid1155 = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; - private string chainId = "5"; - public string type1155 = "1155"; + private string chain = "ethereum"; + private string network = "goerli"; // mainnet ropsten kovan rinkeby goerli + private string account; + private string to; + public string cid1155 = "bafkzvzacdlxhaqsig3fboo3kjzshfb6rltxivrbnrqwy2euje7sq"; + private string chainId = "5"; + public string type1155 = "1155"; - public void Awake() - { - account = PlayerPrefs.GetString("Account"); - } + public void Awake() + { + account = PlayerPrefs.GetString("Account"); + to = PlayerPrefs.GetString("Account"); + Debug.Log("To" + to); + } - public async void MintNFT1155() - { - CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid1155, type1155); - Debug.Log("NFT Response: " + nftResponse); - // connects to user's browser wallet (metamask) to send a transaction - try + public async void MintNft1155() { - string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); - print(response); - Debug.Log(response); - } catch (Exception e) { - Debug.LogException(e, this); + CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid1155, type1155); + Debug.Log("NFT Response: " + nftResponse); + // connects to user's browser wallet (metamask) to send a transaction + try + { + string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); + print(response); + Debug.Log(response); + } catch (Exception e) { + Debug.LogException(e, this); + } } - } - public async void VoucherMintNFT1155() - { - // validates the account that sent the voucher, you can change this if you like to fit your system - if (PlayerPrefs.GetString("Web3Voucher1155") == "0x1372199B632bd6090581A0588b2f4F08985ba2d4"){ - CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid1155, type1155); - Debug.Log("NFT Response: " + nftResponse); - // connects to user's browser wallet (metamask) to send a transaction - try + public async void VoucherMintNft1155() { - string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); - print(response); - Debug.Log(response); - } catch (Exception e) { - Debug.LogException(e, this); + // validates the account that sent the voucher, you can change this if you like to fit your system + if (PlayerPrefs.GetString("Web3Voucher1155") == "0x1372199B632bd6090581A0588b2f4F08985ba2d4"){ + CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid1155, type1155); + Debug.Log("NFT Response: " + nftResponse); + // connects to user's browser wallet (metamask) to send a transaction + try + { + string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); + print(response); + Debug.Log(response); + } catch (Exception e) { + Debug.LogException(e, this); + } + } + else + { + Debug.Log("Voucher Invalid"); + } } } - else - { - Debug.Log("Voucher Invalid"); - } - } } diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs index 0ebe474cb..8800ed3a0 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs @@ -2,45 +2,26 @@ using Models; using UnityEngine; - -public class MintWeb3Wallet721 : MonoBehaviour +namespace Web3Unity.Scripts.Prefabs.Minter { - - public string chain = "ethereum"; - public string network = "goerli"; // mainnet ropsten kovan rinkeby goerli - public string account; - public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; - public string cid721 = "bafkzvzacdl6fujsdcv5omhiiy35h4w4upua7k7q5ngvcfawl2pca"; - public string chainId = "5"; - public string type721 = "721"; - - public void Awake() + public class MintWeb3Wallet721 : MonoBehaviour { - account = PlayerPrefs.GetString("Account"); - } - // Start is called before the first frame update - public async void MintNFT721() - { - CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid721, type721); - Debug.Log("NFT Response: " + nftResponse); - // connects to user's browser wallet (metamask) to send a transaction - try - { - string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); - print(response); - Debug.Log(response); - } - catch (Exception e) + public string chain = "ethereum"; + public string network = "goerli"; // mainnet ropsten kovan rinkeby goerli + public string account; + public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; + public string cid721 = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; + public string chainId = "5"; + public string type721 = "721"; + + public void Awake() { - Debug.LogException(e, this); + account = PlayerPrefs.GetString("Account"); } - } - public async void VoucherMintNFT721() - { - // validates the account that sent the voucher, you can change this if you like to fit your system - if (PlayerPrefs.GetString("Web3Voucher721") == "0x1372199B632bd6090581A0588b2f4F08985ba2d4") + // Start is called before the first frame update + public async void MintNft721() { CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid721, type721); Debug.Log("NFT Response: " + nftResponse); @@ -50,15 +31,31 @@ public async void VoucherMintNFT721() string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); print(response); Debug.Log(response); - } - catch (Exception e) - { + } catch (Exception e) { Debug.LogException(e, this); } } - else + + public async void VoucherMintNft721() { - Debug.Log("Voucher Invalid"); + // validates the account that sent the voucher, you can change this if you like to fit your system + if (PlayerPrefs.GetString("Web3Voucher721") == "0x1372199B632bd6090581A0588b2f4F08985ba2d4"){ + CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid721, type721); + Debug.Log("NFT Response: " + nftResponse); + // connects to user's browser wallet (metamask) to send a transaction + try + { + string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); + print(response); + Debug.Log(response); + } catch (Exception e) { + Debug.LogException(e, this); + } + } + else + { + Debug.Log("Voucher Invalid"); + } } } } diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs index 33c8c6beb..1a2e3eb0b 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs @@ -12,7 +12,7 @@ public class MintWebGL1155 : MonoBehaviour public string chain = "ethereum"; public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli public string account; - public string to = "0x148dC439Ffe10DF915f1DA14AA780A47A577709E"; + public string to; public string cid = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; public string type721 = "1155"; @@ -20,6 +20,7 @@ public class MintWebGL1155 : MonoBehaviour public void Awake() { account = PlayerPrefs.GetString("Account"); + to = PlayerPrefs.GetString("Account"); } public async void MintNFT() @@ -39,20 +40,20 @@ public async void VoucherMintNFT() { // validates the account that sent the voucher, you can change this if you like to fit your system if (PlayerPrefs.GetString("WebGLVoucher1155") == "0x1372199B632bd6090581A0588b2f4F08985ba2d4"){ - CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid,type721); - // connects to user's browser wallet (metamask) to send a transaction - try - { - string response = await Web3GL.SendTransactionData(nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.gasPrice,nftResponse.tx.gasLimit, nftResponse.tx.data); - print("Response: " + response); - } catch (Exception e) { - Debug.LogException(e, this); + CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid,type721); + // connects to user's browser wallet (metamask) to send a transaction + try + { + string response = await Web3GL.SendTransactionData(nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.gasPrice,nftResponse.tx.gasLimit, nftResponse.tx.data); + print("Response: " + response); + } catch (Exception e) { + Debug.LogException(e, this); + } + } + else + { + Debug.Log("Voucher Invalid"); } - } - else - { - Debug.Log("Voucher Invalid"); - } } } #endif \ No newline at end of file diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs index ffab9fabe..06e0434d6 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs @@ -12,14 +12,16 @@ public class MintWebGL721 : MonoBehaviour public string chain = "ethereum"; public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli public string account; - public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; - public string cid = "bafkzvzacdl6fujsdcv5omhiiy35h4w4upua7k7q5ngvcfawl2pca"; + public string to; + // update cid per mint + public string cid = "QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj"; public string type721 = "721"; public void Awake() { account = PlayerPrefs.GetString("Account"); + to = PlayerPrefs.GetString("Account"); } public async void MintNFT() diff --git a/Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs b/Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs new file mode 100644 index 000000000..3ada17666 --- /dev/null +++ b/Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CreateApprovalModel : MonoBehaviour +{ + [Serializable] + public class Connection + { + public string rpc; + public string chain; + public string network; + } + [Serializable] + public class Response + { + public string hashedUnsignedTx; + public Connection connection; + public Tx tx; + } + [Serializable] + public class Root + { + public Response response; + } + [Serializable] + public class Tx + { + public string account; + public string to; + public Value value; + public string data; + public string gasPrice; + public string gasLimit; + } + [Serializable] + public class Value + { + public string type; + public string hex; + } +} diff --git a/Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs.meta b/Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs.meta new file mode 100644 index 000000000..250220463 --- /dev/null +++ b/Web3Unity/Scripts/Prefabs/Minter/Model/CreateApprovalModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f77d722f7b18fd44eb108d019a3432e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Web3Unity/Scripts/Prefabs/Minter/Model/MintedNFT.cs b/Web3Unity/Scripts/Prefabs/Minter/Model/MintedNFT.cs index 9478b7421..ec05b653d 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/Model/MintedNFT.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/Model/MintedNFT.cs @@ -8,11 +8,13 @@ public class MintedNFT [Serializable] public class Response { + public string creator; + public string owner; public string id; - public string uri; - public bool isApproved; public string nftContract; + public bool isApproved; public string tokenType; + public string uri; } [Serializable] public class Root diff --git a/WebGLTemplates/Web3GL-2020x/network.js b/WebGLTemplates/Web3GL-2020x/network.js index 5128d753b..113c06eed 100644 --- a/WebGLTemplates/Web3GL-2020x/network.js +++ b/WebGLTemplates/Web3GL-2020x/network.js @@ -22,4 +22,4 @@ Used to set the network: https://chainlist.org/ 338 Cronos Testnet */ -window.web3ChainId = 4; +window.web3ChainId = 5; From d48326cb5646bf4bd9544bfd5699d3b63c7c3a02 Mon Sep 17 00:00:00 2001 From: kwame Date: Wed, 10 Aug 2022 17:46:23 -0400 Subject: [PATCH 04/13] Added define for CreateApprovalWebGL --- Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs index a3d0ec5f9..90b178b85 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/CreateApprovalWebGL.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using UnityEngine; + +#if UNITY_WEBGL public class CreateApprovalWebGL : MonoBehaviour { // Start is called before the first frame update @@ -37,4 +39,5 @@ public async void ApproveTransaction() Debug.LogException(e, this); } } -} \ No newline at end of file +} +#endif \ No newline at end of file From c81df3e359d7b4f9b5db3241a0505f45dfc99dc1 Mon Sep 17 00:00:00 2001 From: kwame Date: Thu, 22 Sep 2022 12:33:26 -0400 Subject: [PATCH 05/13] Updated URI class method Modified class method to handle tokenId hex returned from minted assets in marketplace. --- Web3Unity/Scripts/Library/ERC1155.cs | 6 ++++++ Web3Unity/Scripts/Library/ERC721.cs | 9 +++++++-- Web3Unity/Scripts/Library/Wallet/Resources.meta | 8 -------- 3 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 Web3Unity/Scripts/Library/Wallet/Resources.meta diff --git a/Web3Unity/Scripts/Library/ERC1155.cs b/Web3Unity/Scripts/Library/ERC1155.cs index dbbb95b77..6a40a7dc4 100644 --- a/Web3Unity/Scripts/Library/ERC1155.cs +++ b/Web3Unity/Scripts/Library/ERC1155.cs @@ -51,8 +51,14 @@ public static async Task> BalanceOfBatch(string _chain, string public static async Task URI(string _chain, string _network, string _contract, string _tokenId, string _rpc="") { + const string ipfsPath = "https://ipfs.io/ipfs/"; string method = "uri"; string[] obj = { _tokenId }; + if (_tokenId.StartsWith("0x")) + { + string convertURI = _tokenId.Replace("0x", "f"); + return ipfsPath + convertURI; + } string args = JsonConvert.SerializeObject(obj); string response = await EVM.Call(_chain, _network, _contract, abi, method, args, _rpc); return response; diff --git a/Web3Unity/Scripts/Library/ERC721.cs b/Web3Unity/Scripts/Library/ERC721.cs index 079f97f0d..159a4681d 100644 --- a/Web3Unity/Scripts/Library/ERC721.cs +++ b/Web3Unity/Scripts/Library/ERC721.cs @@ -67,11 +67,16 @@ public static async Task> OwnerOfBatch(string _chain, string _netwo public static async Task URI(string _chain, string _network, string _contract, string _tokenId, string _rpc="") { + const string ipfsPath = "https://ipfs.io/ipfs/"; string method = "tokenURI"; string[] obj = { _tokenId }; + if (_tokenId.StartsWith("0x")) + { + string convertURI = _tokenId.Replace("0x", "f"); + return ipfsPath + convertURI; + } string args = JsonConvert.SerializeObject(obj); string response = await EVM.Call(_chain, _network, _contract, abi, method, args, _rpc); - return response; + return response; } - } diff --git a/Web3Unity/Scripts/Library/Wallet/Resources.meta b/Web3Unity/Scripts/Library/Wallet/Resources.meta deleted file mode 100644 index 19bd6a648..000000000 --- a/Web3Unity/Scripts/Library/Wallet/Resources.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 98f840f7e29445d4aa8a077401e11fae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From a019f9079661e4b29957d5a8be53d4667fa77c13 Mon Sep 17 00:00:00 2001 From: kwame Date: Thu, 22 Sep 2022 13:29:20 -0400 Subject: [PATCH 06/13] Updated ImportNFTTextureExample to work with ChainSafe MarketPlace --- .../Prefabs/ERC1155/ImportNFTTextureExample.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs b/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs index 9184db146..0ead20dea 100644 --- a/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs +++ b/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs @@ -9,13 +9,14 @@ public class ImportNFTTextureExample : MonoBehaviour public class Response { public string image; } + async void Start() { string chain = "ethereum"; - string network = "rinkeby"; - string contract = "0x3a8A85A6122C92581f590444449Ca9e66D8e8F35"; - string tokenId = "5"; + string network = "goerli"; + string contract = "0x2c1867BC3026178A47a677513746DCc6822A137A"; + string tokenId = "0x01559ae4021a8aad9226aef5beee2a0d8ba61eaac07e3bc71d2d9e9a802a216f"; // fetch uri from chain string uri = await ERC1155.URI(chain, network, contract, tokenId); @@ -29,10 +30,14 @@ async void Start() // parse json to get image uri string imageUri = data.image; print("imageUri: " + imageUri); - + if (imageUri.StartsWith("ipfs://")) + { + imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); + } + Debug.Log("Revised URI: " + imageUri); // fetch image and display in game UnityWebRequest textureRequest = UnityWebRequestTexture.GetTexture(imageUri); await textureRequest.SendWebRequest(); - this.gameObject.GetComponent().material.mainTexture = ((DownloadHandlerTexture)textureRequest.downloadHandler).texture; + gameObject.GetComponent().material.mainTexture = ((DownloadHandlerTexture)textureRequest.downloadHandler).texture; } } From d4d0c2a37d9198feabf46e3f00b058713fcd56e1 Mon Sep 17 00:00:00 2001 From: sneakzttv Date: Tue, 27 Sep 2022 08:09:08 +0800 Subject: [PATCH 07/13] Update Web3PrivateKey.cs --- Web3Unity/Scripts/Library/Web3PrivateKey.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Web3Unity/Scripts/Library/Web3PrivateKey.cs b/Web3Unity/Scripts/Library/Web3PrivateKey.cs index 9db16497a..8cc3ff269 100755 --- a/Web3Unity/Scripts/Library/Web3PrivateKey.cs +++ b/Web3Unity/Scripts/Library/Web3PrivateKey.cs @@ -13,6 +13,8 @@ public class Web3PrivateKey const int CRONOS_TESTNET = 338; const int FTM_MAINNET = 250; const int FTM_TESTNET = 0xfa2; + const int AVA_MAINNET = 43114; + const int AVA_TESTNET = 43113; public static string SignTransaction(string _privateKey, string _transaction, string _chainId) { @@ -25,7 +27,7 @@ public static string SignTransaction(string _privateKey, string _transaction, st BigInteger chainId = BigInteger.Parse(_chainId); // sign transaction if ((CHAIN_ID == MATIC_MAIN) || (CHAIN_ID == MATIC_MUMBAI) || (CHAIN_ID == HARMONY_MAINNET) || - (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET)) + (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET) || (CHAIN_ID == AVA_MAINNET) || (CHAIN_ID == AVA_TESTNET)) { signature = EthECDSASignature.CreateStringSignature(key.SignAndCalculateYParityV(hashByteArr)); return signature; From e2715a0114ccf2c494c28fed7baa893f16a9dd88 Mon Sep 17 00:00:00 2001 From: sneakzttv <57473220+sneakzttv@users.noreply.github.com> Date: Tue, 18 Oct 2022 01:04:33 +0800 Subject: [PATCH 08/13] web3privatekey updates Arbitrum mainnet and testnet added to private key sign parity v. --- Web3Unity/Scripts/Library/Web3PrivateKey.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Web3Unity/Scripts/Library/Web3PrivateKey.cs b/Web3Unity/Scripts/Library/Web3PrivateKey.cs index 8cc3ff269..4c15e3724 100755 --- a/Web3Unity/Scripts/Library/Web3PrivateKey.cs +++ b/Web3Unity/Scripts/Library/Web3PrivateKey.cs @@ -15,6 +15,8 @@ public class Web3PrivateKey const int FTM_TESTNET = 0xfa2; const int AVA_MAINNET = 43114; const int AVA_TESTNET = 43113; + const int ARBITRUM_MAINNET = 42161; + const int ARBITRUM_TESTNET = 421613; public static string SignTransaction(string _privateKey, string _transaction, string _chainId) { @@ -27,7 +29,7 @@ public static string SignTransaction(string _privateKey, string _transaction, st BigInteger chainId = BigInteger.Parse(_chainId); // sign transaction if ((CHAIN_ID == MATIC_MAIN) || (CHAIN_ID == MATIC_MUMBAI) || (CHAIN_ID == HARMONY_MAINNET) || - (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET) || (CHAIN_ID == AVA_MAINNET) || (CHAIN_ID == AVA_TESTNET)) + (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET) || (CHAIN_ID == AVA_MAINNET) || (CHAIN_ID == AVA_TESTNET) || (CHAIN_ID == ARBITRUM_MAINNET) || (CHAIN_ID == ARBITRUM_TESTNET)) { signature = EthECDSASignature.CreateStringSignature(key.SignAndCalculateYParityV(hashByteArr)); return signature; From 0bd1d4d824064f54b5415410b1c43e93b0b636ca Mon Sep 17 00:00:00 2001 From: sneakzttv <57473220+sneakzttv@users.noreply.github.com> Date: Wed, 19 Oct 2022 01:47:34 +0800 Subject: [PATCH 09/13] Depreciated Chains Removed Removed ropsten and rinkeby, defaulted prefabs to goerli. --- Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab | 2 +- Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab | 2 +- Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab | 2 +- Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab | 2 +- Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab | 2 +- Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab | 2 +- .../Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs | 2 +- Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs | 2 +- Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs | 2 +- Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs | 2 +- Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs | 2 +- Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs | 2 +- Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs | 2 +- .../Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs | 4 ++-- .../Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs | 5 ++--- .../Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs | 4 ++-- .../PrivateKey/Web3PrivateKeySendTransactionExample.cs | 4 ++-- .../Prefabs/Wallet/Web3WalletSendTransactionExample.cs | 2 +- .../Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs | 2 +- .../Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs | 2 +- .../Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs | 2 +- WebGLTemplates/Cronos_Defi_Wallet/network.js | 2 -- WebGLTemplates/Web3GL-2020x/network.js | 2 -- 30 files changed, 32 insertions(+), 37 deletions(-) diff --git a/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab b/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab index 9e5a9624f..4c242a58b 100644 --- a/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab +++ b/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab @@ -213,7 +213,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: rinkeby + network: goerli account: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c to: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c cid: f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c diff --git a/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab b/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab index 3e6eb4466..e05066c94 100644 --- a/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab +++ b/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab @@ -213,7 +213,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: rinkeby + network: goerli account: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c to: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c cid: QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj diff --git a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab index 17205a0fc..bdb7cdfaa 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab @@ -424,7 +424,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: rinkeby + network: goerli account: to: 0x148dC439Ffe10DF915f1DA14AA780A47A577709E cid: f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c diff --git a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab index af8e20873..f9d350800 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab @@ -424,7 +424,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: rinkeby + network: goerli account: to: 0x148dC439Ffe10DF915f1DA14AA780A47A577709E cid: QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj diff --git a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab index e588732f4..e550c15eb 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab @@ -148,7 +148,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: rinkeby + network: goerli account: to: 0x148dC439Ffe10DF915f1DA14AA780A47A577709E cid: f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c diff --git a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab index 49901db50..8c8f108c4 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab @@ -294,7 +294,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: rinkeby + network: goerli account: to: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c cid: QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj diff --git a/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs b/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs index 0a9c41b8c..e46a9d07f 100644 --- a/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs +++ b/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs @@ -8,7 +8,7 @@ public class ERC1155BalanceOfBatchExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "rinkeby"; + string network = "goerli"; string contract = "0x2ebecabbbe8a8c629b99ab23ed154d74cd5d4342"; string[] accounts = { "0xaCA9B6D9B1636D99156bB12825c75De1E5a58870", "0xaCA9B6D9B1636D99156bB12825c75De1E5a58870" }; string[] tokenIds = { "17", "22" }; diff --git a/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs b/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs index 54d5dcc19..40a5d18ef 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs @@ -16,7 +16,7 @@ private class NFTs async void Start() { string chain = "ethereum"; - string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + string network = "goerli"; // mainnet kovan goerli string account = "0xebc0e6232fb9d494060acf580105108444f7c696"; string contract = ""; int first = 500; diff --git a/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs b/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs index c5db888a5..7cedef9f0 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs @@ -16,7 +16,7 @@ private class NFTs async void Start() { string chain = "ethereum"; - string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + string network = "goerli"; // mainnet kovan goerli string account = "0xebc0e6232fb9d494060acf580105108444f7c696"; string contract = ""; int first = 500; diff --git a/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs b/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs index ebd1513ca..ae71ccd7d 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs @@ -7,7 +7,7 @@ public class BlockNumberExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "mainnet"; // mainnet ropsten kovan rinkeby goerli + string network = "mainnet"; // mainnet kovan goerli int blockNumber = await EVM.BlockNumber(chain, network); print(blockNumber); } diff --git a/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs b/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs index 47ab7ba66..ae1c74520 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs @@ -21,7 +21,7 @@ function addTotal(uint8 _myArg) public { // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "rinkeby"; + string network = "goerli"; // smart contract method to call string method = "myTotal"; // abi in json format diff --git a/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs b/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs index 21b07fcbe..bcbbeeedf 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs @@ -7,7 +7,7 @@ public class EthBalanceOfExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + string network = "goerli"; // mainnet kovan goerli string account = "0xdD4c825203f97984e7867F11eeCc813A036089D1"; string balance = await EVM.BalanceOf(chain, network, account); diff --git a/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs b/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs index 5e495f326..88b324c51 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs @@ -7,7 +7,7 @@ public class NonceExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "rinkeby"; + string network = "goerli"; string account = "0xdD4c825203f97984e7867F11eeCc813A036089D1"; string nonce = await EVM.Nonce(chain, network, account); diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs b/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs index 65ee4b434..b9a9195e9 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs @@ -9,7 +9,7 @@ public class MintIPFS : MonoBehaviour // Start is called before the first frame update public string chain = "ethereum"; - public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + public string network = "goerli"; // mainnet kovan goerli public string account = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string type = "721"; // for 1155 assets update type. diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs index 16c99513c..bc38e17e6 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs @@ -9,7 +9,7 @@ public class MintPK1155 : MonoBehaviour // Start is called before the first frame update public string chain = "ethereum"; - public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + public string network = "goerli"; // mainnet kovan goerli public string account = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string cid = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs index 2b0604001..8cb184190 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs @@ -9,7 +9,7 @@ public class MintPK721 : MonoBehaviour // Start is called before the first frame update public string chain = "ethereum"; - public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + public string network = "goerli"; // mainnet kovan goerli public string account = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string cid = "QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs index af6908d53..7ee9d86f6 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs @@ -8,7 +8,7 @@ public class MintWeb3Wallet1155 : MonoBehaviour { private string chain = "ethereum"; - private string network = "goerli"; // mainnet ropsten kovan rinkeby goerli + private string network = "goerli"; // mainnet kovan goerli private string account; private string to; public string cid1155 = "bafkzvzacdlxhaqsig3fboo3kjzshfb6rltxivrbnrqwy2euje7sq"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs index 8800ed3a0..d28de829d 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs @@ -8,7 +8,7 @@ public class MintWeb3Wallet721 : MonoBehaviour { public string chain = "ethereum"; - public string network = "goerli"; // mainnet ropsten kovan rinkeby goerli + public string network = "goerli"; // mainnet kovan goerli public string account; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string cid721 = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs index 1a2e3eb0b..992ab633c 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs @@ -10,7 +10,7 @@ public class MintWebGL1155 : MonoBehaviour { // Start is called before the first frame update public string chain = "ethereum"; - public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + public string network = "goerli"; // mainnet kovan goerli public string account; public string to; public string cid = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs index 06e0434d6..2998dd1da 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs @@ -10,7 +10,7 @@ public class MintWebGL721 : MonoBehaviour { // Start is called before the first frame update public string chain = "ethereum"; - public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli + public string network = "goerli"; // mainnet kovan goerli public string account; public string to; // update cid per mint diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs index 92d6d8ff8..5e361a1ad 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs @@ -12,7 +12,7 @@ async public void OnSend1155() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "rinkeby"; + string network = "goerli"; // smart contract method to call string method = "safeTransferFrom"; // account of player @@ -42,6 +42,6 @@ async public void OnSend1155() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, contract, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); + Application.OpenURL("https://goerli.etherscan.io/tx/" + response); } } diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs index 43465b10b..74a967df4 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs @@ -12,12 +12,11 @@ async public void OnSend20() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "rinkeby"; + string network = "goerli"; // smart contract method to call string method = "transfer"; // account of player string account = Web3PrivateKey.Address(privateKey); - // smart contract address: https://rinkeby.etherscan.io/address/0xc7ad46e0b8a400bb3c915120d284aafba8fc4735 string contract = "0xc7ad46e0b8a400bb3c915120d284aafba8fc4735"; // account to send to string toAccount = "0x428066dd8A212104Bc9240dCe3cdeA3D3A0f7979"; @@ -40,6 +39,6 @@ async public void OnSend20() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, contract, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); + Application.OpenURL("https://goerli.etherscan.io/tx/" + response); } } \ No newline at end of file diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs index 74f24bcf3..ceea2a715 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs @@ -12,7 +12,7 @@ async public void OnSend721() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "rinkeby"; + string network = "goerli"; // smart contract method to call string method = "safeTransferFrom"; // account of player @@ -40,6 +40,6 @@ async public void OnSend721() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, contract, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); + Application.OpenURL("https://goerli.etherscan.io/tx/" + response); } } \ No newline at end of file diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs index bededc211..ec807256e 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs @@ -12,7 +12,7 @@ async public void OnSendTransaction() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "rinkeby"; + string network = "goerli"; // account of player string account = Web3PrivateKey.Address(privateKey); // account to send to @@ -30,6 +30,6 @@ async public void OnSendTransaction() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, to, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); + Application.OpenURL("https://goerli.etherscan.io/tx/" + response); } } diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs index 582c7a08e..a6766bd4b 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs @@ -7,7 +7,7 @@ public class Web3WalletSendTransactionExample : MonoBehaviour async public void OnSendTransaction() { // https://chainlist.org/ - string chainId = "4"; // rinkeby + string chainId = "5"; // goerli // account to send to string to = "0xdD4c825203f97984e7867F11eeCc813A036089D1"; // value in wei diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs index 975f52895..2adfaf1d0 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs @@ -8,7 +8,7 @@ public class Web3WalletTransfer1155Example : MonoBehaviour async public void OnTransfer1155() { // https://chainlist.org/ - string chainId = "4"; // rinkeby + string chainId = "5"; // goerli // contract to interact with string contract = "0x6b0bc2e986b0e70db48296619a96e9ac02c5574b"; // value in wei diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs index 59118427a..b11a93b48 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs @@ -8,7 +8,7 @@ public class Web3WalletTransfer20Example : MonoBehaviour async public void OnTransfer20() { // https://chainlist.org/ - string chainId = "4"; // rinkeby + string chainId = "5"; // goerli // contract to interact with string contract = "0xc778417e063141139fce010982780140aa0cd5ab"; // value in wei diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs index a25a47263..192a35478 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs @@ -8,7 +8,7 @@ public class Web3WalletTransfer721Example : MonoBehaviour async public void OnTransfer721() { // https://chainlist.org/ - string chainId = "4"; // rinkeby + string chainId = "5"; // goerli // contract to interact with string contract = "0xde458cd3deaa28ce67beefe3f45368c875b3ffd6"; // value in wei diff --git a/WebGLTemplates/Cronos_Defi_Wallet/network.js b/WebGLTemplates/Cronos_Defi_Wallet/network.js index 58a386dd0..f205c6b61 100644 --- a/WebGLTemplates/Cronos_Defi_Wallet/network.js +++ b/WebGLTemplates/Cronos_Defi_Wallet/network.js @@ -1,8 +1,6 @@ /* Used to set the network: https://chainlist.org/ 1 Mainnet -3 Ropsten -4 Rinkeby 5 Goerli 42 Kovan 56 Binance Smart Chain Mainnet diff --git a/WebGLTemplates/Web3GL-2020x/network.js b/WebGLTemplates/Web3GL-2020x/network.js index 113c06eed..ed1fd816b 100644 --- a/WebGLTemplates/Web3GL-2020x/network.js +++ b/WebGLTemplates/Web3GL-2020x/network.js @@ -1,8 +1,6 @@ /* Used to set the network: https://chainlist.org/ 1 Mainnet -3 Ropsten -4 Rinkeby 5 Goerli 42 Kovan 56 Binance Smart Chain Mainnet From cabe153ed3799e4e98fd2769bf3b2f4482e3aa90 Mon Sep 17 00:00:00 2001 From: sneakzttv <57473220+sneakzttv@users.noreply.github.com> Date: Wed, 19 Oct 2022 03:19:22 +0800 Subject: [PATCH 10/13] Shimmer Mainnet and testnet Shimmer Mainnet and testnet added to private key sign parity v --- Web3Unity/Scripts/Library/Web3PrivateKey.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Web3Unity/Scripts/Library/Web3PrivateKey.cs b/Web3Unity/Scripts/Library/Web3PrivateKey.cs index 4c15e3724..67990f9dd 100755 --- a/Web3Unity/Scripts/Library/Web3PrivateKey.cs +++ b/Web3Unity/Scripts/Library/Web3PrivateKey.cs @@ -17,6 +17,8 @@ public class Web3PrivateKey const int AVA_TESTNET = 43113; const int ARBITRUM_MAINNET = 42161; const int ARBITRUM_TESTNET = 421613; + const int SHIMMER_MAINNET = 1074; + const int SHIMMER_TESTNET = 1076; public static string SignTransaction(string _privateKey, string _transaction, string _chainId) { @@ -29,7 +31,7 @@ public static string SignTransaction(string _privateKey, string _transaction, st BigInteger chainId = BigInteger.Parse(_chainId); // sign transaction if ((CHAIN_ID == MATIC_MAIN) || (CHAIN_ID == MATIC_MUMBAI) || (CHAIN_ID == HARMONY_MAINNET) || - (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET) || (CHAIN_ID == AVA_MAINNET) || (CHAIN_ID == AVA_TESTNET) || (CHAIN_ID == ARBITRUM_MAINNET) || (CHAIN_ID == ARBITRUM_TESTNET)) + (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET) || (CHAIN_ID == AVA_MAINNET) || (CHAIN_ID == AVA_TESTNET) || (CHAIN_ID == ARBITRUM_MAINNET) || (CHAIN_ID == ARBITRUM_TESTNET) || (CHAIN_ID == SHIMMER_MAINNET) || (CHAIN_ID == SHIMMER_TESTNET)) { signature = EthECDSASignature.CreateStringSignature(key.SignAndCalculateYParityV(hashByteArr)); return signature; From 9c52c6a6dcb157c024ed012080c30364e8011567 Mon Sep 17 00:00:00 2001 From: kwame Date: Wed, 19 Oct 2022 13:50:40 -0400 Subject: [PATCH 11/13] Updated CreateTransaction to support manually providing nonce This is an optional parameter provided by the API with the ability to provide a nonce if needed. --- Web3Unity/Scripts/Library/EVM.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Web3Unity/Scripts/Library/EVM.cs b/Web3Unity/Scripts/Library/EVM.cs index 0c9de368c..1bd37b00e 100755 --- a/Web3Unity/Scripts/Library/EVM.cs +++ b/Web3Unity/Scripts/Library/EVM.cs @@ -385,7 +385,8 @@ public static async Task ChainId(string _chain, string _network, string } } - public static async Task CreateTransaction(string _chain, string _network, string _account, string _to, string _value, string _data, string _gasPrice = "", string _gasLimit = "", string _rpc = "") + public static async Task CreateTransaction(string _chain, string _network, string _account, string _to, string _value, string _data, string _gasPrice = "", string _gasLimit = "", string _rpc = "", string _nonce = "" + ) { WWWForm form = new WWWForm(); form.AddField("chain", _chain); @@ -397,6 +398,7 @@ public static async Task CreateTransaction(string _chain, string _networ form.AddField("gasPrice", _gasPrice); form.AddField("gasLimit", _gasLimit); form.AddField("rpc", _rpc); + form.AddField("nonce", _nonce); string url = host + "/createTransaction"; using (UnityWebRequest webRequest = UnityWebRequest.Post(url, form)) { From bfd1d9148c97539697b9504288f7a7e14e2ce6eb Mon Sep 17 00:00:00 2001 From: kwame Date: Thu, 3 Nov 2022 14:04:01 -0400 Subject: [PATCH 12/13] 1.6.0 (#259) * v 1.6.0 update This build requires NewtonSoft 13.0.0 and Unity 2021.3.12f * add SDKConfiguration.dll * Added Unity Editor define * Update Server Settings / Update dll.prefab Updated ServerSettins.cs to point to Game Registration Dashboard Updated dll.prefab to use ServerCheck script * dll update dll update * dll updated dll was set to req staging, updated to prod Co-authored-by: Juan Manuel Spoleti <104365141+juans-chainsafe@users.noreply.github.com> Co-authored-by: sneakzttv <57473220+sneakzttv@users.noreply.github.com> --- Editor/ChainsafeServerSettings.cs | 110 ++++++++++++++ Editor/ChainsafeServerSettings.cs.meta | 11 ++ Plugins/GameRegistration.cs | 16 +++ Plugins/GameRegistration.cs.meta | 11 ++ Plugins/SDKConfiguration.dll | 3 + Resources/chainsafemenulogo.png | 3 + Resources/chainsafemenulogo.png.meta | 134 ++++++++++++++++++ Resources/dll.prefab | 46 ++++++ Resources/dll.prefab.meta | 7 + .../ERC1155/ImportNFTTextureExample.cs | 5 +- .../Prefabs/Minter/MintPK/MinterPK1155.prefab | 2 +- .../Prefabs/Minter/MintPK/MinterPK721.prefab | 2 +- .../Minter/WebGL/MinterWebGL1155.prefab | 2 +- .../Minter/WebGL/MinterWebGL721.prefab | 2 +- .../WebGL/VoucherMinterWebGL1155.prefab | 2 +- .../Minter/WebGL/VoucherMinterWebGL721.prefab | 2 +- .../Minter/WebWallet/BuyItemWebWallet.prefab | 4 +- Web3Unity/Scripts/Library/EVM.cs | 35 ++++- Web3Unity/Scripts/Library/EVM.cs.meta | 2 +- Web3Unity/Scripts/Library/Web3PrivateKey.cs | 6 +- Web3Unity/Scripts/Library/WebGL/Web3GL.cs | 34 ----- .../ERC1155/ERC1155BalanceOfBatchExample.cs | 2 +- .../ERC1155/ERC1155BalanceOfExample.cs | 10 +- .../Scripts/Prefabs/EVM/AllErc1155Example.cs | 2 +- .../Scripts/Prefabs/EVM/AllErc721Example.cs | 2 +- .../Scripts/Prefabs/EVM/BlockNumberExample.cs | 2 +- .../Scripts/Prefabs/EVM/CustomCallExample.cs | 2 +- .../Prefabs/EVM/EthBalanceOfExample.cs | 2 +- Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs | 2 +- .../Prefabs/Minter/GetListedNFTWebWallet.cs | 16 ++- .../Prefabs/Minter/ListNFTWebWallet.cs | 5 +- Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs | 2 +- .../Scripts/Prefabs/Minter/MintPK1155.cs | 2 +- Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs | 2 +- .../Prefabs/Minter/MintWeb3Wallet1155.cs | 15 +- .../Prefabs/Minter/MintWeb3Wallet721.cs | 2 +- .../Scripts/Prefabs/Minter/MintWebGL1155.cs | 10 +- .../Scripts/Prefabs/Minter/MintWebGL721.cs | 2 +- .../Web3PrivateKeySend1155Example.cs | 4 +- .../PrivateKey/Web3PrivateKeySend20Example.cs | 5 +- .../Web3PrivateKeySend721Example.cs | 4 +- .../Web3PrivateKeySendTransactionExample.cs | 4 +- .../Web3WalletSendTransactionExample.cs | 2 +- .../Wallet/Web3WalletTransfer1155Example.cs | 2 +- .../Wallet/Web3WalletTransfer20Example.cs | 2 +- .../Wallet/Web3WalletTransfer721Example.cs | 2 +- WebGLTemplates/Cronos_Defi_Wallet/network.js | 4 +- WebGLTemplates/Web3GL-2020x/network.js | 2 + 48 files changed, 450 insertions(+), 100 deletions(-) create mode 100644 Editor/ChainsafeServerSettings.cs create mode 100644 Editor/ChainsafeServerSettings.cs.meta create mode 100644 Plugins/GameRegistration.cs create mode 100644 Plugins/GameRegistration.cs.meta create mode 100644 Plugins/SDKConfiguration.dll create mode 100644 Resources/chainsafemenulogo.png create mode 100644 Resources/chainsafemenulogo.png.meta create mode 100644 Resources/dll.prefab create mode 100644 Resources/dll.prefab.meta diff --git a/Editor/ChainsafeServerSettings.cs b/Editor/ChainsafeServerSettings.cs new file mode 100644 index 000000000..5af1e0f3c --- /dev/null +++ b/Editor/ChainsafeServerSettings.cs @@ -0,0 +1,110 @@ +using UnityEditor; +using System.Collections; +using UnityEngine; +using SDKConfiguration; +using System; + +public class ChainSafeServerSettings : EditorWindow +{ + public string ProjectID = "Please Enter Your Project ID"; + public string ChainID = "Please Enter Your Chain ID"; + public string Chain = "Please Enter Your Chain i.e Ethereum, Binance, Cronos"; + public string Network = "Please Enter Your Network i.e Mainnet, Testnet"; + public string RPC = "Please Enter Your RPC"; + public User saveObject; + Texture2D m_Logo = null; + GameObject serverCheck = null; + + // checks if data is already entered + void Awake() + { + if ((ProjectID == ("Please Enter Your Project ID")) && (PlayerPrefs.GetString("ProjectID") != "")) + { + ProjectID = PlayerPrefs.GetString("ProjectID"); + } + + if ((ChainID == ("Please Enter Your Chain ID")) && (PlayerPrefs.GetString("ChainID") != "")) + { + ChainID = PlayerPrefs.GetString("ChainID"); + PlayerPrefs.SetInt("ChainIDInt", int.Parse(PlayerPrefs.GetString("ChainID"))); + } + + if (Chain == ("Please Enter Your Chain i.e Ethereum, Binance, Cronos") && (PlayerPrefs.GetString("Chain") != "")) + { + Chain = PlayerPrefs.GetString("Chain"); + } + + if (Network == ("Please Enter Your Network i.e Mainnet, Testnet") && (PlayerPrefs.GetString("Network") != "")) + { + Network = PlayerPrefs.GetString("Network"); + } + + if (RPC == ("Please Enter Your RPC") && (PlayerPrefs.GetString("RPC") != "")) + { + RPC = PlayerPrefs.GetString("RPC"); + } + } + + // Initializes window + [MenuItem("Window/ChainSafeServerSettings")] + public static void ShowWindow() + { + // show existing window instance. If one doesn't exist, make one. + EditorWindow.GetWindow(typeof(ChainSafeServerSettings)); + } + + // called when menu is opened, loads Chainsafe Logo + void OnEnable() + { + m_Logo = (Texture2D)Resources.Load("chainsafemenulogo", typeof(Texture2D)); + } + + // displayed content + void OnGUI() + { + // image + EditorGUILayout.BeginVertical("box"); + GUILayout.Label(m_Logo, GUILayout.MaxWidth(250f), GUILayout.MaxHeight(250f)); + EditorGUILayout.EndVertical(); + // text + GUILayout.Label ("Welcome To The ChainSafe SDK!", EditorStyles.boldLabel); + GUILayout.Label ("Here you can enter all the information needed to get your game started on the blockchain!", EditorStyles.label); + // inputs + ProjectID = EditorGUILayout.TextField ("Project ID", ProjectID); + ChainID = EditorGUILayout.TextField ("Chain ID", ChainID); + Chain = EditorGUILayout.TextField ("Chain", Chain); + Network = EditorGUILayout.TextField ("Network", Network); + RPC = EditorGUILayout.TextField ("RPC", RPC); + // buttons + + // register + if (GUILayout.Button("Need To Register?")) + { + Application.OpenURL("https://dashboard.gaming.chainsafe.io/"); + } + // docs + if (GUILayout.Button("Check Out Our Docs!")) + { + Application.OpenURL("https://docs.gaming.chainsafe.io/"); + } + // save button + if (GUILayout.Button("Save Settings")) + { + Debug.Log("Saving Settings!"); + // set player prefs for unity open close + PlayerPrefs.SetString("ProjectID", ProjectID); + PlayerPrefs.SetString("ChainID", ChainID); + PlayerPrefs.SetString("Chain", Chain); + PlayerPrefs.SetInt("ChainIDInt", int.Parse(PlayerPrefs.GetString("ChainID"))); + PlayerPrefs.SetString("Network", Network); + PlayerPrefs.SetString("RPC", RPC); + PlayerPrefs.SetString("Registered", "true"); + // assign script to prefab and instantiate then destroy after + serverCheck = (GameObject)Resources.Load("dll", typeof(GameObject)); + GameObject serverCheckScript = (GameObject)Instantiate(serverCheck, new Vector3(0,0,0), new Quaternion(0,0,0,0)); + serverCheckScript.GetComponent().CheckProject(); + Debug.Log("Server Check Script: " + serverCheck); + } + GUILayout.Label ("Reminder: Your ProjectID Must Be Valid To Save & Build With Our SDK. You Can Register For One On Our Website At Dashboard.Gaming.Chainsafe.io", EditorStyles.label); + } +} \ No newline at end of file diff --git a/Editor/ChainsafeServerSettings.cs.meta b/Editor/ChainsafeServerSettings.cs.meta new file mode 100644 index 000000000..0fdee00e0 --- /dev/null +++ b/Editor/ChainsafeServerSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 137e7c488f5f7df438703b4ad74e92b0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/GameRegistration.cs b/Plugins/GameRegistration.cs new file mode 100644 index 000000000..7d5a2eb70 --- /dev/null +++ b/Plugins/GameRegistration.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using UnityEditor; + +#if UNITY_EDITOR +[InitializeOnLoad] +public class Startup +{ + static Startup() + { + if (PlayerPrefs.GetString("Registered") == "") + { + Debug.LogError("ProjectID Not Valid! Please Go To Dashboard.Gaming.Chainsafe.io To Get A New ProjectID"); + } + } +} +#endif \ No newline at end of file diff --git a/Plugins/GameRegistration.cs.meta b/Plugins/GameRegistration.cs.meta new file mode 100644 index 000000000..f964aee2d --- /dev/null +++ b/Plugins/GameRegistration.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 993ad1acf6df95444bc585055b760de9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/SDKConfiguration.dll b/Plugins/SDKConfiguration.dll new file mode 100644 index 000000000..6a3d5ea14 --- /dev/null +++ b/Plugins/SDKConfiguration.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3d5348eebb286c48bedb034189c0030aee32cb0f145136a4a18aff6eb6ca0aa +size 9216 diff --git a/Resources/chainsafemenulogo.png b/Resources/chainsafemenulogo.png new file mode 100644 index 000000000..af9c97e62 --- /dev/null +++ b/Resources/chainsafemenulogo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ecc494608b5e5d67817e8d32504109439a9bfa54cb9a4f7e52e14afe8ddbd43 +size 256287 diff --git a/Resources/chainsafemenulogo.png.meta b/Resources/chainsafemenulogo.png.meta new file mode 100644 index 000000000..2ecf3f991 --- /dev/null +++ b/Resources/chainsafemenulogo.png.meta @@ -0,0 +1,134 @@ +fileFormatVersion: 2 +guid: 05b191c1eedcefd418f509b7d13ac4dd +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Resources/dll.prefab b/Resources/dll.prefab new file mode 100644 index 000000000..4f631f8e8 --- /dev/null +++ b/Resources/dll.prefab @@ -0,0 +1,46 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2363481889909424522 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2363481889909424524} + - component: {fileID: 2363481889909424525} + m_Layer: 0 + m_Name: dll + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2363481889909424524 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2363481889909424522} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 321.5, y: 256.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2363481889909424525 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2363481889909424522} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 609973315, guid: bcbd7a470156fc8439e66c0faaa9a746, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Resources/dll.prefab.meta b/Resources/dll.prefab.meta new file mode 100644 index 000000000..8cfd1a299 --- /dev/null +++ b/Resources/dll.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 55fea592f5275b84fae481aaaa15c311 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs b/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs index 0ead20dea..926b10549 100644 --- a/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs +++ b/Web3Unity/Prefabs/ERC1155/ImportNFTTextureExample.cs @@ -9,14 +9,13 @@ public class ImportNFTTextureExample : MonoBehaviour public class Response { public string image; } - async void Start() { string chain = "ethereum"; string network = "goerli"; - string contract = "0x2c1867BC3026178A47a677513746DCc6822A137A"; - string tokenId = "0x01559ae4021a8aad9226aef5beee2a0d8ba61eaac07e3bc71d2d9e9a802a216f"; + string contract = "0x2c1867bc3026178a47a677513746dcc6822a137a"; + string tokenId = "0x01559ae4021aee70424836ca173b6a4e647287d15cee8ac42d8c2d8d128927e5"; // fetch uri from chain string uri = await ERC1155.URI(chain, network, contract, tokenId); diff --git a/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab b/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab index 4c242a58b..9e5a9624f 100644 --- a/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab +++ b/Web3Unity/Prefabs/Minter/MintPK/MinterPK1155.prefab @@ -213,7 +213,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: goerli + network: rinkeby account: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c to: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c cid: f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c diff --git a/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab b/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab index e05066c94..3e6eb4466 100644 --- a/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab +++ b/Web3Unity/Prefabs/Minter/MintPK/MinterPK721.prefab @@ -213,7 +213,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: goerli + network: rinkeby account: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c to: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c cid: QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj diff --git a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab index bdb7cdfaa..17205a0fc 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL1155.prefab @@ -424,7 +424,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: goerli + network: rinkeby account: to: 0x148dC439Ffe10DF915f1DA14AA780A47A577709E cid: f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c diff --git a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab index f9d350800..af8e20873 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/MinterWebGL721.prefab @@ -424,7 +424,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: goerli + network: rinkeby account: to: 0x148dC439Ffe10DF915f1DA14AA780A47A577709E cid: QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj diff --git a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab index e550c15eb..e588732f4 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL1155.prefab @@ -148,7 +148,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: goerli + network: rinkeby account: to: 0x148dC439Ffe10DF915f1DA14AA780A47A577709E cid: f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c diff --git a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab index 8c8f108c4..49901db50 100644 --- a/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab +++ b/Web3Unity/Prefabs/Minter/WebGL/VoucherMinterWebGL721.prefab @@ -294,7 +294,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: chain: ethereum - network: goerli + network: rinkeby account: to: 0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c cid: QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj diff --git a/Web3Unity/Prefabs/Minter/WebWallet/BuyItemWebWallet.prefab b/Web3Unity/Prefabs/Minter/WebWallet/BuyItemWebWallet.prefab index 6fcff78d6..a2287007b 100644 --- a/Web3Unity/Prefabs/Minter/WebWallet/BuyItemWebWallet.prefab +++ b/Web3Unity/Prefabs/Minter/WebWallet/BuyItemWebWallet.prefab @@ -266,7 +266,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Contract + m_Text: item Id --- !u!1 &1779503713121749347 GameObject: m_ObjectHideFlags: 0 @@ -929,7 +929,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Contract + m_Text: tokenId --- !u!1 &5902257893785959999 GameObject: m_ObjectHideFlags: 0 diff --git a/Web3Unity/Scripts/Library/EVM.cs b/Web3Unity/Scripts/Library/EVM.cs index 1bd37b00e..98a3ad3d7 100755 --- a/Web3Unity/Scripts/Library/EVM.cs +++ b/Web3Unity/Scripts/Library/EVM.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Numerics; +using System.Text; using System.Threading.Tasks; using Models; using UnityEngine; using UnityEngine.Networking; using Newtonsoft.Json; +using SDKConfiguration; public class EVM { @@ -17,6 +19,7 @@ public class Response { public T response; } public static async Task BalanceOf(string _chain, string _network, string _account, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -33,6 +36,7 @@ public static async Task BalanceOf(string _chain, string _network, strin public static async Task Verify(string _message, string _signature) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("message", _message); form.AddField("signature", _signature); string url = host + "/verify"; @@ -47,6 +51,7 @@ public static async Task Verify(string _message, string _signature) public static async Task Call(string _chain, string _network, string _contract, string _abi, string _method, string _args, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("contract", _contract); @@ -66,6 +71,7 @@ public static async Task Call(string _chain, string _network, string _co public static async Task MultiCall(string _chain, string _network, string _contract, string _abi, string _method, string _args, string _multicall = "", string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("contract", _contract); @@ -86,6 +92,7 @@ public static async Task MultiCall(string _chain, string _network, strin public static async Task TxStatus(string _chain, string _network, string _transaction, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("transaction", _transaction); @@ -101,7 +108,14 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task CreateMint(string _chain, string _network, string _account, string _to, string _cid, string _type) { + Debug.Log("Chain: " + _chain); + Debug.Log("Network: " + _network); + Debug.Log("Account: " + _account); + Debug.Log("to: " + _to); + Debug.Log("CID: " + _cid); + Debug.Log("Type: " + _type); WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -113,6 +127,7 @@ public static async Task TxStatus(string _chain, string _network, string { await webRequest.SendWebRequest(); CreateMintModel.Root data = JsonUtility.FromJson(System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); + Debug.Log("Data: " + JsonConvert.SerializeObject( data.response, Formatting.Indented )); return data.response; } } @@ -120,6 +135,7 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task> GetNftMarket(string _chain, string _network) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); string url = host + "/getListedNfts"; @@ -134,6 +150,7 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task> GetMintedNFT(string _chain, string _network, string _account) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -149,6 +166,7 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task CreatePurchaseNftTransaction(string _chain, string _network, string _account, string _itemId, string _price, string _tokenType) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -176,6 +194,7 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task CreateListNftTransaction(string _chain, string _network, string _account, string _tokenId, string _priceHex, string _tokenType) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -198,6 +217,7 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task> CreateCancelNftTransaction(string _chain, string _network, string _account, string _itemId) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -240,6 +260,7 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task CreateApproveTransaction(string _chain, string _network, string _account, string _tokenType) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -257,6 +278,7 @@ public static async Task TxStatus(string _chain, string _network, string public static async Task BlockNumber(string _chain, string _network, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("rpc", _rpc); @@ -272,6 +294,7 @@ public static async Task BlockNumber(string _chain, string _network, string public static async Task Nonce(string _chain, string _network, string _account, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -288,6 +311,7 @@ public static async Task Nonce(string _chain, string _network, string _a public static async Task CreateContractData(string _abi, string _method, string _args) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("abi", _abi); form.AddField("method", _method); form.AddField("args", _args); @@ -303,6 +327,7 @@ public static async Task CreateContractData(string _abi, string _method, public static async Task AllErc721(string _chain, string _network, string _account, string _contract = "", int _first = 500, int _skip = 0) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -322,6 +347,7 @@ public static async Task AllErc721(string _chain, string _network, strin public static async Task AllErc1155(string _chain, string _network, string _account, string _contract = "", int _first = 500, int _skip = 0) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -340,6 +366,7 @@ public static async Task AllErc1155(string _chain, string _network, stri public static async Task GasPrice(string _chain, string _network, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("rpc", _rpc); @@ -355,6 +382,7 @@ public static async Task GasPrice(string _chain, string _network, string public static async Task GasLimit(string _chain, string _network, string _to, string _value, string _data, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("to", _to); @@ -373,6 +401,7 @@ public static async Task GasLimit(string _chain, string _network, string public static async Task ChainId(string _chain, string _network, string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("rpc", _rpc); @@ -385,10 +414,10 @@ public static async Task ChainId(string _chain, string _network, string } } - public static async Task CreateTransaction(string _chain, string _network, string _account, string _to, string _value, string _data, string _gasPrice = "", string _gasLimit = "", string _rpc = "", string _nonce = "" - ) + public static async Task CreateTransaction(string _chain, string _network, string _account, string _to, string _value, string _data, string _gasPrice = "", string _gasLimit = "", string _rpc = "") { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); @@ -398,7 +427,6 @@ public static async Task CreateTransaction(string _chain, string _networ form.AddField("gasPrice", _gasPrice); form.AddField("gasLimit", _gasLimit); form.AddField("rpc", _rpc); - form.AddField("nonce", _nonce); string url = host + "/createTransaction"; using (UnityWebRequest webRequest = UnityWebRequest.Post(url, form)) { @@ -411,6 +439,7 @@ public static async Task CreateTransaction(string _chain, string _networ public static async Task BroadcastTransaction(string _chain, string _network, string _account, string _to, string _value, string _data, string _signature, string _gasPrice, string _gasLimit, string _rpc) { WWWForm form = new WWWForm(); + form.AddField("projectId", PlayerPrefs.GetString("ProjectID")); form.AddField("chain", _chain); form.AddField("network", _network); form.AddField("account", _account); diff --git a/Web3Unity/Scripts/Library/EVM.cs.meta b/Web3Unity/Scripts/Library/EVM.cs.meta index 309c6d4b1..1734dd59b 100644 --- a/Web3Unity/Scripts/Library/EVM.cs.meta +++ b/Web3Unity/Scripts/Library/EVM.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3dcb1112636e547e8a000598cb169ba8 +guid: 0a20f58bbac8e2046bc9318279d54210 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Web3Unity/Scripts/Library/Web3PrivateKey.cs b/Web3Unity/Scripts/Library/Web3PrivateKey.cs index 67990f9dd..8cc3ff269 100755 --- a/Web3Unity/Scripts/Library/Web3PrivateKey.cs +++ b/Web3Unity/Scripts/Library/Web3PrivateKey.cs @@ -15,10 +15,6 @@ public class Web3PrivateKey const int FTM_TESTNET = 0xfa2; const int AVA_MAINNET = 43114; const int AVA_TESTNET = 43113; - const int ARBITRUM_MAINNET = 42161; - const int ARBITRUM_TESTNET = 421613; - const int SHIMMER_MAINNET = 1074; - const int SHIMMER_TESTNET = 1076; public static string SignTransaction(string _privateKey, string _transaction, string _chainId) { @@ -31,7 +27,7 @@ public static string SignTransaction(string _privateKey, string _transaction, st BigInteger chainId = BigInteger.Parse(_chainId); // sign transaction if ((CHAIN_ID == MATIC_MAIN) || (CHAIN_ID == MATIC_MUMBAI) || (CHAIN_ID == HARMONY_MAINNET) || - (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET) || (CHAIN_ID == AVA_MAINNET) || (CHAIN_ID == AVA_TESTNET) || (CHAIN_ID == ARBITRUM_MAINNET) || (CHAIN_ID == ARBITRUM_TESTNET) || (CHAIN_ID == SHIMMER_MAINNET) || (CHAIN_ID == SHIMMER_TESTNET)) + (CHAIN_ID == HARMONY_TESTNET) || (CHAIN_ID == CRONOS_MAINNET) || (CHAIN_ID == CRONOS_TESTNET) || (CHAIN_ID == FTM_MAINNET) || (CHAIN_ID == FTM_TESTNET) || (CHAIN_ID == AVA_MAINNET) || (CHAIN_ID == AVA_TESTNET)) { signature = EthECDSASignature.CreateStringSignature(key.SignAndCalculateYParityV(hashByteArr)); return signature; diff --git a/Web3Unity/Scripts/Library/WebGL/Web3GL.cs b/Web3Unity/Scripts/Library/WebGL/Web3GL.cs index 6d7ac7048..9655ffd54 100644 --- a/Web3Unity/Scripts/Library/WebGL/Web3GL.cs +++ b/Web3Unity/Scripts/Library/WebGL/Web3GL.cs @@ -17,18 +17,6 @@ public class Web3GL [DllImport("__Internal")] private static extern void SetContractResponse(string value); - [DllImport("__Internal")] - private static extern void CallContractJs(string method, string abi, string contract, string args); - - [DllImport("__Internal")] - private static extern void ResetCallContractResponse(); - - [DllImport("__Internal")] - private static extern string CallContractResponse(); - - [DllImport("__Internal")] - private static extern string CallContractError(); - [DllImport("__Internal")] private static extern void SendTransactionJs(string to, string value, string gasLimit, string gasPrice); @@ -66,28 +54,6 @@ public class Web3GL [DllImport("__Internal")] private static extern int GetNetwork(); - async public static Task CallContract(string _method, string _abi, string _contract, string _args, float _waitSeconds = 0.1f) - { - ResetCallContractResponse(); - CallContractJs(_method, _abi, _contract, _args); - string response = CallContractResponse(); - string error = CallContractError(); - while (response == "" && error == "") - { - await new WaitForSeconds(_waitSeconds); - response = CallContractResponse(); - error = CallContractError(); - } - ResetCallContractResponse(); - if (error.Length > 0) - { - throw new Exception(error); - } else - { - return response; - } - } - // this function will create a metamask tx for user to confirm. async public static Task SendContract(string _method, string _abi, string _contract, string _args, string _value, string _gasLimit = "", string _gasPrice = "") { diff --git a/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs b/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs index e46a9d07f..0a9c41b8c 100644 --- a/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs +++ b/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfBatchExample.cs @@ -8,7 +8,7 @@ public class ERC1155BalanceOfBatchExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "goerli"; + string network = "rinkeby"; string contract = "0x2ebecabbbe8a8c629b99ab23ed154d74cd5d4342"; string[] accounts = { "0xaCA9B6D9B1636D99156bB12825c75De1E5a58870", "0xaCA9B6D9B1636D99156bB12825c75De1E5a58870" }; string[] tokenIds = { "17", "22" }; diff --git a/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfExample.cs b/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfExample.cs index f7d7f7c57..ad1be957d 100644 --- a/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfExample.cs +++ b/Web3Unity/Scripts/Prefabs/ERC1155/ERC1155BalanceOfExample.cs @@ -7,11 +7,11 @@ public class ERC1155BalanceOfExample : MonoBehaviour { async void Start() { - string chain = "avalanche"; - string network = "testnet"; - string contract = "0xbDF2d708c6E4705824dC024187cd219da41C8c81"; - string account = "0xdD4c825203f97984e7867F11eeCc813A036089D1"; - string tokenId = "2"; + string chain = "ethereum"; + string network = "goerli"; + string contract = "0x2c1867bc3026178a47a677513746dcc6822a137a"; + string account = "0xd25b827D92b0fd656A1c829933e9b0b836d5C3e2"; + string tokenId = "0x01559ae4021aee70424836ca173b6a4e647287d15cee8ac42d8c2d8d128927e5"; BigInteger balanceOf = await ERC1155.BalanceOf(chain, network, contract, account, tokenId); print(balanceOf); diff --git a/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs b/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs index 40a5d18ef..54d5dcc19 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs @@ -16,7 +16,7 @@ private class NFTs async void Start() { string chain = "ethereum"; - string network = "goerli"; // mainnet kovan goerli + string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli string account = "0xebc0e6232fb9d494060acf580105108444f7c696"; string contract = ""; int first = 500; diff --git a/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs b/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs index 7cedef9f0..c5db888a5 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs @@ -16,7 +16,7 @@ private class NFTs async void Start() { string chain = "ethereum"; - string network = "goerli"; // mainnet kovan goerli + string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli string account = "0xebc0e6232fb9d494060acf580105108444f7c696"; string contract = ""; int first = 500; diff --git a/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs b/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs index ae71ccd7d..ebd1513ca 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/BlockNumberExample.cs @@ -7,7 +7,7 @@ public class BlockNumberExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "mainnet"; // mainnet kovan goerli + string network = "mainnet"; // mainnet ropsten kovan rinkeby goerli int blockNumber = await EVM.BlockNumber(chain, network); print(blockNumber); } diff --git a/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs b/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs index ae1c74520..47ab7ba66 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/CustomCallExample.cs @@ -21,7 +21,7 @@ function addTotal(uint8 _myArg) public { // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "goerli"; + string network = "rinkeby"; // smart contract method to call string method = "myTotal"; // abi in json format diff --git a/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs b/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs index bcbbeeedf..21b07fcbe 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/EthBalanceOfExample.cs @@ -7,7 +7,7 @@ public class EthBalanceOfExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "goerli"; // mainnet kovan goerli + string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli string account = "0xdD4c825203f97984e7867F11eeCc813A036089D1"; string balance = await EVM.BalanceOf(chain, network, account); diff --git a/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs b/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs index 88b324c51..5e495f326 100644 --- a/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs +++ b/Web3Unity/Scripts/Prefabs/EVM/NonceExample.cs @@ -7,7 +7,7 @@ public class NonceExample : MonoBehaviour async void Start() { string chain = "ethereum"; - string network = "goerli"; + string network = "rinkeby"; string account = "0xdD4c825203f97984e7867F11eeCc813A036089D1"; string nonce = await EVM.Nonce(chain, network, account); diff --git a/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs b/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs index f0ae3968e..7b6a18869 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/GetListedNFTWebWallet.cs @@ -57,8 +57,16 @@ async void Start() await webRequest.SendWebRequest(); RootGetNFT data = JsonConvert.DeserializeObject( - System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); - description.text = data.description; + System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); + if (data.description == null) + { + description.text = ""; + } + else + { + description.text = data.description; + } + // parse json to get image uri string imageUri = data.image; if (imageUri.StartsWith("ipfs://")) @@ -66,6 +74,10 @@ async void Start() imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); StartCoroutine(DownloadImage(imageUri)); } + else + { + StartCoroutine(DownloadImage(imageUri)); + } if (data.properties != null) { diff --git a/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs b/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs index 82daeba85..5a3147e4c 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/ListNFTWebWallet.cs @@ -68,6 +68,10 @@ async void Start() imageUri = imageUri.Replace("ipfs://", "https://ipfs.io/ipfs/"); StartCoroutine(DownloadImage(imageUri)); } + else + { + StartCoroutine(DownloadImage(imageUri)); + } tokenURI.text = response[1].uri; Debug.Log(response[1].uri); @@ -84,7 +88,6 @@ async void Start() noListedItems.text = "NO LISTED ITEM for " + account; Debug.Log("No Listed Items" + e); } - } // ReSharper disable Unity.PerformanceAnalysis diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs b/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs index b9a9195e9..65ee4b434 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintIPFS.cs @@ -9,7 +9,7 @@ public class MintIPFS : MonoBehaviour // Start is called before the first frame update public string chain = "ethereum"; - public string network = "goerli"; // mainnet kovan goerli + public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli public string account = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string type = "721"; // for 1155 assets update type. diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs index bc38e17e6..16c99513c 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintPK1155.cs @@ -9,7 +9,7 @@ public class MintPK1155 : MonoBehaviour // Start is called before the first frame update public string chain = "ethereum"; - public string network = "goerli"; // mainnet kovan goerli + public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli public string account = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string cid = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs index 8cb184190..2b0604001 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintPK721.cs @@ -9,7 +9,7 @@ public class MintPK721 : MonoBehaviour // Start is called before the first frame update public string chain = "ethereum"; - public string network = "goerli"; // mainnet kovan goerli + public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli public string account = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string cid = "QmXjWjjMU8r39UCEZ8483aNedwNRFRLvvV9kwq1GpCgthj"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs index 7ee9d86f6..e2733a67e 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet1155.cs @@ -1,5 +1,6 @@ using System; using Models; +using Newtonsoft.Json; using UnityEngine; namespace Web3Unity.Scripts.Prefabs.Minter @@ -8,17 +9,18 @@ public class MintWeb3Wallet1155 : MonoBehaviour { private string chain = "ethereum"; - private string network = "goerli"; // mainnet kovan goerli + private string network = "goerli"; // mainnet ropsten kovan rinkeby goerli private string account; private string to; - public string cid1155 = "bafkzvzacdlxhaqsig3fboo3kjzshfb6rltxivrbnrqwy2euje7sq"; + private string cid1155 = "bafkzvzacdjqx6xc4rsmdiusbwvxmsbboj5vwr7jblef4dtlabjta"; private string chainId = "5"; - public string type1155 = "1155"; + private string type1155 = "1155"; - public void Awake() + public void Start() { account = PlayerPrefs.GetString("Account"); to = PlayerPrefs.GetString("Account"); + Debug.Log("Acoount" + account); Debug.Log("To" + to); } @@ -26,13 +28,12 @@ public void Awake() public async void MintNft1155() { CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid1155, type1155); - Debug.Log("NFT Response: " + nftResponse); + Debug.Log("Data: " + JsonConvert.SerializeObject( nftResponse, Formatting.Indented )); // connects to user's browser wallet (metamask) to send a transaction try { string response = await Web3Wallet.SendTransaction(chainId, nftResponse.tx.to, nftResponse.tx.value, nftResponse.tx.data, nftResponse.tx.gasLimit, nftResponse.tx.gasPrice); - print(response); - Debug.Log(response); + print("Response Data: " + response); } catch (Exception e) { Debug.LogException(e, this); } diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs index d28de829d..8800ed3a0 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWeb3Wallet721.cs @@ -8,7 +8,7 @@ public class MintWeb3Wallet721 : MonoBehaviour { public string chain = "ethereum"; - public string network = "goerli"; // mainnet kovan goerli + public string network = "goerli"; // mainnet ropsten kovan rinkeby goerli public string account; public string to = "0x7259E32e35cf880aEACfbD412E7F4Baa8606e04c"; public string cid721 = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs index 992ab633c..45ebc4e07 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL1155.cs @@ -10,11 +10,11 @@ public class MintWebGL1155 : MonoBehaviour { // Start is called before the first frame update public string chain = "ethereum"; - public string network = "goerli"; // mainnet kovan goerli + public string network = "goerli"; // mainnet ropsten kovan rinkeby goerli public string account; public string to; - public string cid = "f01559ae4021a47e26bc773587278f62a833f2a6117411afbc5a7855661936d1c"; - public string type721 = "1155"; + private string cid = "bafkzvzacdlxhaqsig3fboo3kjzshfb6rltxivrbnrqwy2euje7sq"; + private string type1155 = "1155"; public void Awake() @@ -25,7 +25,7 @@ public void Awake() public async void MintNFT() { - CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid,type721); + CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid,type1155); // connects to user's browser wallet (metamask) to send a transaction try { @@ -40,7 +40,7 @@ public async void VoucherMintNFT() { // validates the account that sent the voucher, you can change this if you like to fit your system if (PlayerPrefs.GetString("WebGLVoucher1155") == "0x1372199B632bd6090581A0588b2f4F08985ba2d4"){ - CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid,type721); + CreateMintModel.Response nftResponse = await EVM.CreateMint(chain, network, account, to, cid,type1155); // connects to user's browser wallet (metamask) to send a transaction try { diff --git a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs index 2998dd1da..06e0434d6 100644 --- a/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs +++ b/Web3Unity/Scripts/Prefabs/Minter/MintWebGL721.cs @@ -10,7 +10,7 @@ public class MintWebGL721 : MonoBehaviour { // Start is called before the first frame update public string chain = "ethereum"; - public string network = "goerli"; // mainnet kovan goerli + public string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli public string account; public string to; // update cid per mint diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs index 5e361a1ad..92d6d8ff8 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend1155Example.cs @@ -12,7 +12,7 @@ async public void OnSend1155() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "goerli"; + string network = "rinkeby"; // smart contract method to call string method = "safeTransferFrom"; // account of player @@ -42,6 +42,6 @@ async public void OnSend1155() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, contract, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://goerli.etherscan.io/tx/" + response); + Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); } } diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs index 74a967df4..43465b10b 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend20Example.cs @@ -12,11 +12,12 @@ async public void OnSend20() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "goerli"; + string network = "rinkeby"; // smart contract method to call string method = "transfer"; // account of player string account = Web3PrivateKey.Address(privateKey); + // smart contract address: https://rinkeby.etherscan.io/address/0xc7ad46e0b8a400bb3c915120d284aafba8fc4735 string contract = "0xc7ad46e0b8a400bb3c915120d284aafba8fc4735"; // account to send to string toAccount = "0x428066dd8A212104Bc9240dCe3cdeA3D3A0f7979"; @@ -39,6 +40,6 @@ async public void OnSend20() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, contract, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://goerli.etherscan.io/tx/" + response); + Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); } } \ No newline at end of file diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs index ceea2a715..74f24bcf3 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySend721Example.cs @@ -12,7 +12,7 @@ async public void OnSend721() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "goerli"; + string network = "rinkeby"; // smart contract method to call string method = "safeTransferFrom"; // account of player @@ -40,6 +40,6 @@ async public void OnSend721() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, contract, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://goerli.etherscan.io/tx/" + response); + Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); } } \ No newline at end of file diff --git a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs index ec807256e..bededc211 100755 --- a/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs +++ b/Web3Unity/Scripts/Prefabs/PrivateKey/Web3PrivateKeySendTransactionExample.cs @@ -12,7 +12,7 @@ async public void OnSendTransaction() // set chain: ethereum, moonbeam, polygon etc string chain = "ethereum"; // set network mainnet, testnet - string network = "goerli"; + string network = "rinkeby"; // account of player string account = Web3PrivateKey.Address(privateKey); // account to send to @@ -30,6 +30,6 @@ async public void OnSendTransaction() string signature = Web3PrivateKey.SignTransaction(privateKey, transaction, chainId); string response = await EVM.BroadcastTransaction(chain, network, account, to, value, data, signature, gasPrice, gasLimit, rpc); print(response); - Application.OpenURL("https://goerli.etherscan.io/tx/" + response); + Application.OpenURL("https://rinkeby.etherscan.io/tx/" + response); } } diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs index a6766bd4b..582c7a08e 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletSendTransactionExample.cs @@ -7,7 +7,7 @@ public class Web3WalletSendTransactionExample : MonoBehaviour async public void OnSendTransaction() { // https://chainlist.org/ - string chainId = "5"; // goerli + string chainId = "4"; // rinkeby // account to send to string to = "0xdD4c825203f97984e7867F11eeCc813A036089D1"; // value in wei diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs index 2adfaf1d0..975f52895 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer1155Example.cs @@ -8,7 +8,7 @@ public class Web3WalletTransfer1155Example : MonoBehaviour async public void OnTransfer1155() { // https://chainlist.org/ - string chainId = "5"; // goerli + string chainId = "4"; // rinkeby // contract to interact with string contract = "0x6b0bc2e986b0e70db48296619a96e9ac02c5574b"; // value in wei diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs index b11a93b48..59118427a 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer20Example.cs @@ -8,7 +8,7 @@ public class Web3WalletTransfer20Example : MonoBehaviour async public void OnTransfer20() { // https://chainlist.org/ - string chainId = "5"; // goerli + string chainId = "4"; // rinkeby // contract to interact with string contract = "0xc778417e063141139fce010982780140aa0cd5ab"; // value in wei diff --git a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs index 192a35478..a25a47263 100644 --- a/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs +++ b/Web3Unity/Scripts/Prefabs/Wallet/Web3WalletTransfer721Example.cs @@ -8,7 +8,7 @@ public class Web3WalletTransfer721Example : MonoBehaviour async public void OnTransfer721() { // https://chainlist.org/ - string chainId = "5"; // goerli + string chainId = "4"; // rinkeby // contract to interact with string contract = "0xde458cd3deaa28ce67beefe3f45368c875b3ffd6"; // value in wei diff --git a/WebGLTemplates/Cronos_Defi_Wallet/network.js b/WebGLTemplates/Cronos_Defi_Wallet/network.js index f205c6b61..d9deb447f 100644 --- a/WebGLTemplates/Cronos_Defi_Wallet/network.js +++ b/WebGLTemplates/Cronos_Defi_Wallet/network.js @@ -1,6 +1,8 @@ /* Used to set the network: https://chainlist.org/ 1 Mainnet +3 Ropsten +4 Rinkeby 5 Goerli 42 Kovan 56 Binance Smart Chain Mainnet @@ -18,8 +20,6 @@ Used to set the network: https://chainlist.org/ 1666600000 Harmony Mainnet Shard0 25 Cronos Mainnet Beta 338 Cronos Testnet -40 Telos Mainnet -41 Telos Testnet */ window.web3ChainId = 1; diff --git a/WebGLTemplates/Web3GL-2020x/network.js b/WebGLTemplates/Web3GL-2020x/network.js index ed1fd816b..113c06eed 100644 --- a/WebGLTemplates/Web3GL-2020x/network.js +++ b/WebGLTemplates/Web3GL-2020x/network.js @@ -1,6 +1,8 @@ /* Used to set the network: https://chainlist.org/ 1 Mainnet +3 Ropsten +4 Rinkeby 5 Goerli 42 Kovan 56 Binance Smart Chain Mainnet From 6cfa3b4ba2d6d1c3c4be9ee67e758156e14cc5b4 Mon Sep 17 00:00:00 2001 From: sneakzttv <57473220+sneakzttv@users.noreply.github.com> Date: Fri, 4 Nov 2022 16:19:46 +0800 Subject: [PATCH 13/13] update to gameregistration.cs added a more descriptive explanation of where to enter project id --- Plugins/GameRegistration.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/GameRegistration.cs b/Plugins/GameRegistration.cs index 7d5a2eb70..0a099119a 100644 --- a/Plugins/GameRegistration.cs +++ b/Plugins/GameRegistration.cs @@ -9,8 +9,8 @@ static Startup() { if (PlayerPrefs.GetString("Registered") == "") { - Debug.LogError("ProjectID Not Valid! Please Go To Dashboard.Gaming.Chainsafe.io To Get A New ProjectID"); + Debug.LogError("ProjectID Not Valid! Please Go To Dashboard.Gaming.Chainsafe.io To Get A New ProjectID & Enter It By Pressing Window -> ChainsafeServerSettings"); } } } -#endif \ No newline at end of file +#endif