Skip to content

Commit

Permalink
move to v1 and v2 folders
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed Oct 9, 2024
1 parent e9f9f98 commit 27911c0
Show file tree
Hide file tree
Showing 2,793 changed files with 7,952 additions and 18 deletions.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions v1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules/
**/.DS_Store
**/dist
**/yarn-error.log
lerna-debug.log
File renamed without changes.
File renamed without changes.
276 changes: 276 additions & 0 deletions v1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
# chain-registry

<p align="center" width="100%">
<img height="90" src="https://user-images.githubusercontent.com/545047/190171475-b416f99e-2831-4786-9ba3-a7ff4d95b0d3.svg" />
</p>

<p align="center" width="100%">
<a href="https://github.com/cosmology-tech/chain-registry/actions/workflows/run-tests.yml">
<img height="20" src="https://github.com/cosmology-tech/chain-registry/actions/workflows/run-tests.yml/badge.svg" />
</a>
<a href="https://github.com/cosmology-tech/lib-count">
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcosmology-tech%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fchain-registry%2Ftotal.json" />
</a>
<a href="https://github.com/cosmology-tech/lib-count">
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcosmology-tech%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fchain-registry%2Fmonthly.json" />
</a>
<br />
<a href="https://github.com/cosmology-tech/chain-registry/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
<a href="https://www.npmjs.com/package/chain-registry"><img height="20" src="https://img.shields.io/github/package-json/v/cosmology-tech/chain-registry?filename=packages%2Fchain-registry%2Fpackage.json"></a>
</p>

