Skip to content

Commit

Permalink
fix: pairing events, more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gigajuwels committed Nov 3, 2023
1 parent 28e899d commit e5557f5
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
3 changes: 2 additions & 1 deletion WalletConnectSharp.Sign/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private void WrapPairingEvents()
{
this.Client.Core.Pairing.PairingPinged += (sender, @event) => this.PairingPinged?.Invoke(sender, @event);
this.Client.Core.Pairing.PairingDeleted += (sender, @event) => this.PairingDeleted?.Invoke(sender, @event);
this.Client.Core.Pairing.PairingExpired += (sender, @event) => this.PairingExpired?.Invoke(sender, @event);
}

private void RegisterExpirerEvents()
Expand Down Expand Up @@ -125,7 +126,7 @@ private void RegisterRelayerEvents()
/// This event is invoked when the given pairing has expired
/// Event Side: Wallet
/// </summary>
public event EventHandler<PairingStruct> PairingExpired;
public event EventHandler<PairingEvent> PairingExpired;

/// <summary>
/// This event is invoked when a new session is proposed. This is usually invoked
Expand Down
64 changes: 63 additions & 1 deletion WalletConnectSharp.Sign/Interfaces/IEngineAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,96 @@ namespace WalletConnectSharp.Sign.Interfaces
/// </summary>
public interface IEngineAPI
{
/// <summary>
/// This event is invoked when the given session has expired
/// Event Side: dApp & Wallet
/// </summary>
event EventHandler<SessionStruct> SessionExpired;

event EventHandler<PairingStruct> PairingExpired;
/// <summary>
/// This event is invoked when the given pairing has expired
/// Event Side: Wallet
/// </summary>
event EventHandler<PairingEvent> PairingExpired;

/// <summary>
/// This event is invoked when a new session is proposed. This is usually invoked
/// after a new pairing has been activated from a URI
/// Event Side: Wallet
/// </summary>
event EventHandler<SessionProposalEvent> SessionProposed;

/// <summary>
/// This event is invoked when a proposed session has been connected to a wallet. This event is
/// triggered after the session has been approved by a wallet
/// Event Side: dApp
/// </summary>
event EventHandler<SessionStruct> SessionConnected;

/// <summary>
/// This event is invoked when a proposed session connection failed with an error
/// Event Side: dApp
/// </summary>
event EventHandler<Exception> SessionConnectionErrored;

/// <summary>
/// This event is invoked when a given session sent a update request.
/// Event Side: Wallet
/// </summary>
event EventHandler<SessionUpdateEvent> SessionUpdateRequest;

/// <summary>
/// This event is invoked when a given session sent a extend request.
/// Event Side: Wallet
/// </summary>
event EventHandler<SessionEvent> SessionExtendRequest;

/// <summary>
/// This event is invoked when a given session update request was successful.
/// Event Side: dApp
/// </summary>
event EventHandler<SessionEvent> SessionUpdated;

/// <summary>
/// This event is invoked when a given session extend request was successful.
/// Event Side: dApp
/// </summary>
event EventHandler<SessionEvent> SessionExtended;

/// <summary>
/// This event is invoked when a given session has been pinged
/// Event Side: dApp & Wallet
/// </summary>
event EventHandler<SessionEvent> SessionPinged;

/// <summary>
/// This event is invoked whenever a session has been deleted
/// Event Side: dApp & Wallet
/// </summary>
event EventHandler<SessionEvent> SessionDeleted;

/// <summary>
/// This event is invoked whenever a session has been rejected
/// Event Side: Wallet
/// </summary>
event EventHandler<SessionStruct> SessionRejected;

/// <summary>
/// This event is invoked whenever a session has been approved
/// Event Side: Wallet
/// </summary>
event EventHandler<SessionStruct> SessionApproved;

/// <summary>
/// This event is invoked whenever a pairing is pinged
/// Event Side: dApp & Wallet
/// </summary>
event EventHandler<PairingEvent> PairingPinged;

/// <summary>
/// This event is invoked whenever a pairing is deleted
/// Event Side: dApp & Wallet
/// </summary>
event EventHandler<PairingEvent> PairingDeleted;

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion WalletConnectSharp.Sign/WalletConnectSignClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public int Version


public event EventHandler<SessionStruct> SessionExpired;
public event EventHandler<PairingStruct> PairingExpired;
public event EventHandler<PairingEvent> PairingExpired;
public event EventHandler<SessionProposalEvent> SessionProposed;
public event EventHandler<SessionStruct> SessionConnected;
public event EventHandler<Exception> SessionConnectionErrored;
Expand Down Expand Up @@ -226,6 +226,8 @@ private void WrapEngineEvents()
Engine.SessionApproved += (sender, @struct) => this.SessionApproved?.Invoke(sender, @struct);
Engine.SessionExtended += (sender, @event) => this.SessionExtended?.Invoke(sender, @event);
Engine.SessionUpdated += (sender, @event) => this.SessionUpdated?.Invoke(sender, @event);
Engine.PairingDeleted += (sender, @event) => this.PairingDeleted?.Invoke(sender, @event);
Engine.PairingPinged += (sender, @event) => this.PairingPinged?.Invoke(sender, @event);
}

/// <summary>
Expand Down

0 comments on commit e5557f5

Please sign in to comment.