Skip to content

Commit

Permalink
Merge pull request #85 from tonlabs/0.21.26-block-signatures
Browse files Browse the repository at this point in the history
Version 0.21.26
  • Loading branch information
diserere authored Apr 9, 2020
2 parents 4d8579f + bb62051 commit 5c0084b
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
USE_NODE_SE=true
TON_NETWORK_ADDRESS=http://0.0.0.0:8083
TON_NETWORK_ADDRESS=http://0.0.0.0:8081
#USE_NODE_SE=false
#TON_NETWORK_ADDRESS=cinet.tonlabs.io
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Release Notes
All notable changes to this project will be documented in this file.

## 0.21.26 - Apr 7, 2020
### Fixed
- `blocks_signatures` collection queries failed

## 0.21.25 - Apr 4, 2020
### New
- `blocks_signatures` queries collection
Expand Down
10 changes: 10 additions & 0 deletions __tests__/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ test.skip('Transaction List', async () => {
// );
});

test('Block signatures', async () => {
const queries = tests.client.queries;
const signatures = await queries.blocks_signatures.query({
filter: {},
result: 'id',
limit: 1,
});
expect(signatures.length).toBeGreaterThanOrEqual(0);
});

test('All Accounts', async () => {
const queries = tests.client.queries;
const docs = await queries.accounts.query({
Expand Down
2 changes: 1 addition & 1 deletion dist/modules/TONContractsModule.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions dist/modules/TONQueriesModule.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "ton-client-js",
"version": "0.21.25",
"version": "0.21.26",
"description": "TON Client for Java Script",
"main": "index.js",
"scripts": {
"babel": "babel src --out-dir dist --source-maps inline",
"flow": "flow",
"test": "jest --forceExit --detectOpenHandles --testTimeout=200000 --coverage --verbose",
"test-ci": "jest --forceExit --detectOpenHandles --testTimeout=120000 -b -i --verbose",
"test-ci": "jest --forceExit --detectOpenHandles --testTimeout=120000 --bail --runInBand --verbose",
"test-cinet": "jest --forceExit --detectOpenHandles --testTimeout=300000 --bail --runInBand --verbose",
"npm install": "npm install"
},
"pre-commit": [],
Expand Down
6 changes: 4 additions & 2 deletions src/modules/TONContractsModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,9 @@ export default class TONContractsModule extends TONModule implements TONContract
let processingTimeout = config.messageProcessingTimeout(retryIndex);
const promises = [];
const serverInfo = await this.queries.getServerInfo(parentSpan);
const operationId = serverInfo.supportsOperationId ? this.queries.generateOperationId() : undefined;
const operationId = serverInfo.supportsOperationId
? this.queries.generateOperationId()
: undefined;
let transaction: ?QTransaction = null;
if (expire) {
// calculate timeout according to `expire` value (in seconds)
Expand Down Expand Up @@ -603,7 +605,7 @@ export default class TONContractsModule extends TONModule implements TONContract
},
result: resultFields,
timeout: processingTimeout,
operationId: operationId,
operationId,
parentSpan,
});
resolve();
Expand Down
25 changes: 15 additions & 10 deletions src/modules/TONQueriesModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ export default class TONQueriesModule extends TONModule implements TONQueries {

async setup() {
this.config = this.context.getModule(TONConfigModule);
this.transactions = new TONQueriesModuleCollection(this, 'transactions');
this.messages = new TONQueriesModuleCollection(this, 'messages');
this.blocks = new TONQueriesModuleCollection(this, 'blocks');
this.accounts = new TONQueriesModuleCollection(this, 'accounts');
this.blocks_signatures = new TONQueriesModuleCollection(this, 'blocks_signatures');
this.transactions = new TONQueriesModuleCollection(this, 'transactions', 'Transaction');
this.messages = new TONQueriesModuleCollection(this, 'messages', 'Message');
this.blocks = new TONQueriesModuleCollection(this, 'blocks', 'Block');
this.accounts = new TONQueriesModuleCollection(this, 'accounts', 'Account');
this.blocks_signatures = new TONQueriesModuleCollection(this, 'blocks_signatures', 'BlockSignatures');
}

async detectRedirect(fetch: any, sourceUrl: string): Promise<string> {
Expand Down Expand Up @@ -504,10 +504,14 @@ class TONQueriesModuleCollection implements TONQCollection {
typeName: string;
constructor(module: TONQueriesModule, collectionName: string) {
constructor(
module: TONQueriesModule,
collectionName: string,
typeName: string,
) {
this.module = module;
this.collectionName = collectionName;
this.typeName = `${collectionName[0].toUpperCase()}${collectionName.slice(1, -1)}`;
this.typeName = typeName;
}
async query(
Expand Down Expand Up @@ -544,9 +548,10 @@ class TONQueriesModuleCollection implements TONQCollection {
orderBy,
limit,
timeout,
operationId: operationId,
operationId,
});
const useOperationId = operationId && (await this.module.getServerInfo(span)).supportsOperationId;
const useOperationId = operationId
&& (await this.module.getServerInfo(span)).supportsOperationId;
const c = this.collectionName;
const t = this.typeName;
const ql = `
Expand Down Expand Up @@ -668,7 +673,7 @@ class TONQueriesModuleCollection implements TONQCollection {
result,
timeout,
parentSpan,
operationId: operationId,
operationId,
});
if (docs.length > 0) {
return docs[0];
Expand Down

0 comments on commit 5c0084b

Please sign in to comment.