https://github.com/lit-protocol/dune-updater
https://github.com/lit-protocol/dune-updater
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lit-protocol/dune-updater
- Owner: LIT-Protocol
- Created: 2024-10-31T21:07:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-07T18:17:57.000Z (over 1 year ago)
- Last Synced: 2025-03-07T19:24:51.755Z (over 1 year ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Getting Started
To trigger the script
```
npm run start
```
## Working
It works in two parts:
- Fetches Genius API for their realtime wrapped keys data
- Fetches Yellowstone Blockchain for new PKPs minted after last table update
### Relies on 3 DBs
- genius_wk_api
- yellowstone_pkp_api
- latest_blocks_api
### Genius Wrapped Keys
- Uses `/clear` endpoint to clear existing table from Dune
- Fetches from API
- Filters for keytype and appends to the object array
- Converts to CSV
- Uses `/insert` endpoint to push the csv to Dune
- Uses `/execute` endpoint to refresh the query responsible for fetching from table
### Yellowstone PKPs
- Stores starting and end block for each scan on Blocks Table
- Fetches Blocks Table for end block to use it as a starting block for next scan
- Scans Yellowstone till the current block
- Convert to results to csv, also creates a csv for start and block of this scan
- Uses `/insert` and `/execute` to push and refresh Yellowstone table
- Uses `/clear` endpoint to clear existing Blocks table from Dune
- Uses `/insert` and `/execute` to push and refresh Blocks table
# AWS Auth for Wrapped Keys
There's an account in IAM called `wrapped-keys-s3-export-reader` which has access to the `lit-wk-pubkeys-production` and `lit-wk-pubkeys-testnetworks` buckets.
To get the credentials, you can use the `aws.js` file.
```
const assumedCredentials = await getAwsCredentials("WrappedKeysProduction");
```
You must supply the corresponding env vars for that IAM user, via `AWS_IAM_ACCESS_KEY` and `AWS_IAM_SECRET_KEY`.