Skip to content

Commit

Permalink
Merge pull request #2 from RemarkableTools/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
axenteoctavian authored Dec 28, 2023
2 parents d8379b7 + a7e4313 commit 18b1a46
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 103 deletions.
11 changes: 4 additions & 7 deletions src/Mx.NET.SDK.WalletConnect/IWalletConnectGeneric.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -13,11 +13,8 @@ public interface IWalletConnectGeneric
string Signature { get; }
Uri WalletConnectUri { get; }

event EventHandler<GenericEvent<SessionUpdateEvent>> OnSessionUpdateEvent;
event EventHandler<GenericEvent<SessionEvent>> OnSessionEvent;
event EventHandler OnSessionDeleteEvent;
event EventHandler OnSessionExpireEvent;
event EventHandler<GenericEvent<TopicUpdateEvent>> OnTopicUpdateEvent;
event EventHandler<SessionEvent> OnSessionDeleteEvent;
event EventHandler<SessionStruct> OnSessionExpireEvent;

/// <summary>
/// Initilize the client and subscribe to events, if not already initialized
Expand Down
31 changes: 0 additions & 31 deletions src/Mx.NET.SDK.WalletConnect/Models/Events/SessionEvent.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/Mx.NET.SDK.WalletConnect/Models/Events/SessionUpdateEvent.cs

This file was deleted.

10 changes: 0 additions & 10 deletions src/Mx.NET.SDK.WalletConnect/Models/Events/TopicUpdateEvent.cs

This file was deleted.

8 changes: 4 additions & 4 deletions src/Mx.NET.SDK.WalletConnect/Mx.NET.SDK.WalletConnect.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryUrl>https://github.com/RemarkableTools/Mx.NET.SDK.WalletProviders/tree/main/src/Mx.NET.SDK.WalletConnect</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<Company>Remarkable Tools</Company>
<Version>2.1.2</Version>
<Version>2.1.3</Version>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<RootNamespace>$(MSBuildProjectName.Replace("-", ""))</RootNamespace>
<Title>RemarkableTools.Mx.WalletConnect</Title>
Expand Down Expand Up @@ -43,10 +43,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="RemarkableTools.Mx" Version="2.0.13" />
<PackageReference Include="RemarkableTools.Mx.Core" Version="2.0.3" />
<PackageReference Include="RemarkableTools.Mx" Version="2.0.15" />
<PackageReference Include="RemarkableTools.Mx.Core" Version="2.0.4" />
<PackageReference Include="RemarkableTools.Mx.Wallet" Version="2.0.1" />
<PackageReference Include="WalletConnect.Sign" Version="2.1.2" />
<PackageReference Include="WalletConnect.Sign" Version="2.1.7" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
47 changes: 10 additions & 37 deletions src/Mx.NET.SDK.WalletConnect/WalletConnectGeneric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -184,47 +181,23 @@ public async Task<ResponseData[]> MultiSign(RequestData[] requestsData)
return response.Signatures;
}

public event EventHandler<GenericEvent<SessionUpdateEvent>> OnSessionUpdateEvent;
public event EventHandler<GenericEvent<SessionEvent>> OnSessionEvent;
public event EventHandler OnSessionDeleteEvent;
public event EventHandler OnSessionExpireEvent;
public event EventHandler<GenericEvent<TopicUpdateEvent>> OnTopicUpdateEvent;
public event EventHandler<SessionEvent> OnSessionDeleteEvent;
public event EventHandler<SessionStruct> OnSessionExpireEvent;

private void SubscribeToEvents()
{
_client.On(SESSION_UPDATE, delegate (object sender, GenericEvent<SessionUpdateEvent> @event)
{
OnSessionUpdateEvent?.Invoke(sender, @event);
});

_client.On(SESSION_EVENT, delegate (object sender, GenericEvent<SessionEvent> @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<TopicUpdateEvent> @event)
{
OnTopicUpdateEvent?.Invoke(sender, @event);
});

_client.Core.Pairing.On(PAIRING_EXPIRE, delegate (object sender, GenericEvent<TopicUpdateEvent> @event)
{
OnTopicUpdateEvent?.Invoke(sender, @event);
});
OnSessionExpireEvent?.Invoke(sender, @event);
};
}
}
}

0 comments on commit 18b1a46

Please sign in to comment.