Skip to content

Commit

Permalink
added tg wallet support
Browse files Browse the repository at this point in the history
  • Loading branch information
purpleguy99 committed Apr 28, 2024
1 parent 8fa83ed commit b092134
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 95 deletions.
35 changes: 13 additions & 22 deletions Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\Bin\Debug\Assembly-CSharp\</OutputPath>
<DefineConstants>UNITY_2022_3_25;UNITY_2022_3;UNITY_2022;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;UNITY_2022_1_OR_NEWER;UNITY_2022_2_OR_NEWER;UNITY_2022_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_EDITOR_GAME_SERVICES;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_NAVIGATION_PACKAGE_DEBUG_VISUALIZATION;ENABLE_NAVIGATION_HEIGHTMESH_RUNTIME_SUPPORT;ENABLE_NAVIGATION_UI_REQUIRES_PACKAGE;PLATFORM_STANDALONE;TEXTCORE_1_0_OR_NEWER;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_NVIDIA;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;PLATFORM_INITIALIZES_MEMORY_MANAGER_EXPLICITLY;ENABLE_MONO;NET_STANDARD_2_0;NET_STANDARD;NET_STANDARD_2_1;NETSTANDARD;NETSTANDARD2_1;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;TEXTCORE_FONT_ENGINE_1_5_OR_NEWER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<DefineConstants>UNITY_2022_3_25;UNITY_2022_3;UNITY_2022;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;UNITY_2022_1_OR_NEWER;UNITY_2022_2_OR_NEWER;UNITY_2022_3_OR_NEWER;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CLOTH;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_EDITOR_GAME_SERVICES;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_ENGINE_CODE_STRIPPING;ENABLE_ONSCREEN_KEYBOARD;ENABLE_MANAGED_UNITYTLS;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_NAVIGATION_PACKAGE_DEBUG_VISUALIZATION;ENABLE_NAVIGATION_HEIGHTMESH_RUNTIME_SUPPORT;ENABLE_NAVIGATION_UI_REQUIRES_PACKAGE;PLATFORM_WEBGL;TEXTCORE_1_0_OR_NEWER;UNITY_WEBGL;UNITY_WEBGL_API;UNITY_DISABLE_WEB_VERIFICATION;UNITY_GFX_USE_PLATFORM_VSYNC;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_SPATIALTRACKING;ENABLE_MONO;NET_STANDARD_2_0;NET_STANDARD;NET_STANDARD_2_1;NETSTANDARD;NETSTANDARD2_1;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;TEXTCORE_FONT_ENGINE_1_5_OR_NEWER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169,0649</NoWarn>
Expand Down Expand Up @@ -61,9 +61,6 @@
<Reference Include="UnityEngine.AIModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.AIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ARModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.ARModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AccessibilityModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.AccessibilityModule.dll</HintPath>
</Reference>
Expand All @@ -82,12 +79,6 @@
<Reference Include="UnityEngine.ClothModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.ClothModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClusterInputModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.ClusterInputModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClusterRendererModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.ClusterRendererModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ContentLoadModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.ContentLoadModule.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -247,8 +238,8 @@
<Reference Include="UnityEngine.VideoModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.VideoModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VirtualTexturingModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.VirtualTexturingModule.dll</HintPath>
<Reference Include="UnityEngine.WebGLModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\PlaybackEngines\WebGLSupport\Managed\UnityEngine.WebGLModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WindModule">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\Managed\UnityEngine\UnityEngine.WindModule.dll</HintPath>
Expand Down Expand Up @@ -307,30 +298,30 @@
<Reference Include="BouncyCastle.Crypto">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\Portable.BouncyCastle.1.9.0\lib\netstandard2.0\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="JustCRC32C">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\JustCRC32C.1.2.0\lib\netstandard2.0\JustCRC32C.dll</HintPath>
</Reference>
<Reference Include="Unity.Collections.LowLevel.ILSupport">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Library\PackageCache\[email protected]\Unity.Collections.LowLevel.ILSupport\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
</Reference>
<Reference Include="TonSdk.Connect">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\TonSdk.Connect.0.2.3\lib\netstandard2.1\TonSdk.Connect.dll</HintPath>
</Reference>
<Reference Include="zxing">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\ZXing.Net.0.16.9\lib\netstandard2.1\zxing.dll</HintPath>
</Reference>
<Reference Include="JustCRC32C">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\JustCRC32C.1.2.0\lib\netstandard2.0\JustCRC32C.dll</HintPath>
</Reference>
<Reference Include="Unity.VisualScripting.Antlr3.Runtime">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Library\PackageCache\[email protected]\Runtime\VisualScripting.Flow\Dependencies\NCalc\Unity.VisualScripting.Antlr3.Runtime.dll</HintPath>
<Reference Include="NaCl">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\NaCl.Net.0.1.13\lib\netstandard2.1\NaCl.dll</HintPath>
</Reference>
<Reference Include="TonSdk.Core">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\TonSdk.Core.0.3.1\lib\netstandard2.1\TonSdk.Core.dll</HintPath>
</Reference>
<Reference Include="NaCl">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\NaCl.Net.0.1.13\lib\netstandard2.1\NaCl.dll</HintPath>
<Reference Include="Unity.VisualScripting.Antlr3.Runtime">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Library\PackageCache\[email protected]\Runtime\VisualScripting.Flow\Dependencies\NCalc\Unity.VisualScripting.Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Library\PackageCache\[email protected]\Runtime\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="TonSdk.Connect">
<HintPath>D:\purpleGuy\continuation-team\unity-ton-connect\Assets\Packages\TonSdk.Connect.0.2.2\lib\netstandard2.1\TonSdk.Connect.dll</HintPath>
</Reference>
<Reference Include="netstandard">
<HintPath>D:\Unity\2022.3.25f1\Editor\Data\NetStandard\ref\2.1.0\netstandard.dll</HintPath>
</Reference>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions Assets/TonConnect/Images/WalletIcons/tg-wallet.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/TonConnect/Scenes/TonSDK.Connect.Example.unity
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ MonoBehaviour:
- {fileID: 21300000, guid: 306a686093178e449925fded6c971433, type: 3}
- {fileID: 21300000, guid: a82d6bfd20ab4274cac267c7232816fc, type: 3}
- {fileID: 21300000, guid: 33b0b1a83ceea584a85a4687be3a9e83, type: 3}
- {fileID: 21300000, guid: 6cea1cf91e063e74eb3dc8404f704529, type: 3}
document: {fileID: 764677334}
walletItem: {fileID: 9197481963319205126, guid: 02754049dfaf3f547892804f4967d87c, type: 3}
tonConnectHandler: {fileID: 1391746625}
Expand Down
21 changes: 10 additions & 11 deletions Assets/TonConnect/Scripts/Other/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.Collections.Generic;
using TonSdk.Connect;
using TonSdk.Core;
using Unity.VisualScripting;
using UnityEditor.VersionControl;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UIElements;
Expand All @@ -16,7 +14,7 @@ public class UIManager : MonoBehaviour
public bool UseSavedWalletIcons = true;
[Tooltip("Wallet icons. Works only if UseSavedWalletIcons is enabled.")]
public List<Sprite> WalletIcons = new ();
private List<string> WalletsIconsList = new () {"tonkeeper", "tonhub", "openmask", "dewallet", "mytonwallet", "tonflow", "tonwallet", "xtonwallet"};
private List<string> WalletsIconsList = new () {"tonkeeper", "tonhub", "openmask", "dewallet", "mytonwallet", "tonflow", "tonwallet", "xtonwallet", "telegram-wallet"};

