Giter Site home page Giter Site logo

spiralsprotocol / address-metadata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from valora-inc/address-metadata

0.0 0.0 0.0 1.91 MB

Repository for storing and updating "static" RTDB data (supported ERC20 tokens, etc) used by Valora

Shell 0.45% JavaScript 2.57% TypeScript 96.98%

address-metadata's Introduction

address-metadata

This repository contains utilities and automation for updating static data (supported ERC20 tokens, etc) in Firebase's RTDB.

Disclaimer

Note: filing an issue does not guarantee addition to the supported token list. We do not review token addition requests in any particular order, and we do not guarantee that we will review your request to add the token to the supported list.

Adding new ERC20 tokens

To add a new ERC20 token you need to follow these steps:

  • Open src/data/mainnet/tokens-info.json and/or src/data/alfajores/tokens-info.json. You will see that it's an array of token info. Add a new object. The fields are described below.
  • Add the logo to assets/tokens
  • After doing this you should open a PR and ask someone on the Valora team to review it so it can be merged. Once it's merged, the new ERC20 token will be visible in the Valora Wallet for users holding it.

ERC20 token info

Property Description
address The lower-case address of the ERC20 token contract.
decimals The number of decimals used by the ERC20 token.
imageUrl The logo to display for the ERC20 token. It must be a 256 x 256 PNG. Add the image to the assets/tokens folder and use the following format: https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/{image}.png
name The name to display for the ERC20 token.
symbol The short symbol to display for the ERC20 token.

Generic Use

When adding a new node of data to this repository, first write a Joi schema for the data in src/schemas. Then, add the raw data as a JSON blob to e.g., src/data/mainnet/{some-rtdb-node}.json or src/data/alfajores/{some-rtdb-node}.json. Finally, import the appropriate files and fill in the required metadata in src/data/mainnet/index.ts or src/data/alfajores/index.ts. The rtdbLocation field in the metadata list should be the path where this data is located within RTDB.

Once these steps are done, any changes you make to the raw JSON files will be committed to the correct RTDB environments during CICD, on a merge to main.

This repository also contains some nifty utilities. Running yarn validate will validate all the JSON blobs against their corresponding schemas, and will fail if any of the JSON blobs are poorly formed.

yarn diff --project={mainnet|alfajores} --database-url={URL to Firebase RTDB location} will display a diff between the local JSON contents and the state within RTDB, much like git diff.

yarn update --project={mainnet|alfajores} --database-url={URL to Firebase RTDB location} will actually perform RTDB updates based off the local state. If some local JSON blob fails to validate, it will not be updated. Similarly, if the local state is already consistent with that in RTDB, we will not perform any write.

Install

yarn

Validate

yarn validate

Diff

yarn diff --project={mainnet|alfajores} --database-url={URL to Firebase RTDB location}

Knonw issues

When updating nodes without overrides, there is no check to avoid sending the update request even if there is no update (i.e. info in firebase is already ok).

Update RTDB

This is done automatically during CICD; you should not need to run this locally.

yarn update --project={mainnet|alfajores} --database-url={URL to Firebase RTDB location}

address-metadata's People

Contributors

biadebeatriz avatar cajubelt avatar dievazqu avatar eun-plata avatar garciapd avatar gnardini avatar jeanregisser avatar jophish avatar product-matt avatar renovate[bot] avatar shottah avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.