Skip to content

Commit

Permalink
Merge pull request #367 from tonlabs/0.65.1-rc
Browse files Browse the repository at this point in the history
Version 0.65.1
  • Loading branch information
d3p authored Sep 12, 2023
2 parents c726916 + dcee189 commit 279a93b
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 31 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file.

## [0.65.1] - 2023-09-12

### Fixed

- `blockchain.account.transactions_by_lt` pagination cursor is a transaction `lt`.
So `before` and `after` args should be specified as a string with `bigint` representation
(e.g. `0xabc` for hex or `123` for dec).
Cursors are returned using `0x` hex bigint representation.

## [0.65.0] - 2023-09-10

### New
Expand All @@ -11,6 +20,9 @@ All notable changes to this project will be documented in this file.
- Account info resolver now uses EvernodeRPC boc or meta queries.
- Added argument `blockchain.account.info(byBlock)` – works only with Evernode RPC.

### Fixed
- account.info.address was null

## [0.64.0] - 2023-08-09

### New
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ton-q-server",
"version": "0.65.0",
"version": "0.65.1",
"description": "TON Q Server – realtime queries over TON blockchain.",
"main": "index.js",
"repository": "[email protected]:tonlabs/ton-q-server.git",
Expand Down
45 changes: 36 additions & 9 deletions src/__tests__/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import gql from "graphql-tag"
import TONQServer from "../server/server"

import { createTestClient } from "./init-tests"
import { createTestData, startTestServer } from "./blockchain-mock"
import { createTestData, startTestServer, TestSetup } from "./blockchain-mock"

let server: TONQServer | null = null

