diff --git a/NineChronicles.Headless/GraphTypes/StandaloneSubscription.cs b/NineChronicles.Headless/GraphTypes/StandaloneSubscription.cs index fb5738403..8b249aebc 100644 --- a/NineChronicles.Headless/GraphTypes/StandaloneSubscription.cs +++ b/NineChronicles.Headless/GraphTypes/StandaloneSubscription.cs @@ -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; @@ -145,7 +146,7 @@ public StandaloneSubscription(StandaloneContext standaloneContext) Arguments = new QueryArguments( new QueryArgument> { - Description = "A type of action in transaction.", + Description = "A regular expression to filter transactions based on action type.", Name = "actionType", } ), @@ -304,7 +305,7 @@ private IObservable SubscribeTx(IResolveFieldContext context) return false; } - return typeId == actionType; + return Regex.IsMatch(typeId, actionType); })) .Select(transaction => new Tx { diff --git a/NineChronicles.Headless/GraphTypes/TransactionType.cs b/NineChronicles.Headless/GraphTypes/TransactionType.cs index 3a539f735..d56d4391a 100644 --- a/NineChronicles.Headless/GraphTypes/TransactionType.cs +++ b/NineChronicles.Headless/GraphTypes/TransactionType.cs @@ -1,3 +1,4 @@ +using System; using GraphQL.Types; using Libplanet.Explorer.GraphTypes; using Libplanet.Types.Tx; @@ -48,6 +49,15 @@ public TransactionType() description: "A list of actions in this transaction.", resolve: context => context.Source.Actions ); + + Field>( + name: "SerializedPayload", + description: "A serialized tx payload in base64 string.", + resolve: x => + { + byte[] bytes = x.Source.Serialize(); + return Convert.ToBase64String(bytes); + }); } } }