Handle BigNumber event params and customize Decimal (#63)

* Handle BigNumber event params in watchers

* Customize decimal according to limits of IEEE-754 decimal128

* Add definition for custom scalar BigDecimal
This commit is contained in:
prathamesh0
2021-12-28 16:08:05 +05:30
committed by nabarun
parent 238ad21189
commit 94e9182dd3
19 changed files with 232 additions and 56 deletions
@@ -10,6 +10,7 @@ export function handleTest (event: Test): void {
log.debug('event.address: {}', [event.address.toHexString()]);
log.debug('event.params.param1: {}', [event.params.param1]);
log.debug('event.params.param2: {}', [event.params.param2.toString()]);
log.debug('event.params.param3: {}', [event.params.param3.toString()]);
log.debug('event.block.hash: {}', [event.block.hash.toHexString()]);
log.debug('event.block.stateRoot: {}', [event.block.stateRoot.toHexString()]);
@@ -32,8 +33,9 @@ export function handleTest (event: Test): void {
// Entity fields can be set based on event parameters
author.name = event.params.param1;
author.paramInt = event.params.param2;
author.paramBigInt = event.params.param3;
author.paramBytes = event.address;
author.rating = BigDecimal.fromString('4');
author.rating = BigDecimal.fromString('3.2132354');
// Entities can be written to the store with `.save()`
author.save();