protected Result GetBatchData <T>(FeatureQuery query, int queryIndex, Action <Unpacker, List <T> > unpack, Func <IReadOnlyList <T>, Result> handle) { if (query.GetString(queryIndex, out var hexString)) { var list = new List <T>(); if (HexPacker.FromHex(hexString, (unpacker) => { var count = unpacker.UnpackUshort(); if (count > MaxBatchSize) { throw new ArgumentOutOfRangeException(); } unpacker.Position -= 2; unpack.Invoke(unpacker, list); })) { return(handle.Invoke(list)); } } return(Result.InvalidQuery); }
public static string GetLastTransactionInfoBatchQueryPath(ChainType chainType, int chainId, uint chainIndex, IReadOnlyList <long> accountIds) { return(GetQuery(chainType, chainId, chainIndex, FeatureId, PreviousAccountTransactionQuery.LastTransactionInfoBatchAction, HexPacker.ToHex((p) => p.Pack(accountIds)))); }
public static string GetLastTransactionInfoIndicesBatchQueryPath(ChainType chainType, int chainId, uint chainIndex, long accountId, IReadOnlyList <Chain.Index> indices) { return(GetQuery(chainType, chainId, chainIndex, FeatureId, AccountIndexQueryHandlerBase.LastTransactionInfoIndicesBatchAction, $"{accountId}/{HexPacker.ToHex((p) => p.Pack(indices))}")); }
public static string GetLastTransactionInfoBatchQueryPath(ChainType chainType, int chainId, uint chainIndex, IReadOnlyList <long> accountIds, Chain.Index index) { return(GetQuery(chainType, chainId, chainIndex, FeatureId, AccountIndexQueryHandlerBase.LastTransactionInfoBatchAction, $"{HexPacker.ToHex((p) => p.Pack(accountIds))}/{index.HexString}")); }