From a38bc8a071d83d49dd276313afc3a9371bcd53e3 Mon Sep 17 00:00:00 2001 From: moreal Date: Tue, 12 Sep 2023 13:52:03 +0900 Subject: [PATCH] Support regex for `transaction.ncTransactions`' actionType argument --- .../GraphTypes/TransactionHeadlessQuery.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NineChronicles.Headless/GraphTypes/TransactionHeadlessQuery.cs b/NineChronicles.Headless/GraphTypes/TransactionHeadlessQuery.cs index ecaa294ee..5be72bb01 100644 --- a/NineChronicles.Headless/GraphTypes/TransactionHeadlessQuery.cs +++ b/NineChronicles.Headless/GraphTypes/TransactionHeadlessQuery.cs @@ -6,6 +6,7 @@ using System.Text; using System.Text.Json; using System.Text.Json.Nodes; +using System.Text.RegularExpressions; using Bencodex; using Bencodex.Json; using GraphQL; @@ -75,7 +76,7 @@ public TransactionHeadlessQuery(StandaloneContext standaloneContext) new QueryArgument> { Name = "limit", Description = "number of block to query." }, new QueryArgument> - { Name = "actionType", Description = "filter tx by having actions' type" } + { Name = "actionType", Description = "filter tx by having actions' type. It is regular expression." } ), resolve: context => { @@ -99,7 +100,7 @@ public TransactionHeadlessQuery(StandaloneContext standaloneContext) return false; } - return typeId == actionType; + return Regex.IsMatch(typeId, actionType); })); return transactions;