Expand Down Expand Up @@ -478,10 +478,11 @@ test("blockchain.account.transactions_by_lt", async () => {
account(
address: "0:198880de2ac28bcf71ab8082d7132d22c337879351cae8b48dd397aadf12f206"
) {
transactions_by_lt(after: "ad36a70c5b81", first: 5) {
transactions_by_lt(after: "0xd36a70c5b81", first: 5) {
edges {
node {
hash
lt
}
cursor
}
Expand All @@ -505,47 +506,52 @@ test("blockchain.account.transactions_by_lt", async () => {
{
node: {
hash: "34c0895d65e005129d0ef1f87783bd4ea48a5be79306a15dea85a44efc0c2e13",
lt: "0xd36a70c5b85",
__typename: "BlockchainTransaction",
},
cursor: "ad36a70c5b85",
cursor: "0xd36a70c5b85",
__typename: "BlockchainTransactionEdge",
},
{
node: {
hash: "3cf3672f5288eec840ea535ad38d790e1c94a582619a903191f6881e43c50bab",
lt: "0xd36a70c5b86",
__typename: "BlockchainTransaction",
},
cursor: "ad36a70c5b86",
cursor: "0xd36a70c5b86",
__typename: "BlockchainTransactionEdge",
},
{
node: {
hash: "bf2b8eac7e0e64948fef2300c4ee865c232b42b4986b6e41419f51759d5d42c7",
lt: "0xd36a70c5b89",
__typename: "BlockchainTransaction",
},
cursor: "ad36a70c5b89",
cursor: "0xd36a70c5b89",
__typename: "BlockchainTransactionEdge",
},
{
node: {
hash: "c9f365fd3bfa8a6260b5154a22973ae5cd525fbe9dbd3ee632a9f52588295e14",
lt: "0xd36a70c5b8d",
__typename: "BlockchainTransaction",
},
cursor: "ad36a70c5b8d",
cursor: "0xd36a70c5b8d",
__typename: "BlockchainTransactionEdge",
},
{
node: {
hash: "7c4f031ac7db3763884eb16d51e6ade302c12fef14708c9b2afce653b07c4361",
lt: "0xd36a70c5b94",
__typename: "BlockchainTransaction",
},
cursor: "ad36a70c5b94",
cursor: "0xd36a70c5b94",
__typename: "BlockchainTransactionEdge",
},
],
pageInfo: {
startCursor: "ad36a70c5b85",
endCursor: "ad36a70c5b94",
startCursor: "0xd36a70c5b85",
endCursor: "0xd36a70c5b94",
hasNextPage: true,
__typename: "PageInfo",
},
Expand Down Expand Up @@ -1779,3 +1785,24 @@ test("blockchain.account.transactions. Invalid account should throw", async () =
expect(message).toEqual("Invalid account address")
}
})

test("blockchain.account.transactions_by_lt", async () => {
const test = await TestSetup.create({})

const result = (await test.queryBlockchain(
`
account(address:"-1:2bf05f1fee01b78c2b34ddc0ee0eb663be88c1341bdeff3dbec9e7cf37be8601") {
transactions_by_lt(last:2 before:"0xd36a6edd702" allow_latest_inconsistent_data:true) {
edges {
node {
lt
}
}
}
}`,
)) as any
const trs = result.account.transactions_by_lt.edges.map((x: any) => x.node)
console.log(">>>", trs)
expect(trs.length).toBeGreaterThan(0)
await test.close()
})
4 changes: 2 additions & 2 deletions src/__tests__/cloud15.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ test("cloud15.pagination", async () => {
`,
)) as any
const page = queryResult.account.transactions_by_lt
expect(page.pageInfo.startCursor).toBe("ad36a72ae001")
expect(page.pageInfo.endCursor).toBe("ad36a7496483")
expect(page.pageInfo.startCursor).toBe("0xd36a72ae001")
expect(page.pageInfo.endCursor).toBe("0xd36a7496483")
}
await testPagination(true)
await testPagination(false)
Expand Down
11 changes: 7 additions & 4 deletions src/server/graphql/blockchain/fetchers/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@ import { QError, required } from "../../../utils"

import { config } from "../config"
import {
stringCursor,
Direction,
KeyOf,
getNodeSelectionSetForConnection,
isDefined,
KeyOf,
prepareChainOrderFilter,
processPaginatedQueryResult,
processPaginationArgs,
} from "../helpers"
import {
BlockchainBlock,
BlockchainBlocksConnection,
BlockchainQueryBlocksArgs,
BlockchainBlockSignatures,
BlockchainQueryBlock_By_Seq_NoArgs,
BlockchainQueryBlocksArgs,
BlockchainQueryKey_BlocksArgs,
BlockchainQueryPrev_Shard_BlocksArgs,
BlockchainQueryNext_Shard_BlocksArgs,
BlockchainBlockSignatures,
BlockchainQueryPrev_Shard_BlocksArgs,
} from "../resolvers-types-generated"
import { getBlocksPostProcessing, postProcessBlocks } from "../boc-parsers"
import { useBlocksArchive } from "../../../data/data-provider"
Expand Down Expand Up @@ -287,6 +288,7 @@ export async function resolve_key_blocks(
limit,
direction,
"chain_order",
stringCursor,
)) as BlockchainBlocksConnection
}

Expand Down Expand Up @@ -373,6 +375,7 @@ export async function resolve_blockchain_blocks(
limit,
direction,
"chain_order",
stringCursor,
)) as BlockchainBlocksConnection
}

Expand Down
4 changes: 3 additions & 1 deletion src/server/graphql/blockchain/fetchers/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { QError, required } from "../../../utils"

import { config } from "../config"
import {
stringCursor,
Direction,
getNodeSelectionSetForConnection,
isDefined,
Expand All @@ -23,9 +24,9 @@ import {
} from "../resolvers-types-generated"
import { resolveAddress } from "../../../address"
import {
upgradeSelectionForBocParsing,
messageArchiveFields,
parseMessageBocsIfRequired,
upgradeSelectionForBocParsing,
} from "../boc-parsers"
import { useMessagesArchive } from "../../../data/data-provider"

Expand Down Expand Up @@ -304,6 +305,7 @@ export async function resolve_account_messages(
limit,
direction,
"account_chain_order",
stringCursor,
async r => {
await config.messages.fetchJoins(
r,
Expand Down
11 changes: 8 additions & 3 deletions src/server/graphql/blockchain/fetchers/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { GraphQLResolveInfo } from "graphql"

import { convertBigUInt } from "../../../filter/filters"
import { QParams } from "../../../filter/filters"
import { convertBigUInt, QParams } from "../../../filter/filters"
import { QRequestContext } from "../../../request"
import { QTraceSpan } from "../../../tracing"
import { required } from "../../../utils"

import { config } from "../config"
import {
stringCursor,
Direction,
getNodeSelectionSetForConnection,
isDefined,
prepareChainOrderFilter,
prepareNonChainOrderPaginationFilter,
processPaginatedQueryResult,
processPaginationArgs,
u64StringCursor,
} from "../helpers"
import {
BlockchainAccountQueryTransactionsArgs,
BlockchainAccountQueryTransactions_By_LtArgs,
BlockchainAccountQueryTransactionsArgs,
BlockchainQueryTransactions_By_In_MsgArgs,
BlockchainQueryTransactionsArgs,
BlockchainTransaction,
Expand Down Expand Up @@ -210,6 +211,7 @@ export async function resolve_blockchain_transactions(
limit,
direction,
"chain_order",
stringCursor,
async r => {
await config.transactions.fetchJoins(
r,
Expand Down Expand Up @@ -301,6 +303,7 @@ export async function resolve_account_transactions(
limit,
direction,
"chain_order",
stringCursor,
async r => {
await config.transactions.fetchJoins(
r,
Expand Down Expand Up @@ -337,6 +340,7 @@ export async function resolve_account_transactions_by_lt(
context,
useArchive,
"lt",
u64StringCursor,
)
filters.push(`doc.account_addr == @${params.add(account_address)}`)

Expand Down Expand Up @@ -390,6 +394,7 @@ export async function resolve_account_transactions_by_lt(
limit,
direction,
"lt",
u64StringCursor,
async r => {
await config.transactions.fetchJoins(
r,
Expand Down
Loading

0 comments on commit 279a93b

Please sign in to comment.