Skip to content

Commit

Permalink
Task/g628 metadata receipt (#634)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
rg911 and fboucquez committed Jul 23, 2020
1 parent eed355d commit 212e777
Show file tree
Hide file tree
Showing 47 changed files with 2,912 additions and 1,394 deletions.
49 changes: 22 additions & 27 deletions CONTRIBUTING.md
@@ -1,31 +1,31 @@
# Contributing to symbol-sdk-typescript-javascript

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

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

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

Please, **don't use the issue tracker for support questions**.
Please, **don't use the issue tracker for support questions**.

## Bug reports

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

It is very helpful if you can prepare a reproduction of the bug. In other words,
provide a small test case which we can run to confirm your bug. It makes it easier to
It is very helpful if you can prepare a reproduction of the bug. In other words,
provide a small test case which we can run to confirm your bug. It makes it easier to
find the problem and to fix it.

Please, take in consideration the next template to report your issue:

> **Expected Behaviour**\
Expand All @@ -35,26 +35,25 @@ Please, take in consideration the next template to report your issue:
> **Steps to reproduce**\
> For faster issue detection, we would need a step by step description do reproduce the issue.

Provide as much information as you can.

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

## Feature requests

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

## Contributing code and documentation changes

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
about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there
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
about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there
are particular issues that you should know about before implementing the change.

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

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

### Fork and clone the repository

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

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

1. Test your changes

Run the test suite to make sure that nothing is broken.

2. Submit a pull request

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".

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.

*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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
# Symbol SDK for TypeScript and JavaScript

[![npm version](https://badge.fury.io/js/symbol-sdk.svg)](https://badge.fury.io/js/symbol-sdk)
[![Build Status](https://api.travis-ci.com/nemtech/symbol-sdk-typescript-javascript.svg?branch=master)](https://travis-ci.com/nemtech/symbol-sdk-typescript-javascript)
[![Build Status](https://api.travis-ci.com/nemtech/symbol-sdk-typescript-javascript.svg?branch=main)](https://travis-ci.com/nemtech/symbol-sdk-typescript-javascript)
[![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)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand Down
25 changes: 20 additions & 5 deletions e2e/infrastructure/BlockHttp.spec.ts
Expand Up @@ -28,6 +28,9 @@ import { IntegrationTestHelper } from './IntegrationTestHelper';
import { BlockPaginationStreamer } from '../../src/infrastructure/paginationStreamer/BlockPaginationStreamer';
import { deepEqual } from 'assert';
import { take } from 'rxjs/operators';
import { TransactionStatement } from '../../src/model/model';
import { ReceiptPaginationStreamer } from '../../src/infrastructure/paginationStreamer/ReceiptPaginationStreamer';
import { Order } from '../../src/infrastructure/infrastructure';

describe('BlockHttp', () => {
const helper = new IntegrationTestHelper();
Expand Down Expand Up @@ -116,10 +119,10 @@ describe('BlockHttp', () => {
describe('getMerkleReceipts', () => {
it('should return Merkle Receipts', async () => {
const merkleReceipts = await receiptRepository
.getBlockReceipts(chainHeight)
.searchReceipts({ height: chainHeight })
.pipe(
mergeMap((_) => {
return receiptRepository.getMerkleReceipts(chainHeight, _.transactionStatements[0].generateHash());
return blockRepository.getMerkleReceipts(chainHeight, (_.data[0] as TransactionStatement).generateHash());
}),
)
.toPromise();
Expand All @@ -135,9 +138,21 @@ describe('BlockHttp', () => {

describe('getBlockReceipts', () => {
it('should return block receipts', async () => {
const statement = await receiptRepository.getBlockReceipts(chainHeight).toPromise();
expect(statement.transactionStatements).not.to.be.null;
expect(statement.transactionStatements.length).to.be.greaterThan(0);
const statement = await receiptRepository.searchReceipts({ height: chainHeight }).toPromise();
expect(statement.data.length).to.be.greaterThan(0);
});
});

describe('searchReceipt with streamer', () => {
it('should return receipt info', async () => {
const streamer = ReceiptPaginationStreamer.transactionStatements(receiptRepository);
const infoStreamer = await streamer
.search({ pageSize: 20, height: chainHeight, order: Order.Asc })
.pipe(take(20), toArray())
.toPromise();
const info = await receiptRepository.searchReceipts({ pageSize: 20, height: chainHeight, order: Order.Asc }).toPromise();
expect(infoStreamer.length).to.be.greaterThan(0);
deepEqual(infoStreamer[0], info.data[0]);
});
});
});

0 comments on commit 212e777

Please sign in to comment.