The npm package for the Official Cosmos [chain registry](https://github.com/cosmos/chain-registry)

```
npm install chain-registry
```

A unified store of chains info, assets, asset lists, and IBC channels for the Cosmos ecosystem. Get everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.


## Features

- 🌐 **Dynamic Loading via [ChainRegistryClient](https://github.com/cosmology-tech/chain-registry/tree/main/packages/client)** - Utilize the client for dynamic data fetching.
- 📦 **Tree-Shaking Support** - Optimize your bundles and [include only what you need](#tree-shaking-imports-from-chain-registry).
- 🔌 **Module Compatibility** - Supports both CommonJS and ES Module formats, ensuring compatibility with various JavaScript environments and tools.
- 🛠 **Utilities for Working with Assets and Chains** - [Comprehensive tools](https://github.com/cosmology-tech/chain-registry/tree/main/packages/client) to manage assets and chains efficiently.
- 🌎 **Pre-generated Asset Lists with IBC Denominations for All Chains** - Access ready-to-use [asset lists](ttps://github.com/cosmology-tech/chain-registry/tree/main/packages/assets) across all chains.
- 🔄 **Conversions for Keplr, Cosmostation** - Easily convert data for use with Keplr and Cosmostation wallets.

## Usage

### Using the `chain-registry`

Fetch data from `chain-registry`:

```js
import { assets, chains, ibc } from 'chain-registry';

const assetList = assets.find(({chain_name})=>chain_name==='osmosis');

console.log(assetList);
```

will output:

```js
{
'$schema': '../assetlist.schema.json',
chain_name: 'osmosis',
assets: [
{
description: 'The native token of Osmosis',
denom_units: [Array],
base: 'uosmo',
name: 'Osmosis',
display: 'osmo',
symbol: 'OSMO',
logo_URIs: [Object],
coingecko_id: 'osmosis'
},
{
denom_units: [Array],
base: 'uion',
name: 'Ion',
display: 'ion',
symbol: 'ION',
logo_URIs: [Object],
coingecko_id: 'ion'
}
]
}
```

### Using the `@chain-registry/client` for dynamic data

Dynamically fetch data:

```js
import { ChainRegistryClient } from '@chain-registry/client';

// create an instance of ChainRegistryClient by passing in the chain names
const client = new ChainRegistryClient({
chainNames: [
'osmosis',
'juno',
'stargaze'
]
});

// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method
await client.fetchUrls();
// get chain data
const chain = client.getChain('osmosis');
// get asset list
const assetList = client.getChainAssetList('osmosis');
// get ibc data
const ibcData = client.getChainIbcData('osmosis');
// get asset list (including ibc assets)
const generatedAssetList = client.getGeneratedAssetLists('osmosis');
```

### Tree-Shaking Imports from `chain-registry`

Tree-shaking is a modern JavaScript feature that allows for smaller bundle sizes by only including the code that is actually used in your project. The `chain-registry` package supports tree-shaking, ensuring that only the specified imports are included in your bundle. Below are examples of how to import different datasets according to your needs.

#### Importing Data from Mainnets, Testnets, and Devnets

You can directly import assets and chain information based on the network type - mainnet, testnet, or devnet. Here’s how you can import data for each network type:

- **Mainnet Chains and Assets**
```js
import { assets, chains } from 'chain-registry/mainnet';
```

- **Testnet Chains and Assets**
```js
import { assets, chains } from 'chain-registry/testnet';
```

- **Devnet Chains and Assets**
```js
import { assets, chains } from 'chain-registry/devnet';
```

#### Importing Specific Data from a Particular Chain

If you are interested in a specific chain, such as Osmosis on the mainnet, you can import data related to that particular chain only:

- **Chains and Assets from a Specific Mainnet Chain (e.g., Osmosis)**
```js
import { assets, chain } from 'chain-registry/mainnet/osmosis';
```

- **Only Assets from a Specific Mainnet Chain (e.g., Osmosis)**
```js
import assets from 'chain-registry/mainnet/osmosis/assets';
```

- **Only Chain Information from a Specific Mainnet Chain (e.g., Osmosis)**
```js
import chain from 'chain-registry/mainnet/osmosis/chain';
```

#### Importing Data from Non-Cosmos Chains

To include data from non-Cosmos chains, use the following import:

- **Assets from Non-Cosmos Chains**
```js
import { assets } from 'chain-registry/noncosmos';
```

## Packages

#### [chain-registry](packages/chain-registry)

An npm module for the Official `chain-registry` for the Cosmos ⚛️

#### [@chain-registry/client](legacy/client)

A Client for `chain-registry` that allows you to dynamically fetch data.

#### [@chain-registry/types](legacy/types)

Types for `chain-registry`.

#### [@chain-registry/keplr](legacy/keplr)

Keplr integration for the chain-registry returning keplr's `ChainInfo` type from `@chain-registry/types` `Chain` type.

#### [@chain-registry/assets](legacy/assets)

Asset lists for the Cosmos ⚛️

#### [@chain-registry/osmosis](legacy/osmosis)

Chain Registry info for Osmosis, including asset lists.

#### [@chain-registry/juno](legacy/juno)

Chain Registry info for Juno, including asset lists.

#### [@chain-registry/utils](legacy/utils)

Utility functions for `chain-registry`.

## Developing

Checkout the repository run yarn to initialize the workspace:

```sh
# Clone the repo.
git clone https://github.com/cosmology-tech/chain-registry
yarn
```
### Building

```sh
yarn build
```

### Publishing

First, `cd` into the root folder of the project:

```sh
cd /your/path/to/chain-registry
```

Second, update the git submodules:

```sh
git submodule update --remote
```

Third, generate the code:

```sh
yarn codegen
```

Finally, commit and publish the code!

```sh
git commit -am "new registry updates"
lerna publish
```

### Updating Submodule Data

Use the following Makefile commands to update the data in the submodules. These commands will ensure that your submodules are synchronized with their respective remote repositories.

- **update-cosmos**: Updates the submodule to the latest commits of the `cosmos/chain-registry` repository. This should be used to pull the most current production data into your local environment.

```
make update-cosmos
```

- **update-fixtures**: Updates the submodule to the latest commits of the `cosmology-tech/chain-registry-fixtures` repository. Use this for testing purposes to ensure that your tests are running against stable, controlled data sets.

```
make update-fixtures
```

## Related

Checkout these related projects:

* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.

## Credits

🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.zone/validator)


## Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
24 changes: 24 additions & 0 deletions v1/lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"lerna": "6",
"conventionalCommits": true,
"npmClient": "yarn",
"npmClientArgs": [
"--no-lockfile"
],
"packages": [
"packages/*"
],
"version": "independent",
"registry": "https://registry.npmjs.org",
"command": {
"create": {
"homepage": "https://github.com/cosmology-tech/chain-registry",
"license": "SEE LICENSE IN LICENSE",
"access": "restricted"
},
"publish": {
"allowBranch": "main",
"message": "chore(release): publish"
}
}
}
50 changes: 50 additions & 0 deletions v1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@cosmology/chain-registry",
"version": "0.0.1",
"author": "Cosmology <[email protected]>",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/cosmology-tech/chain-registry"
},
"license": "SEE LICENSE IN LICENSE",
"publishConfig": {
"access": "restricted"
},
"workspaces": [
"packages/*"
],
"scripts": {
"clean": "lerna run clean",
"build": "lerna run build",
"symlink": "symlink-workspace --logLevel info",
"postinstall": "yarn symlink",
"lint": "lerna run lint --parallel",
"codegen": "lerna run codegen --parallel"
},
"devDependencies": {
"@chain-registry/cli": "^1.31.0",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.11",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"copyfiles": "^2.4.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-unused-imports": "^4.0.0",
"glob": "8.0.3",
"jest": "^29.6.2",
"lerna": "^6",
"mkdirp": "3.0.1",
"prettier": "^3.0.2",
"rimraf": "4.4.1",
"strfy-js": "^3.0.1",
"strip-ansi": "^6",
"symlink-workspace": "^1.9.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.1.6"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as path from 'path';
import { jsStringify } from 'strfy-js';

const NON_COSMOS_NETWORK_TYPE = 'noncosmos';
const registryDir = path.resolve( path.join(`${__dirname}/../../../`, registryDirInRepoPath));
const registryDir = path.resolve( path.join(`${__dirname}/../../../../`, registryDirInRepoPath));
const registryDirInRepoPath = 'repos/chain-registry';

const getValidVarName = (varName) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 27911c0

Please sign in to comment.