Commit Graph

212 Commits

Author SHA1 Message Date
prathamesh0
40574cf3d9
Support GQL subscriptions, fill and custom hook for indexing on event (#255)
* Custom hook support for indexing on events.

* Add fill support.

* Process GQL subscriptions.

* Add hooks example.

* Update hooks example.
2021-09-29 10:04:09 +05:30
prathamesh0
8e3093c684
Codegen flag for watcher kind and eventsInRange query support (#254)
* Add watcher kind argument.

* Process eventsInRange query.
2021-09-28 10:22:21 +05:30
Ashwin Phatak
338cef9954
Generate entities from YAML templates and lint support in generated watchers (#253)
* Add lint files generation.

* Fix lint errors in generated code.

* Load default entities from yaml files.

Co-authored-by: prathamesh <prathamesh.musale0@gmail.com>
2021-09-27 18:03:04 +05:30
Ashwin Phatak
11d16b9870
Implement active watcher. (#252)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-27 15:24:17 +05:30
Ashwin Phatak
482be8cfaa
Support storage mode for code generator (#251)
* Implement storage mode in code generator.

* Fix indexer template for eth_call.

* Add support for both eth_call and storage modes.

* Add eventsInRange, events file gen and default entites gen.

* Use static property to column maps in database.

* Process events query.

* Avoid adding duplicate events in indexer.

* Fix generated watcher query with bigint arguments.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
Co-authored-by: prathamesh <prathamesh.musale0@gmail.com>
2021-09-27 10:13:50 +05:30
Ashwin Phatak
92b7967895
Generating eth_call based lazy watcher (#249)
* Add entity generation.

* Add resolvers generation.

* Add queries in resolvers generation.

* Add indexer generation.

* Extract helper code in utils.

* Add server and artifacts generation.

* Fix solidity-flattener issue.

* Update readme and cleanup misc files.

* Add queries to entity generation.

* Add database generation.

* Use snakecase in database.

* Add readme generation.

* Change template file names.

* Add method descriptions.

* Change mode to eth_call in readme.

Co-authored-by: prathamesh <prathamesh.musale0@gmail.com>
2021-09-23 16:55:46 +05:30
Ashwin Phatak
4f8f1d8cd7
Update code for log_cids change in vdb core (#243)
* Remove fields no longer present in schema.

* Refactor code to work with log_cids change in eth-server.

* Refactor process event to save events from logs.

* Use constants for erc20 event names.

* Implement watch blocks in erc20-watcher similar to uni-watcher.

* Moved common methods to util.

* Implement eventsInRange query in erc20-watcher.

* Filter unknown event in database query.

* Change dependencies version to be same in all packages.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-21 16:43:55 +05:30
Ashwin Phatak
0a96bbd94d
Change dependencies version to be same in all packages. (#250)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-21 10:27:34 +05:30
Ashwin Phatak
c973f3b343
Add husky for setting lint in commit hook. (#248)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-20 16:25:54 +05:30
Ashwin Phatak
6560639a68
Use flatten function and modify ResultEvent in schema. (#247)
Co-authored-by: prathamesh <prathamesh.musale0@gmail.com>
2021-09-17 17:10:08 +05:30
Ashwin Phatak
f9934675b2
CLI to flatten and generate GQL schema from Solidity file (#245)
* Add schema generation.

* Use yargs and add a script to generate schema.

* Add command to generate schema to README.md

* Remove use of arrow functions in visitor.

* Add function to export schema in visitor.

* Create Event union while adding to it.

* Add bool to typemappings.

* Add method descriptions and remove output type mappings.

* Add storage mode.

* Add URL support and a flattening script.

* Fix parameter for flattening in README.md.

* Add setup and references to README.md.

Co-authored-by: prathamesh <prathamesh.musale0@gmail.com>
2021-09-16 17:06:10 +05:30
Ashwin Phatak
a9dc34f704
Fix null parent. (#244)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-09 10:51:58 +05:30
Ashwin Phatak
06bed1c13b
Enable source maps for transpiled files (#242)
* Rename .spec files to .test files.

* Enable source maps.

* Pass enable-source-maps flag for transpiled files.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
Co-authored-by: prathamesh <prathamesh.musale0@gmail.com>
2021-09-07 16:01:15 +05:30
Ashwin Phatak
d3a50d2b18
Fix package versions after cleaning dependencies. (#241)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-02 16:13:55 +05:30
Ashwin Phatak
2d493b3838
Run services from transpiled ES5 (#239)
* Transpile ES5 code.

* Use transpiled ES5 code in all packages.

* Refactor tracing-client to transpile ES5 code.

* Order scripts in package json.

* Update readme in packages with new scripts.

* Refactor code to use entity config programatically.

* Remove unused depencdencies.

* Use DEBUG environment for scripts.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-09-02 10:27:56 +05:30
Ashwin Phatak
fc4f49113b
Bug fixes from smoke testing (#238)
* Fix update for entity relations.

* Implement demo values in uni-info-watcher indexer code.

* amend

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-31 18:05:29 +05:30
Ashwin Phatak
f1f70ad7d4
Move chain pruning to block processing queue with higher priority (#235)
* Move chain pruning to block processing queue.

* Refactor common code in util.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-30 11:16:54 +05:30
Ashwin Phatak
458956a3a1
Fix ts-node watch for file changes. (#234)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-27 18:14:23 +05:30
Ashwin Phatak
cf0713eda7
Tasks in erc20-watcher to deploy and transfer tokens. (#233)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-27 17:47:23 +05:30
Ashwin Phatak
8fa6229562
Fix queries, demo mode to display all tokens (#231)
* Fix queries for frontend info app.

* Fix query for nested relations.

* Add demo mode in uni-info-watcher.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-26 15:36:16 +05:30
Ashwin Phatak
5941a929d2
Implement health query for uniswap-info. (#228)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-25 17:12:23 +05:30
Ashwin Phatak
afd7c954a2
Refactoring pruning and reorg handling code (#227)
* Refactor db methods getPrevEntityVersion and getFrothyRegion.

* Filter out entities from pruned blocks.

* Pull saveContract and getModelEntities to util.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-25 12:47:53 +05:30
Ashwin Phatak
3ff2fdf11b
Refactoring, extract uni-info-watcher GQL client (#226)
* Refactor common code in uni-watcher and uni-info-watcher.

* Implement client.ts in uni-info-watcher for queries and use in smoke-test.

* Disable cache in graphql client.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-24 11:55:29 +05:30
Ashwin Phatak
885a55e513
Implement hierarchical query for checking ancestor block during pruning (#225)
* Implement hierarchical query for checking ancestor block.

* Prune blocks together in single query.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-23 17:06:35 +05:30
Ashwin Phatak
2ddedfefe7
Refactoring common code into util (#224)
* Refactor and pull common database code to util.

* Refactor and pull common indexer code to util.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-20 19:02:57 +05:30
8489b5632a
Tests for pruning abandonded branches (#223)
* Create dummy test blocks and refactor test code.

* Intial test for pruning block in a chain without branches.

* Add test for pruning with multiple branches.

* Add test for pruning at frothy region.

* Test for pruning block at height more than max reorg depth.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-20 12:26:37 +05:30
Ashwin Phatak
35068b2c3d
Implement chain pruning in uni-info-watcher (#222)
* Refactor code for chain pruning.

* Implement chain pruning in uni-info-watcher.

* Refactor pruning code to util.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-19 13:27:32 +05:30
Ashwin Phatak
b8b216ea5b
Extract block filler into common package, implement in uni-info-watcher (#220)
* Implement block filler for uni-info-watcher.

* Pull common code for Block filler to util.

* Watch for job events in block filler command.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-18 15:50:44 +05:30
Ashwin Phatak
23bfcc02dc
Implement heirarchical query for getting previous entity (#216)
* Implement heirarchical query for getting previous entity.

* Check entity id in hierarchical query to limit number of recursions.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-16 17:55:23 +05:30
Ashwin Phatak
9e1ed70d18
Tests for getPrevEntityVersion (#217)
* Insert and remove a dummy BlockProgress from db.

* Test to fetch a Token entity from pruned region.

* Check if db is empty initially.

* Test to fetch a Token entity from frothy region.

* Test to fetch a Token from frothy region (same block num).

* Test to fetch a Token entity from another branch.

* Tests to fetch a Token entity (multiple tokens).

* Test to fetch updated Token entity in pruned region.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-16 15:42:34 +05:30
Ashwin Phatak
ec92779c4e
Link to original code/license for reused source (#214) 2021-08-13 15:23:42 +05:30
Ashwin Phatak
eb912b7f68
Blocks GQL API (#213)
* Add schema for blocks query.

* Implement resolver for blocks query.

* Fix issue with multiple query filters for one entity field.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-13 15:06:58 +05:30
Ashwin Phatak
a7ec3d8da8
Add APGL license and copyright notices (#212)
* Add license & copyright declarations for add-watcher.

* Add copyright declarations for cache.

* Add copyright declarations for erc20-watcher.

* Add copyright declarations for ipld-eth-client.

* Add copyright declarations for tracing-client.

* Add copyright declarations for uni-watcher.

* Add copyright declarations for solidity-mapper.

* Add copyright declarations for uni-info-watcher.

* Add copyright declarations for util.

* Add copyright declarations for lighthouse-watcher.

* Change license identifier in .sol files.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-12 15:28:13 +05:30
Ashwin Phatak
1cbd70e57c
Add script to reset the databases. (#211)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-12 14:54:31 +05:30
Ashwin Phatak
43107b9ed7
Remove unused settings from lighthouse config. (#210)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-12 10:33:23 +05:30
Ashwin Phatak
4fb0d95135
Lighthouse watcher (#205)
* Implement watcher for Lighthouse StorageRequest event.

* Add smoke test for lighthouse watcher.

* Add fileCost as value to Lighthouse store call.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-11 17:27:49 +05:30
Ashwin Phatak
053695a3e8
Add test:init in uni-watcher. (#204)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-11 16:27:42 +05:30
Ashwin Phatak
cbc8dce88b
Implement transaction for uni-info-watcher blocks and events update. (#203)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-11 15:23:44 +05:30
Ashwin Phatak
1372fc74ef
Test for entities after CollectEvent. (#202)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-10 17:31:50 +05:30
Ashwin Phatak
ed9577b830
Test for entities after DecreaseLiquidityEvent. (#199)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-10 16:32:35 +05:30
Ashwin Phatak
6c05600b41
Test for entities after IncreaseLiquidityEvent. (#198)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-10 15:53:59 +05:30
Ashwin Phatak
0c2efde028
Test for entities after TransferEvent (#196)
* Add resolver for Position entity in uni-info-watcher.

* Test for entities after TransferEvent.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-10 12:09:00 +05:30
nikugogoi
abd3175c09
Import test utils separately. (#194)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-09 21:34:55 +05:30
Ashwin Phatak
16b041c5cf
Test for Transaction entity after Mint, Burn & Swap events. (#193)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-09 12:08:37 +05:30
Ashwin Phatak
a9d9b39c37
Fix transaction query runner in event handlers. (#192)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-09 11:30:43 +05:30
Ashwin Phatak
88121f9390
Test for entities after SwapEvent. (#191)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-06 19:10:25 +05:30
Ashwin Phatak
91463136d7
Implement transactions in uni-watcher. (#190)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-06 17:53:55 +05:30
Ashwin Phatak
63620f0a0a
Smoke test for entities after BurnEvent (#189)
* Test for entities after BurnEvent.

* Fix event value types in uni-info-watcher.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-06 17:21:30 +05:30
Ashwin Phatak
95f830178d
Test for all entities after MintEvent. (#188)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-06 12:12:52 +05:30
Ashwin Phatak
0487c05ee1
Event handlers should update db atomically (#186)
* Run db operations inside event handlers atomically using transaction.

* Implement database transaction for Pool Initialize event.

* Implement typeorm transaction without callback.

* Implement transaction for NFPM event handlers.

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-06 10:25:56 +05:30