Skip to content

Commit

Permalink
feat: add cosmos ecosystem tokens for IBC chains
Browse files Browse the repository at this point in the history
  • Loading branch information
jurevans committed Feb 14, 2024
1 parent 0263201 commit a25f87d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 7 deletions.
29 changes: 25 additions & 4 deletions packages/types/src/tokens/Cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,35 @@ import {
CosmosTokenType,
} from "./types";

// Define tokens and helpers for Cosmos ecosystem
/**
* Define tokens and helpers for Cosmos ecosystem
*/

// TODO: As Cosmos tokens are added to our TokenType, map corresponding denom from Keplr config
// See: https://github.com/chainapsis/keplr-wallet/blob/master/packages/extension/src/config.ts for all values in Keplr
// See: https://github.com/chainapsis/keplr-wallet/blob/master/packages/extension/src/config.ts
// for all values in Keplr
type CosmosDenom = [CosmosMinDenom, CosmosTokenType];
const CosmosTokenDenoms: CosmosDenom[] = [
["uatom", "ATOM"],
["uosmo", "OSMO"],
["uion", "ION"],
["uscrt", "SCRT"],
["uakt", "AKT"],
["basecro", "CRO"],
["uctk", "CTK"],
["uiris", "IRIS"],
["uregen", "REGEN"],
["uxprt", "XPRT"],
["udvpn", "DVPN"],
["boot", "BOOT"],
["ujuno", "JUNO"],
["ustars", "STARS"],
["uaxl", "AXL"],
["usomm", "SOMM"],
["uumee", "UMEE"],
["ugraviton", "GRAV"],
["ustrd", "STRD"],
["aevmos", "EVMOS"],
["inj", "INJ"],
];

const tokenDenomLookup = (
Expand Down Expand Up @@ -62,7 +83,7 @@ CosmosTokens["ATOM"].coinGeckoId = "cosmos";
CosmosTokens["OSMO"] = {
symbol: "OSMO",
type: 0,
path: 0,
path: 118,
coin: "Osmo",
url: "https://osmosis.zone/",
address: "",
Expand Down
5 changes: 4 additions & 1 deletion packages/types/src/tokens/Namada.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { RegisteredCoinType, registeredCoinTypes } from "slip44";
import { Symbols, TokenLookup, TokenType } from "./types";

// Define default Namada tokens and assign SLIP-044 attributes
/**
* Define default Namada tokens and assign SLIP-044 attributes
*/

const {
NAMADA_INTERFACE_NAMADA_TOKEN:
Expand Down Expand Up @@ -37,6 +39,7 @@ Tokens["NAM"] = {
...Tokens["NAM"],
url: "https://namada.net",
address: nativeToken,
// Symbol for SE. Set to "NAM" for mainnet
symbol: "Naan",
};

Expand Down
49 changes: 47 additions & 2 deletions packages/types/src/tokens/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,52 @@ export type TokenType = (typeof Symbols)[number];
export type TokenLookup = Record<TokenType, TokenInfo>;

// Tokens in Cosmos ecosystem
export const CosmosSymbols = ["ATOM", "OSMO"] as const;
export type CosmosMinDenom = "uatom" | "uosmo";
export const CosmosSymbols = [
"ATOM",
"OSMO",
"ION",
"SCRT",
"AKT",
"CRO",
"CTK",
"IRIS",
"REGEN",
"XPRT",
"DVPN",
"BOOT",
"JUNO",
"STARS",
"AXL",
"SOMM",
"UMEE",
"GRAV",
"STRD",
"EVMOS",
"INJ",
] as const;

export type CosmosMinDenom =
| "uatom"
| "uosmo"
| "uion"
| "uscrt"
| "uakt"
| "basecro"
| "uctk"
| "uiris"
| "uregen"
| "uxprt"
| "udvpn"
| "boot"
| "ujuno"
| "ustars"
| "uaxl"
| "usomm"
| "uumee"
| "ugraviton"
| "ustrd"
| "aevmos"
| "inj";

export type CosmosTokenType = (typeof CosmosSymbols)[number];
export type CosmosTokenLookup = Record<CosmosTokenType, TokenInfo>;

0 comments on commit a25f87d

Please sign in to comment.