elf-tokenlist
The Tokenlist for Element.finance
Install
To install this repo as a dependency on another repo, you'll need to follow these steps in that
repo.
npm install git+https://github.com/element-fi/elf-tokenlist.git
- Since this repo is not an npm package yet, add this script to package.json to
stay up-to-date with the latest version.
"scripts": {
"update-elf-tokenlist": "npm install git+https://github.com/element-fi/elf-tokenlist.git"
},
Setup
To setup this repo you need to run the following:
npm ci
You'll also need to add api keys listed in elf.default.env to your local elf.env file.
Deploying a new term
When a new term is deployed in the elf-deploy repo, run this command to
regenerate the tokenlist:
npm run build
Once complete, commit all file changes and submit a PR to main.
Any project that wants the latest tokenlist will now need to update their
dependency on this repo. See below for handy script that makes upgrading easy
for consumers.
Usage Examples
List the open principal tokens
This is how to get a list of currently open principal tokens.
import { ElementTokenTag, mainnetTokenList } from "elf-tokenlist";
const principalTokens = mainnetTokenList.tokens
.filter(
(token) => token.tags?.includes(ElementTokenTag.PRINCIPAL)
)
.filter(
(token) => token.extensions.unlockTimestamp > Date.now() * 1000
).
Developer Config
To build this repo you need to configure some env variables. For linux and mac run the following:
cp elf.default.env elf.env
- Update elf.env with your alchemy api key
export ALCHEMY_MAINNET_API_KEY=
export ALCHEMY_GOERLI_API_KEY=
source elf.env