-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create WalletProcessedTransactionOfInterestClientEvent (#535)
- Loading branch information
Showing
7 changed files
with
102 additions
and
45 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/Stratis.Bitcoin.Features.SignalR/DaemonConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Stratis.Bitcoin.Features.SignalR.Broadcasters; | ||
using Stratis.Bitcoin.Features.SignalR.Events; | ||
|
||
namespace Stratis.Bitcoin.Features.SignalR | ||
{ | ||
public static class DaemonConfiguration | ||
{ | ||
private static readonly IClientEvent[] EventsToHandle = new IClientEvent[] | ||
{ | ||
new BlockConnectedClientEvent(), | ||
new ReconstructFederationClientEvent(), | ||
new FullNodeClientEvent(), | ||
new TransactionReceivedClientEvent(), | ||
new WalletProcessedTransactionOfInterestClientEvent() | ||
}; | ||
|
||
private static ClientEventBroadcasterSettings Settings = new ClientEventBroadcasterSettings | ||
{ | ||
BroadcastFrequencySeconds = 5 | ||
}; | ||
|
||
public static void ConfigureSignalRForCirrus(SignalROptions options) | ||
{ | ||
options.EventsToHandle = EventsToHandle; | ||
|
||
options.ClientEventBroadcasters = new[] | ||
{ | ||
(Broadcaster: typeof(CirrusWalletInfoBroadcaster), ClientEventBroadcasterSettings: Settings) | ||
}; | ||
} | ||
|
||
public static void ConfigureSignalRForStrax(SignalROptions options) | ||
{ | ||
options.EventsToHandle = EventsToHandle; | ||
|
||
options.ClientEventBroadcasters = new[] | ||
{ | ||
(Broadcaster: typeof(StakingBroadcaster), ClientEventBroadcasterSettings: Settings), | ||
(Broadcaster: typeof(WalletInfoBroadcaster), ClientEventBroadcasterSettings:Settings) | ||
}; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...tratis.Bitcoin.Features.SignalR/Events/WalletProcessedTransactionOfInterestClientEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using Stratis.Bitcoin.EventBus; | ||
using Stratis.Bitcoin.Features.Wallet.Events; | ||
|
||
namespace Stratis.Bitcoin.Features.SignalR.Events | ||
{ | ||
public sealed class WalletProcessedTransactionOfInterestClientEvent : IClientEvent | ||
{ | ||
public Type NodeEventType { get; } = typeof(WalletProcessedTransactionOfInterestEvent); | ||
|
||
public void BuildFrom(EventBase @event) | ||
{ | ||
if (@event is WalletProcessedTransactionOfInterestEvent progressEvent) | ||
return; | ||
|
||
throw new ArgumentException(); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Stratis.Bitcoin.Features.Wallet/Events/WalletProcessedTransactionOfInterestEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Stratis.Bitcoin.EventBus; | ||
|
||
namespace Stratis.Bitcoin.Features.Wallet.Events | ||
{ | ||
/// <summary> | ||
/// This event is raised when a transaction that relates to an address in the wallet has been received. | ||
/// <para> | ||
/// This can happen either via the mempool or when a block is connected (syncing). | ||
/// </para> | ||
/// <para> | ||
/// This ensures that the client UI calls back to the node via the API | ||
/// to update it's balance. | ||
/// </para> | ||
/// </summary> | ||
public sealed class WalletProcessedTransactionOfInterestEvent : EventBase | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters