Skip to content

Latest commit

 

History

History
84 lines (57 loc) · 5.19 KB

SCRIPTS.md

File metadata and controls

84 lines (57 loc) · 5.19 KB

Scripts:

Below we break down the different steps/scripts we have on injective-list, explaining the step by step process generating the final list of TokenStatic data for use across the FE products.

Fetch chain metadata

https://github.com/InjectiveLabs/injective-lists/blob/master/ts-scripts/fetchChainTokenMetadata.ts

The script will fetch:

  1. bankMetadata from https://lcd.injective.network/swagger/#/Query/DenomsMetadata and cache them as json files which we will use as a source of reference for tokenFactory denoms.
  2. insuranceTokens from https://lcd.injective.network/swagger/#/Query/InsuranceFunds and cache them as json files which we will use as a source of reference for insurance denoms.
  3. supplyDenoms from https://lcd.injective.network/swagger/#/Query/TotalSupply and cache the denoms as json files, they will be used in the Format supply tokens script below.

Generate static tokens

https://github.com/InjectiveLabs/injective-lists/blob/master/ts-scripts/generateStaticTokens.ts

The script will import the hardcoded data from these files and convert them to TokenStatic tokens based on their type. Note: These hardcoded data/denoms here will take priority over data retrieved via other sources.

ℹ️ Refer to this doc on adding new static token-metadata to the injective-list repo.

Upload images to CloudFlare

https://github.com/InjectiveLabs/injective-lists/blob/master/ts-scripts/uploadImages.ts

Since images are no longer stored on the repo, we now use cloudflare to host the token logos/images.

The script will scan the images folder and compare it against the tokenImagePath.json map, if the image name doesn’t exist on the json file, the script will upload the image to cloudflare and create a new entry on the tokenImagePath.json file.

Format supply tokens

https://github.com/InjectiveLabs/injective-lists/blob/master/ts-scripts/generateSupplyTokens.ts

The script will import the cached supply denoms fetched in the Fetch chain metadata script and:

Fetch & format external tokens

https://github.com/InjectiveLabs/injective-lists/blob/master/ts-scripts/generateExternalTokens.ts

The script will fetch data from https://api.tfm.com/api/v1/ibc/chain/injective-1/tokens TFM aggregator endpoint and:

Collate the tokens from different sources into one list

https://github.com/InjectiveLabs/injective-lists/blob/master/ts-scripts/generateTokens.ts

The script will:

  1. combine the tokens from the:

    • static tokens
    • supply tokens
    • external tokens [mainnet only]
  2. Sort the list based on TokenVerification in the following order:

    • Verified
    • Internal
    • External
    • UnVerified
  3. Sort the list by denom alphabetically based on denom

  4. append the correct cloudFlare logo based on the token's string logo via the tokenImagePaths json file.

  5. generate one json file for each environment (mainnet, testnet and devnet), this will be the only reference file required for production usage