To trigger the script
npm run start
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
- genius_wk_api
- yellowstone_pkp_api
- latest_blocks_api
- Uses
/clearendpoint to clear existing table from Dune - Fetches from API
- Filters for keytype and appends to the object array
- Converts to CSV
- Uses
/insertendpoint to push the csv to Dune - Uses
/executeendpoint to refresh the query responsible for fetching from table
- 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
/insertand/executeto push and refresh Yellowstone table - Uses
/clearendpoint to clear existing Blocks table from Dune - Uses
/insertand/executeto push and refresh Blocks table
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.