* clear

* feat: Add everything

* fix: Commenht
This commit is contained in:
Prad Nukala
2025-10-03 14:45:52 -04:00
committed by GitHub
parent 43b4a11c06
commit 13e6c3e84d
1935 changed files with 655061 additions and 40058 deletions
@@ -0,0 +1,8 @@
import type { ChainRegistryAssetList } from '../types/ChainRegistryAssetList';
export async function getChainRegistryAssetList(chain: string): Promise<ChainRegistryAssetList> {
const res = await fetch(
`https://raw.githubusercontent.com/cosmos/chain-registry/master/${chain}/assetlist.json`
);
return res.json();
}
@@ -0,0 +1,8 @@
import type { ChainRegistryChainInfo } from '../types/ChainRegistryChainInfo';
export async function getChainRegistryChainInfo(chain: string): Promise<ChainRegistryChainInfo> {
const res = await fetch(
`https://raw.githubusercontent.com/cosmos/chain-registry/master/${chain}/chain.json`
);
return res.json();
}
+5
View File
@@ -0,0 +1,5 @@
export type * from '@keplr-wallet/types';
export { getChainRegistryAssetList } from './apis/getChainRegistryAssetList';
export { getChainRegistryChainInfo } from './apis/getChainRegistryChainInfo';
export type { ChainRegistryAssetList } from './types/ChainRegistryAssetList';
export type { ChainRegistryChainInfo } from './types/ChainRegistryChainInfo';
@@ -0,0 +1,270 @@
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Asset lists are a similar mechanism to allow frontends and other UIs to fetch metadata associated with Cosmos SDK denoms, especially for assets sent over IBC.
*/
export interface ChainRegistryAssetList {
$schema?: string;
chain_name: string;
assets: Asset[];
}
export interface Asset {
/**
* [OPTIONAL] Whether the asset has been deprecated for use. For readability, it is best to omit this property unless TRUE.
*/
deprecated?: boolean;
/**
* [OPTIONAL] A short description of the asset
*/
description?: string;
/**
* [OPTIONAL] A long description of the asset
*/
extended_description?: string;
denom_units: DenomUnit[];
/**
* [OPTIONAL] The potential options for type of asset. By default, assumes sdk.coin
*/
type_asset:
| 'sdk.coin'
| 'cw20'
| 'erc20'
| 'ics20'
| 'snip20'
| 'snip25'
| 'bitcoin-like'
| 'evm-base'
| 'svm-base'
| 'substrate'
| 'unknown';
/**
* [OPTIONAL] The address of the asset. Only required for type_asset : cw20, snip20
*/
address?: string;
/**
* The base unit of the asset. Must be in denom_units.
*/
base: string;
/**
* The project name of the asset. For example Bitcoin.
*/
name: string;
/**
* The human friendly unit of the asset. Must be in denom_units.
*/
display: string;
/**
* The symbol of an asset. For example BTC.
*/
symbol: string;
/**
* The origin of the asset, starting with the index, and capturing all transitions in form and location.
*/
traces?: (IbcTransition | IbcCw20Transition | IbcBridgeTransition | NonIbcTransition)[];
/**
* [OPTIONAL] IBC Channel between src and dst between chain
*/
ibc?: {
source_channel: string;
dst_channel: string;
source_denom: string;
};
logo_URIs?: {
png?: string;
svg?: string;
};
/**
* @minItems 1
*/
images?: [
{
image_sync?: Pointer;
png?: string;
svg?: string;
theme?: {
circle?: boolean;
dark_mode?: boolean;
monochrome?: boolean;
};
},
...{
image_sync?: Pointer;
png?: string;
svg?: string;
theme?: {
circle?: boolean;
dark_mode?: boolean;
monochrome?: boolean;
};
}[],
];
/**
* [OPTIONAL] The coingecko id to fetch asset data from coingecko v3 api. See https://api.coingecko.com/api/v3/coins/list
*/
coingecko_id?: string;
keywords?: string[];
socials?: {
website?: string;
twitter?: string;
telegram?: string;
discord?: string;
github?: string;
medium?: string;
reddit?: string;
};
}
export interface DenomUnit {
denom: string;
exponent: number;
aliases?: string[];
}
export interface IbcTransition {
type: 'ibc';
counterparty: {
/**
* The name of the counterparty chain. (must match exactly the chain name used in the Chain Registry)
*/
chain_name: string;
/**
* The base unit of the asset on its source platform. E.g., when describing ATOM from Cosmos Hub, specify 'uatom', NOT 'atom' nor 'ATOM'; base units are unique per platform.
*/
base_denom: string;
/**
* The counterparty IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
};
chain: {
/**
* The chain's IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
/**
* The port/channel/denom input string that generates the 'ibc/...' denom.
*/
path: string;
};
}
export interface IbcCw20Transition {
type: 'ibc-cw20';
counterparty: {
/**
* The name of the counterparty chain. (must match exactly the chain name used in the Chain Registry)
*/
chain_name: string;
/**
* The base unit of the asset on its source platform. E.g., when describing ATOM from Cosmos Hub, specify 'uatom', NOT 'atom' nor 'ATOM'; base units are unique per platform.
*/
base_denom: string;
/**
* The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for outgoing cw20 transfers.
*/
port: string;
/**
* The counterparty IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
};
chain: {
/**
* The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for outgoing cw20 transfers.
*/
port: string;
/**
* The chain's IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
/**
* The port/channel/denom input string that generates the 'ibc/...' denom.
*/
path: string;
};
}
export interface IbcBridgeTransition {
type: 'ibc-bridge';
counterparty: {
/**
* The name of the counterparty chain. (must match exactly the chain name used in the Chain Registry)
*/
chain_name: string;
/**
* The base unit of the asset on its source platform. E.g., when describing ATOM from Cosmos Hub, specify 'uatom', NOT 'atom' nor 'ATOM'; base units are unique per platform.
*/
base_denom: string;
/**
* The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for outgoing cw20 transfers.
*/
port?: string;
/**
* The counterparty IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
};
chain: {
/**
* The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for outgoing cw20 transfers.
*/
port?: string;
/**
* The chain's IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
/**
* The port/channel/denom input string that generates the 'ibc/...' denom.
*/
path: string;
};
/**
* The entity offering the service. E.g., 'Gravity Bridge' [Network] or 'Tether' [Company].
*/
provider: string;
}
export interface NonIbcTransition {
type:
| 'bridge'
| 'liquid-stake'
| 'synthetic'
| 'wrapped'
| 'additional-mintage'
| 'test-mintage'
| 'legacy-mintage';
counterparty: {
/**
* The chain or platform from which the asset originates. E.g., 'cosmoshub', 'ethereum', 'forex', or 'nasdaq'
*/
chain_name: string;
base_denom: string;
/**
* The contract address where the transition takes place, where applicable. E.g., The Ethereum contract that locks up the asset while it's minted on another chain.
*/
contract?: string;
};
chain?: {
/**
* The contract address where the transition takes place, where applicable. E.g., The Ethereum contract that locks up the asset while it's minted on another chain.
*/
contract: string;
};
/**
* The entity offering the service. E.g., 'Gravity Bridge' [Network] or 'Tether' [Company].
*/
provider: string;
}
/**
* The (primary) key used to identify an object within the Chain Registry.
*/
export interface Pointer {
/**
* The chain name or platform from which the object resides. E.g., 'cosmoshub', 'ethereum', 'forex', or 'nasdaq'
*/
chain_name: string;
/**
* The base denom of the asset from which the object originates. E.g., when describing ATOM from Cosmos Hub, specify 'uatom', NOT 'atom' nor 'ATOM'; base units are unique per platform.
*/
base_denom?: string;
}
@@ -0,0 +1,239 @@
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Chain.json is a metadata file that contains information about a blockchain.
*/
export type ChainRegistryChainInfo = ChainRegistryChainInfo1 & ChainRegistryChainInfo2;
export type ChainRegistryChainInfo1 = {
[k: string]: unknown | undefined;
};
/**
* Detailed version identifier (e.g., 'v1.0.0-a1s2f43g').
*/
export type Tag = string;
/**
* Simple version string (e.g., 'v1.0.0').
*/
export type Version = string;
/**
* URL of the code repository.
*/
export type Repo = string;
export interface ChainRegistryChainInfo2 {
$schema?: string;
chain_name: string;
/**
* The 'type' of chain as the corresponding CAIP-2 Namespace value. E.G., 'cosmos' or 'eip155'. Namespaces cna be found here: https://github.com/ChainAgnostic/namespaces/tree/main.
*/
chain_type:
| 'cosmos'
| 'eip155'
| 'bip122'
| 'polkadot'
| 'solana'
| 'algorand'
| 'arweave'
| 'ergo'
| 'fil'
| 'hedera'
| 'monero'
| 'reef'
| 'stacks'
| 'starknet'
| 'stellar'
| 'tezos'
| 'vechain'
| 'waves'
| 'xrpl'
| 'unknown';
chain_id?: string;
pre_fork_chain_name?: string;
pretty_name?: string;
website?: string;
status?: 'live' | 'upcoming' | 'killed';
network_type?: 'mainnet' | 'testnet' | 'devnet';
/**
* The default prefix for the human-readable part of addresses that identifies the coin type. Must be registered with SLIP-0173. E.g., 'cosmos'
*/
bech32_prefix?: string;
/**
* Used to override the bech32_prefix for specific uses.
*/
bech32_config?: {
/**
* e.g., 'cosmos'
*/
bech32PrefixAccAddr?: string;
/**
* e.g., 'cosmospub'
*/
bech32PrefixAccPub?: string;
/**
* e.g., 'cosmosvaloper'
*/
bech32PrefixValAddr?: string;
/**
* e.g., 'cosmosvaloperpub'
*/
bech32PrefixValPub?: string;
/**
* e.g., 'cosmosvalcons'
*/
bech32PrefixConsAddr?: string;
/**
* e.g., 'cosmosvalconspub'
*/
bech32PrefixConsPub?: string;
};
daemon_name?: string;
node_home?: string;
key_algos?: ('secp256k1' | 'ethsecp256k1' | 'ed25519' | 'sr25519' | 'bn254')[];
slip44?: number;
alternative_slip44s?: number[];
fees?: {
fee_tokens: FeeToken[];
};
staking?: {
staking_tokens: StakingToken[];
lock_duration?: {
/**
* The number of blocks for which the staked tokens are locked.
*/
blocks?: number;
/**
* The approximate time for which the staked tokens are locked.
*/
time?: string;
};
};
codebase?: {
git_repo?: string;
recommended_version?: string;
compatible_versions?: string[];
tag?: Tag;
language?: Language;
binaries?: Binaries;
sdk?: Sdk;
consensus?: Consensus;
cosmwasm?: Cosmwasm;
ibc?: Ibc;
genesis?: {
name?: string;
genesis_url: string;
ics_ccv_url?: string;
};
};
images?: (
| {
[k: string]: unknown | undefined;
}
| {
[k: string]: unknown | undefined;
}
)[];
logo_URIs?: {
png?: string;
svg?: string;
};
description?: string;
peers?: {
seeds?: Peer[];
persistent_peers?: Peer[];
};
apis?: {
rpc?: Endpoint[];
rest?: Endpoint[];
grpc?: Endpoint[];
wss?: Endpoint[];
'grpc-web'?: Endpoint[];
'evm-http-jsonrpc'?: Endpoint[];
};
explorers?: Explorer[];
keywords?: string[];
extra_codecs?: ('ethermint' | 'injective')[];
}
export interface FeeToken {
denom: string;
fixed_min_gas_price?: number;
low_gas_price?: number;
average_gas_price?: number;
high_gas_price?: number;
gas_costs?: {
cosmos_send?: number;
ibc_transfer?: number;
};
}
export interface StakingToken {
denom: string;
}
export interface Language {
type: 'go' | 'rust' | 'solidity' | 'other';
version?: Version;
repo?: Repo;
tag?: Tag;
}
export interface Binaries {
'linux/amd64'?: string;
'linux/arm64'?: string;
'darwin/amd64'?: string;
'darwin/arm64'?: string;
'windows/amd64'?: string;
'windows/arm64'?: string;
}
export interface Sdk {
type: 'cosmos' | 'penumbra' | 'other';
version?: Version;
repo?: Repo;
tag?: Tag;
}
export interface Consensus {
type: 'tendermint' | 'cometbft' | 'sei-tendermint';
version?: Version;
repo?: Repo;
tag?: Tag;
}
export interface Cosmwasm {
version?: Version;
repo?: Repo;
tag?: Tag;
enabled?: boolean;
/**
* Relative path to the cosmwasm directory. ex. $HOME/.juno/data/wasm
*/
path?: string;
}
export interface Ibc {
type: 'go' | 'rust' | 'other';
version?: Version;
repo?: Repo;
tag?: Tag;
/**
* List of IBC apps (usually corresponding to a ICS standard) which have been enabled on the network.
*/
ics_enabled?: ('ics20-1' | 'ics27-1' | 'mauth')[];
}
export interface Peer {
id: string;
address: string;
provider?: string;
}
export interface Endpoint {
address: string;
provider?: string;
archive?: boolean;
}
export interface Explorer {
kind?: string;
url?: string;
tx_page?: string;
account_page?: string;
validator_page?: string;
proposal_page?: string;
block_page?: string;
}