[Header("UI References")]
[SerializeField] private UIDocument document;
Expand Down Expand Up @@ -121,6 +119,7 @@ private async void DisconnectWalletButtonClick(ClickEvent clickEvent)
{
EnableConnectWalletButton();
DisableWalletInfoButton();
tonConnectHandler.RestoreConnectionOnAwake = false;
await tonConnectHandler.tonConnect.Disconnect();
}

Expand Down Expand Up @@ -178,18 +177,18 @@ private IEnumerator LoadWalletsIntoModal(List<WalletConfig> wallets)
jsContentElement.style.display = DisplayStyle.None;

// load http bridge wallets
for (int i = 0; i < wallets.Count; i++)
foreach (var t in wallets)
{
if(wallets[i].BridgeUrl == null) continue;
if(t.BridgeUrl == null) continue;
VisualElement walletElement = walletItem.CloneTree();

if(UseSavedWalletIcons && WalletsIconsList.Contains(wallets[i].AppName))
if(UseSavedWalletIcons && WalletsIconsList.Contains(t.AppName))
{
walletElement.Q<VisualElement>("WalletButton_WalletImage").style.backgroundImage = new StyleBackground(WalletIcons[WalletsIconsList.IndexOf(wallets[i].AppName)]);
walletElement.Q<VisualElement>("WalletButton_WalletImage").style.backgroundImage = new StyleBackground(WalletIcons[WalletsIconsList.IndexOf(t.AppName)]);
}
else
{
using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(wallets[i].Image))
using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(t.Image))
{
yield return request.SendWebRequest();

Expand All @@ -203,8 +202,8 @@ private IEnumerator LoadWalletsIntoModal(List<WalletConfig> wallets)
}
}

walletElement.Q<Label>("WalletButton_WalletName").text = wallets[i].Name;
walletElement.RegisterCallback<ClickEvent, WalletConfig>(OpenWalletQRContent, wallets[i]);
walletElement.Q<Label>("WalletButton_WalletName").text = t.Name;
walletElement.RegisterCallback<ClickEvent, WalletConfig>(OpenWalletQRContent, t);
contentElement.Add(walletElement);
}

Expand Down Expand Up @@ -272,7 +271,7 @@ public void ShowConnectModal()
document.rootVisualElement.Q<VisualElement>("Button_Close").UnregisterCallback<ClickEvent>(CloseConnectModal);
document.rootVisualElement.Q<VisualElement>("Button_Close").RegisterCallback<ClickEvent>(CloseConnectModal);

StartCoroutine(tonConnectHandler.LoadWallets("https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets.json", LoadWalletsCallback));
StartCoroutine(tonConnectHandler.LoadWallets("https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json", LoadWalletsCallback));
}


Expand Down
2 changes: 1 addition & 1 deletion Assets/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="JustCRC32C" version="1.2.0" manuallyInstalled="true" />
<package id="NaCl.Net" version="0.1.13" manuallyInstalled="true" />
<package id="Portable.BouncyCastle" version="1.9.0" />
<package id="TonSdk.Connect" version="0.2.2" manuallyInstalled="true" />
<package id="TonSdk.Connect" version="0.2.3" manuallyInstalled="true" />
<package id="TonSdk.Core" version="0.3.1" manuallyInstalled="true" />
<package id="ZXing.Net" version="0.16.9" manuallyInstalled="true" />
</packages>
Loading

0 comments on commit b092134

Please sign in to comment.