Skip to content

Commit 87ffd86

Browse files
committed
Fix for BigNumber serialization
1 parent 9619c49 commit 87ffd86

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
# 0.1.7 -- Bugfixes
3+
4+
- Fix for BigNumber serialization
5+
26
# 0.1.7 -- Utils & Fixes
37

48
- Exposing serialize and unserialize functions via utils

integration/__tests__/ethereum.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ test('Should read all events from blockchain', async () => {
2222
});
2323
});
2424
expect(events.length).toBe(20);
25+
expect(events[0].transactionIndex.isBigNumber, true);
2526
});
2627

2728
test('Should read balances for a given user by calling contract method', async () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eth-indexer",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "High performance Ethereum smart contract event indexing for fast local retrieval",
55
"author": "Dominiek Ter Heide <[email protected]>",
66
"license": "MIT",

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import BigNumber from 'bignumber.js';
44
export const serialize = (event) => {
55
const doc = Object.assign({}, event);
66
for (const key in event.args) {
7-
if (event.args[key] instanceof BigNumber) {
7+
if (event.args[key] && event.args[key].isBigNumber) {
88
doc.args[key] = {
99
type: 'BigNumber',
1010
value: event.args[key].toString(),

0 commit comments

Comments
 (0)