Skip to content

Commit

Permalink
Support regex expression in subscription.tx with actionType argument
Browse files Browse the repository at this point in the history
  • Loading branch information
moreal authored and U-lis committed Nov 1, 2023
1 parent 48385ed commit 0906fb9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions NineChronicles.Headless/GraphTypes/StandaloneSubscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reactive.Disposables;
using System.Text.RegularExpressions;
using Bencodex.Types;
using Libplanet.Crypto;
using Libplanet.Types.Assets;
Expand Down Expand Up @@ -145,7 +146,7 @@ public StandaloneSubscription(StandaloneContext standaloneContext)
Arguments = new QueryArguments(
new QueryArgument<NonNullGraphType<StringGraphType>>
{
Description = "A type of action in transaction.",
Description = "A regular expression to filter transactions based on action type.",
Name = "actionType",
}
),
Expand Down Expand Up @@ -304,7 +305,7 @@ private IObservable<Tx> SubscribeTx(IResolveFieldContext context)
return false;
}

return typeId == actionType;
return Regex.IsMatch(typeId, actionType);
}))
.Select(transaction => new Tx
{
Expand Down

0 comments on commit 0906fb9

Please sign in to comment.