From 5f69cd245d88aec3341f3d0aed14ef8b18d8edaa Mon Sep 17 00:00:00 2001 From: Hyun Seungmin Date: Fri, 10 May 2024 10:31:55 +0900 Subject: [PATCH] change query --- Mimir.Worker/BlockPoller.cs | 21 +++++++++++---------- Mimir.Worker/Queries.graphql | 13 ++++--------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/Mimir.Worker/BlockPoller.cs b/Mimir.Worker/BlockPoller.cs index 4329b6ea..65dfa03e 100644 --- a/Mimir.Worker/BlockPoller.cs +++ b/Mimir.Worker/BlockPoller.cs @@ -37,28 +37,29 @@ private async Task EveryAvatarAsync( StateGetter stateGetter, CancellationToken cancellationToken) { - var operationResult = await headlessGqlClient.GetTransactions.ExecuteAsync(cancellationToken); + var operationResult = await headlessGqlClient.GetTransactionSigners.ExecuteAsync( + processBlockIndex, + cancellationToken); if (operationResult.Data is null) { HandleErrors(operationResult); return; } - if (operationResult.Data.ChainQuery.BlockQuery is null || - operationResult.Data.ChainQuery.BlockQuery.Blocks.Count == 0) + var txs = operationResult.Data.Transaction.NcTransactions; + if (txs is null || txs.Count == 0) { return; } - var block = operationResult.Data.ChainQuery.BlockQuery.Blocks[0]; - if (block.Index < processBlockIndex) + foreach (var tx in txs) { - return; - } + if (tx is null) + { + continue; + } - foreach (var transaction in block.Transactions) - { - var agentAddress = new Address(transaction.Signer); + var agentAddress = new Address(tx.Signer); var avatarAddresses = Enumerable.Range(0, GameConfig.SlotCount) .Select(e => Addresses.GetAvatarAddress(agentAddress, e)); var avatarDataArray = await Task.WhenAll(avatarAddresses.Select(stateGetter.GetAvatarData)); diff --git a/Mimir.Worker/Queries.graphql b/Mimir.Worker/Queries.graphql index 5b6d8a44..bdbfb73e 100644 --- a/Mimir.Worker/Queries.graphql +++ b/Mimir.Worker/Queries.graphql @@ -18,15 +18,10 @@ query GetBattleArenaTransactions($blockIndex: Long!) { } } -query GetTransactions { - chainQuery { - blockQuery { - blocks(desc: true, limit: 1) { - index - transactions { - signer - } - } +query GetTransactionSigners($blockIndex: Long!) { + transaction { + ncTransactions(startingBlockIndex: $blockIndex, limit: 1, actionType: "^[a-zA-Z0-9]*$") { + signer } } }