Skip to content

Commit 212e777

Browse files
rg911fboucquez
andauthored
Task/g628 metadata receipt (#634)
* Fixed #628 - Metadata & Receipt Pagination * Moved receiptMerkle to blockHttp * Fixed e2e tests * Fixed #628 - Metadata & Receipt Pagination * Moved receiptMerkle to blockHttp * Fixed e2e tests * temp push * Receipt Streamer improvement * Fixed unit tests * Added metadata type in metadata service * Updated openAPI version * Updated branch name from master to main * Improved coverage * Refactored metadata service * - Added missing imports - removed @internal in public methods Co-authored-by: fernando <fboucquez@gmail.com>
1 parent eed355d commit 212e777

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2912
-1394
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# Contributing to symbol-sdk-typescript-javascript
22

3-
First off, thank you for considering contributing to symbol-sdk-typescript-javascript.
3+
First off, thank you for considering contributing to symbol-sdk-typescript-javascript.
44
It’s people like you that make symbol-sdk-typescript-javascript such a great tool.
55

6-
symbol-sdk-typescript-javascript is an open source project and we love to receive contributions from
7-
our community — you! There are many ways to contribute, from writing tutorials or blog
8-
posts, improving the documentation, submitting bug reports and feature requests or
6+
symbol-sdk-typescript-javascript is an open source project and we love to receive contributions from
7+
our community — you! There are many ways to contribute, from writing tutorials or blog
8+
posts, improving the documentation, submitting bug reports and feature requests or
99
writing code which can be incorporated into symbol-sdk-typescript-javascript itself.
1010

11-
Following these guidelines helps to communicate that you respect the time of
12-
the developers managing and developing this open source project. In return,
13-
they should reciprocate that respect in addressing your issue, assessing changes,
11+
Following these guidelines helps to communicate that you respect the time of
12+
the developers managing and developing this open source project. In return,
13+
they should reciprocate that respect in addressing your issue, assessing changes,
1414
and helping you finalize your pull requests.
1515

16-
Please, **don't use the issue tracker for support questions**.
16+
Please, **don't use the issue tracker for support questions**.
1717

1818
## Bug reports
1919

20-
If you think you have found a bug in symbol-sdk-typescript-javascript, first make sure that you
21-
are testing against the latest version of symbol-sdk-typescript-javascript - your issue may already
22-
have been fixed. If not, search our issues list on GitHub in case a similar
20+
If you think you have found a bug in symbol-sdk-typescript-javascript, first make sure that you
21+
are testing against the latest version of symbol-sdk-typescript-javascript - your issue may already
22+
have been fixed. If not, search our issues list on GitHub in case a similar
2323
issue has already been opened.
2424

25-
It is very helpful if you can prepare a reproduction of the bug. In other words,
26-
provide a small test case which we can run to confirm your bug. It makes it easier to
25+
It is very helpful if you can prepare a reproduction of the bug. In other words,
26+
provide a small test case which we can run to confirm your bug. It makes it easier to
2727
find the problem and to fix it.
28-
28+
2929
Please, take in consideration the next template to report your issue:
3030

3131
> **Expected Behaviour**\
@@ -35,26 +35,25 @@ Please, take in consideration the next template to report your issue:
3535
> **Steps to reproduce**\
3636
> For faster issue detection, we would need a step by step description do reproduce the issue.
3737
38-
3938
Provide as much information as you can.
4039

4140
Open a new issue [here][github-issues].
4241

4342
## Feature requests
4443

45-
If you find yourself wishing for a feature that doesn't exist in symbol-sdk-typescript-javascript,
46-
you are probably not alone. There are bound to be others out there with similar
47-
needs. Many of the features that symbol-sdk-typescript-javascript has today have been added because
48-
our users saw the need. Open an [issue][github-issues] on our issues list on GitHub which describes
44+
If you find yourself wishing for a feature that doesn't exist in symbol-sdk-typescript-javascript,
45+
you are probably not alone. There are bound to be others out there with similar
46+
needs. Many of the features that symbol-sdk-typescript-javascript has today have been added because
47+
our users saw the need. Open an [issue][github-issues] on our issues list on GitHub which describes
4948
the feature you would like to see, why you need it, and how it should work.
5049

5150
## Contributing code and documentation changes
5251

53-
If you have a bugfix or new feature that you would like to contribute to symbol-sdk-typescript-javascript, please find or open an issue
54-
about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there
52+
If you have a bugfix or new feature that you would like to contribute to symbol-sdk-typescript-javascript, please find or open an issue
53+
about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there
5554
are particular issues that you should know about before implementing the change.
5655

57-
We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is
56+
We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is
5857
important to find the best approach before writing too much code.
5958

6059
### Contributing License Notice
@@ -65,7 +64,7 @@ Whether or not you state this explicitly, by submitting any copyrighted material
6564

6665
### Fork and clone the repository
6766

68-
You will need to fork the main symbol-sdk-typescript-javascript code or documentation repository and clone
67+
You will need to fork the main symbol-sdk-typescript-javascript code or documentation repository and clone
6968
it to your local machine. See [github help page](https://help.github.com/articles/fork-a-repo/) for help.
7069

7170
Further instructions for specific projects are given below.
@@ -75,13 +74,9 @@ Further instructions for specific projects are given below.
7574
Once your changes and tests are ready to submit for review:
7675

7776
1. Test your changes
78-
7977
Run the test suite to make sure that nothing is broken.
80-
8178
2. Submit a pull request
82-
8379
Push your local changes to your forked copy of the repository and [submit a pull request](https://help.github.com/articles/about-pull-requests/). In the pull request, choose a title which sums up the changes that you have made, and in the body provide more details about what your changes do. Also mention the number of the issue where discussion has taken place, eg "Closes #123".
84-
8580
Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into symbol-sdk-typescript-javascript.
8681

8782
*CONTRIBUTING.md is based on [CONTRIBUTING-template.md](https://github.com/nayafia/contributing-template/blob/master/CONTRIBUTING-template.md)* , [elasticsearch/CONTRIBUTING](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md) and [spark/CONTRIBUTING](https://github.com/apache/spark/blob/master/CONTRIBUTING.md)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Symbol SDK for TypeScript and JavaScript
22

33
[![npm version](https://badge.fury.io/js/symbol-sdk.svg)](https://badge.fury.io/js/symbol-sdk)
4-
[![Build Status](https://api.travis-ci.com/nemtech/symbol-sdk-typescript-javascript.svg?branch=master)](https://travis-ci.com/nemtech/symbol-sdk-typescript-javascript)
4+
[![Build Status](https://api.travis-ci.com/nemtech/symbol-sdk-typescript-javascript.svg?branch=main)](https://travis-ci.com/nemtech/symbol-sdk-typescript-javascript)
55
[![Coverage Status](https://coveralls.io/repos/github/nemtech/symbol-sdk-typescript-javascript/badge.svg)](https://coveralls.io/github/nemtech/symbol-sdk-typescript-javascript?branch=travis-ci)
66
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
77

e2e/infrastructure/BlockHttp.spec.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ import { IntegrationTestHelper } from './IntegrationTestHelper';
2828
import { BlockPaginationStreamer } from '../../src/infrastructure/paginationStreamer/BlockPaginationStreamer';
2929
import { deepEqual } from 'assert';
3030
import { take } from 'rxjs/operators';
31+
import { TransactionStatement } from '../../src/model/model';
32+
import { ReceiptPaginationStreamer } from '../../src/infrastructure/paginationStreamer/ReceiptPaginationStreamer';
33+
import { Order } from '../../src/infrastructure/infrastructure';
3134

3235
describe('BlockHttp', () => {
3336
const helper = new IntegrationTestHelper();
@@ -116,10 +119,10 @@ describe('BlockHttp', () => {
116119
describe('getMerkleReceipts', () => {
117120
it('should return Merkle Receipts', async () => {
118121
const merkleReceipts = await receiptRepository
119-
.getBlockReceipts(chainHeight)
122+
.searchReceipts({ height: chainHeight })
120123
.pipe(
121124
mergeMap((_) => {
122-
return receiptRepository.getMerkleReceipts(chainHeight, _.transactionStatements[0].generateHash());
125+
return blockRepository.getMerkleReceipts(chainHeight, (_.data[0] as TransactionStatement).generateHash());
123126
}),
124127
)
125128
.toPromise();
@@ -135,9 +138,21 @@ describe('BlockHttp', () => {
135138

136139
describe('getBlockReceipts', () => {
137140
it('should return block receipts', async () => {
138-
const statement = await receiptRepository.getBlockReceipts(chainHeight).toPromise();
139-
expect(statement.transactionStatements).not.to.be.null;
140-
expect(statement.transactionStatements.length).to.be.greaterThan(0);
141+
const statement = await receiptRepository.searchReceipts({ height: chainHeight }).toPromise();
142+
expect(statement.data.length).to.be.greaterThan(0);
143+
});
144+
});
145+
146+
describe('searchReceipt with streamer', () => {
147+
it('should return receipt info', async () => {
148+
const streamer = ReceiptPaginationStreamer.transactionStatements(receiptRepository);
149+
const infoStreamer = await streamer
150+
.search({ pageSize: 20, height: chainHeight, order: Order.Asc })
151+
.pipe(take(20), toArray())
152+
.toPromise();
153+
const info = await receiptRepository.searchReceipts({ pageSize: 20, height: chainHeight, order: Order.Asc }).toPromise();
154+
expect(infoStreamer.length).to.be.greaterThan(0);
155+
deepEqual(infoStreamer[0], info.data[0]);
141156
});
142157
});
143158
});

0 commit comments

Comments
 (0)