Skip to content

Commit

Permalink
sdk: expose contractsInfo on SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
andrevmatos committed Jul 16, 2020
1 parent 2f37eae commit 8ce2ae4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
8 changes: 5 additions & 3 deletions raiden-ts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

### Added
- [#1910] Add option to `mint` tokens for any address
- [#1913] Added `contractsInfo` getter holding current contracts info

### Changed
- [#1905] Fail early if not enough tokens to deposit

[#1905]: https://github.com/raiden-network/light-client/issues/1905
[#1910]: https://github.com/raiden-network/light-client/pull/1910
[#1913]: https://github.com/raiden-network/light-client/pull/1913

## [0.10.0] - 2020-07-13
### Fixed
Expand Down Expand Up @@ -227,8 +229,8 @@
- Update message packing and signature to confront with Alderaan format.
- Optimize past event scanning.
- Make transfer parameters consistent with openChannel.
- Update previous transfer initialization to monitor pending transfers.
- Update the transfer mechanism to accept transfers that are reduced up to 10% due to fees.
- Update previous transfer initialization to monitor pending transfers.
- Update the transfer mechanism to accept transfers that are reduced up to 10% due to fees.
- Increase time before leaving unknown rooms.
- Reduce the minimum settle timeout to 20.
- Remove fee field from LockedTransfer to comply with raiden-py.
Expand All @@ -255,7 +257,7 @@
- Add monitoring for transfers based on secret hash.

### Changed
- Change transfer api return secret hash.
- Change transfer api return secret hash.

## [0.1] - 2019-08-21
### Added
Expand Down
9 changes: 9 additions & 0 deletions raiden-ts/src/raiden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,15 @@ export class Raiden {
return versions.contracts;
}

/**
* Returns the Smart Contracts addresses and deployment blocks
*
* @returns Smart Contracts info
*/
get contractsInfo(): ContractsInfo {
return this.deps.contractsInfo;
}

/**
* Update Raiden Config with a partial (shallow) object
*
Expand Down
15 changes: 15 additions & 0 deletions raiden-ts/tests/e2e/raiden.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,21 @@ describe('Raiden', () => {
expect(raiden.network).toEqual(await provider.getNetwork());
});

test('contractVersion', async () => {
expect.assertions(1);
expect(Raiden.contractVersion).toMatch(/.+/);
});

test('contractsInfo', async () => {
expect.assertions(1);
expect(raiden.contractsInfo).toMatchObject({
TokenNetworkRegistry: {
address: expect.stringMatching(/0x[0-9a-f]{40}/i),
block_number: expect.any(Number),
},
});
});

test('getBlockNumber', async () => {
expect.assertions(1);
await expect(raiden.getBlockNumber()).resolves.toBeGreaterThanOrEqual(
Expand Down

0 comments on commit 8ce2ae4

Please sign in to comment.