diff --git a/src/Mx.NET.SDK.WalletConnect/IWalletConnectGeneric.cs b/src/Mx.NET.SDK.WalletConnect/IWalletConnectGeneric.cs index 30f9577..50007ed 100644 --- a/src/Mx.NET.SDK.WalletConnect/IWalletConnectGeneric.cs +++ b/src/Mx.NET.SDK.WalletConnect/IWalletConnectGeneric.cs @@ -1,8 +1,8 @@ using Mx.NET.SDK.WalletConnect.Data; -using Mx.NET.SDK.WalletConnect.Models.Events; using System; using System.Threading.Tasks; -using WalletConnectSharp.Events.Model; +using WalletConnectSharp.Sign.Models; +using WalletConnectSharp.Sign.Models.Engine.Events; namespace Mx.NET.SDK.WalletConnect { @@ -13,11 +13,8 @@ public interface IWalletConnectGeneric string Signature { get; } Uri WalletConnectUri { get; } - event EventHandler> OnSessionUpdateEvent; - event EventHandler> OnSessionEvent; - event EventHandler OnSessionDeleteEvent; - event EventHandler OnSessionExpireEvent; - event EventHandler> OnTopicUpdateEvent; + event EventHandler OnSessionDeleteEvent; + event EventHandler OnSessionExpireEvent; /// /// Initilize the client and subscribe to events, if not already initialized diff --git a/src/Mx.NET.SDK.WalletConnect/Models/Events/SessionEvent.cs b/src/Mx.NET.SDK.WalletConnect/Models/Events/SessionEvent.cs deleted file mode 100644 index 09af15a..0000000 --- a/src/Mx.NET.SDK.WalletConnect/Models/Events/SessionEvent.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Newtonsoft.Json; - -namespace Mx.NET.SDK.WalletConnect.Models.Events -{ - public class SessionEvent - { - [JsonProperty("topic")] - public string Topic { get; set; } - - [JsonProperty("param")] - public SessionEventTypes Params { get; set; } - } - - public class SessionEventTypes - { - [JsonProperty("event")] - public Event Event { get; set; } - - [JsonProperty("chainId")] - public string ChainId { get; set; } - } - - public class Event - { - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("data")] - public dynamic Data { get; set; } - } -} diff --git a/src/Mx.NET.SDK.WalletConnect/Models/Events/SessionUpdateEvent.cs b/src/Mx.NET.SDK.WalletConnect/Models/Events/SessionUpdateEvent.cs deleted file mode 100644 index c8172f3..0000000 --- a/src/Mx.NET.SDK.WalletConnect/Models/Events/SessionUpdateEvent.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Newtonsoft.Json; -using WalletConnectSharp.Sign.Models.Engine.Methods; - -namespace Mx.NET.SDK.WalletConnect.Models.Events -{ - public class SessionUpdateEvent - { - [JsonProperty("topic")] - public string Topic { get; set; } - - [JsonProperty("params")] - public dynamic Params { get; set; } - } -} diff --git a/src/Mx.NET.SDK.WalletConnect/Models/Events/TopicUpdateEvent.cs b/src/Mx.NET.SDK.WalletConnect/Models/Events/TopicUpdateEvent.cs deleted file mode 100644 index 2fe7b21..0000000 --- a/src/Mx.NET.SDK.WalletConnect/Models/Events/TopicUpdateEvent.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Newtonsoft.Json; - -namespace Mx.NET.SDK.WalletConnect.Models.Events -{ - public class TopicUpdateEvent - { - [JsonProperty("topic")] - public string Topic { get; set; } - } -} diff --git a/src/Mx.NET.SDK.WalletConnect/Mx.NET.SDK.WalletConnect.csproj b/src/Mx.NET.SDK.WalletConnect/Mx.NET.SDK.WalletConnect.csproj index cc5338a..840b497 100644 --- a/src/Mx.NET.SDK.WalletConnect/Mx.NET.SDK.WalletConnect.csproj +++ b/src/Mx.NET.SDK.WalletConnect/Mx.NET.SDK.WalletConnect.csproj @@ -11,7 +11,7 @@ https://github.com/RemarkableTools/Mx.NET.SDK.WalletProviders/tree/main/src/Mx.NET.SDK.WalletConnect GitHub Remarkable Tools - 2.1.2 + 2.1.3 true $(MSBuildProjectName.Replace("-", "")) RemarkableTools.Mx.WalletConnect @@ -43,10 +43,10 @@ - - + + - + diff --git a/src/Mx.NET.SDK.WalletConnect/WalletConnectGeneric.cs b/src/Mx.NET.SDK.WalletConnect/WalletConnectGeneric.cs index 57d4336..55b8838 100644 --- a/src/Mx.NET.SDK.WalletConnect/WalletConnectGeneric.cs +++ b/src/Mx.NET.SDK.WalletConnect/WalletConnectGeneric.cs @@ -5,16 +5,13 @@ using WalletConnectSharp.Sign.Models.Engine; using Mx.NET.SDK.WalletConnect.Models; using WalletConnectSharp.Common.Model.Errors; -using WalletConnectSharp.Events; -using WalletConnectSharp.Events.Model; -using Mx.NET.SDK.WalletConnect.Models.Events; using static Mx.NET.SDK.WalletConnect.Constants.Operations; -using static Mx.NET.SDK.WalletConnect.Constants.Events; using System.IO; using WalletConnectSharp.Storage; using Mx.NET.SDK.WalletConnect.Data; -using WalletConnectSharp.Core; using WalletConnectSharp.Network.Models; +using WalletConnectSharp.Core; +using WalletConnectSharp.Sign.Models.Engine.Events; namespace Mx.NET.SDK.WalletConnect { @@ -184,47 +181,23 @@ public async Task MultiSign(RequestData[] requestsData) return response.Signatures; } - public event EventHandler> OnSessionUpdateEvent; - public event EventHandler> OnSessionEvent; - public event EventHandler OnSessionDeleteEvent; - public event EventHandler OnSessionExpireEvent; - public event EventHandler> OnTopicUpdateEvent; + public event EventHandler OnSessionDeleteEvent; + public event EventHandler OnSessionExpireEvent; private void SubscribeToEvents() { - _client.On(SESSION_UPDATE, delegate (object sender, GenericEvent @event) - { - OnSessionUpdateEvent?.Invoke(sender, @event); - }); - - _client.On(SESSION_EVENT, delegate (object sender, GenericEvent @event) - { - OnSessionEvent?.Invoke(sender, @event); - }); - - _client.On(SESSION_DELETE, delegate () + _client.SessionDeleted += (sender, @event) => { Address = string.Empty; Signature = string.Empty; - OnSessionDeleteEvent?.Invoke(this, EventArgs.Empty); - }); - - _client.On(SESSION_EXPIRE, delegate () + OnSessionDeleteEvent?.Invoke(sender, @event); + }; + _client.SessionExpired += (sender, @event) => { Address = string.Empty; Signature = string.Empty; - OnSessionExpireEvent?.Invoke(this, EventArgs.Empty); - }); - - _client.Core.Pairing.On(PAIRING_DELETE, delegate (object sender, GenericEvent @event) - { - OnTopicUpdateEvent?.Invoke(sender, @event); - }); - - _client.Core.Pairing.On(PAIRING_EXPIRE, delegate (object sender, GenericEvent @event) - { - OnTopicUpdateEvent?.Invoke(sender, @event); - }); + OnSessionExpireEvent?.Invoke(sender, @event); + }; } } }