Skip to content

Commit

Permalink
fix: update types
Browse files Browse the repository at this point in the history
  • Loading branch information
marslavish committed Mar 18, 2024
1 parent c4895a4 commit 0537055
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 88 deletions.
27 changes: 0 additions & 27 deletions packages/utils/types/asset-list-util.d.ts

This file was deleted.

25 changes: 25 additions & 0 deletions packages/utils/types/assets.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Asset, AssetDenomUnit, AssetList } from '@chain-registry/types';
export type Denom = AssetDenomUnit['denom'];
export type Exponent = AssetDenomUnit['exponent'];
export declare const customFind: <T>(array: T[], filterFn: (item: T) => boolean) => T | undefined;
export declare const getAssetByDenom: (assets: AssetList[], denom: Denom, chainName?: string) => Asset | undefined;
export declare const getAssetBySymbol: (assets: AssetList[], symbol: string, chainName?: string) => Asset | undefined;
export declare const getDenomByCoinGeckoId: (assets: AssetList[], coinGeckoId: string, chainName?: string) => Denom | undefined;
type GetCoinGeckoIdByDenomOptions = {
chainName?: string;
allowTestnet?: boolean;
customAssetFilter?: (asset: Asset) => boolean;
excludedChainNames?: string[];
};
export declare const getCoinGeckoIdByDenom: (assets: AssetList[], denom: Denom, { chainName, allowTestnet, customAssetFilter, excludedChainNames }?: GetCoinGeckoIdByDenomOptions) => string | undefined;
export declare const getSymbolByDenom: (assets: AssetList[], denom: Denom, chainName?: string) => string | undefined;
export declare const getDenomBySymbol: (assets: AssetList[], symbol: string, chainName?: string) => Denom | undefined;
export declare const getExponentFromAsset: (asset: Asset) => number | undefined;
export declare const getExponentByDenom: (assets: AssetList[], denom: Denom, chainName?: string) => Exponent | undefined;
export declare const getExponentBySymbol: (assets: AssetList[], symbol: string, chainName?: string) => Exponent | undefined;
export declare const getNativeTokenByChainName: (assets: AssetList[], chainName: string) => Asset | undefined;
export declare const getTokenLogoByDenom: (assets: AssetList[], denom: Denom, chainName?: string) => string | undefined;
export declare const getChainLogo: (assets: AssetList[], chainName: string) => string | undefined;
export declare const getTokenNameByDenom: (assets: AssetList[], denom: Denom, chainName?: string) => string | undefined;
export declare const getChainNameByDenom: (assets: AssetList[], denom: Denom) => string | undefined;
export {};
14 changes: 14 additions & 0 deletions packages/utils/types/calc.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { AssetList } from '@chain-registry/types';
import { Denom } from './assets';
export interface CoinGeckoUSDPrice {
usd: number;
}
export interface DenomPriceMap {
[key: Denom]: number;
}
export declare const mapCoinGeckoPricesToDenoms: (assets: AssetList[], prices: Record<string, CoinGeckoUSDPrice>) => DenomPriceMap;
export declare const roundDown: (value: number | string) => string;
export declare const convertBaseUnitToDollarValue: (assets: AssetList[], prices: DenomPriceMap, symbol: string, amount: string | number, chainName?: string) => string;
export declare const convertDollarValueToBaseUnit: (assets: AssetList[], prices: DenomPriceMap, symbol: string, value: string | number, chainName?: string) => string;
export declare const convertBaseUnitToDisplayUnit: (assets: AssetList[], symbol: string, amount: string | number, chainName?: string) => string;
export declare const convertDisplayUnitToBaseUnit: (assets: AssetList[], symbol: string, amount: string | number, chainName?: string) => string;
17 changes: 17 additions & 0 deletions packages/utils/types/chains.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Chain } from '@chain-registry/types';
export declare const getGasPriceRangesFromChain: (chain: Chain) => {
low: number;
average: number;
high: number;
};
export declare const getChainByChainName: (chains: Chain[], chainName: string) => Chain | undefined;
export declare const getChainByChainId: (chains: Chain[], chainId: string) => Chain | undefined;
export declare const getChainNameByChainId: (chains: Chain[], chainId: string) => string | undefined;
export declare const getChainIdByChainName: (chains: Chain[], chainName: string) => string | undefined;
export declare const getChainGasPriceRanges: (chains: Chain[], chainName: string) => {
low: number;
average: number;
high: number;
} | undefined;
export declare const getChainPrettyName: (chains: Chain[], chainName: string) => string | undefined;
export declare const getChainBech32Prefix: (chains: Chain[], chainName: string) => string | undefined;
6 changes: 0 additions & 6 deletions packages/utils/types/fees.d.ts

This file was deleted.

17 changes: 10 additions & 7 deletions packages/utils/types/utils.d.ts → packages/utils/types/ibc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export declare const getTransferChannel: (info: IBCInfo) => {
};
ordering: string;
version: string;
tags?: object;
};
tags?: object | undefined;
} | undefined;
export declare const getNonTransferChannel: (info: IBCInfo) => {
chain_1: {
channel_id: string;
Expand All @@ -28,8 +28,8 @@ export declare const getNonTransferChannel: (info: IBCInfo) => {
};
ordering: string;
version: string;
tags?: object;
};
tags?: object | undefined;
} | undefined;
export declare const getWasmChannel: (info: IBCInfo) => {
chain_1: {
channel_id: string;
Expand All @@ -41,8 +41,8 @@ export declare const getWasmChannel: (info: IBCInfo) => {
};
ordering: string;
version: string;
tags?: object;
};
tags?: object | undefined;
} | undefined;
export declare const getIbcAssetPath: (ibc: IBCInfo[], chain: string, counterparty: string, assets: AssetList[], base: string) => any;
export declare const getIbcDenomByBase: (ibc: IBCInfo[], chain: string, counterparty: string, assets: AssetList[], base: string) => string;
export declare const getIbcAssets: (chainName: string, ibc: IBCInfo[], assets: AssetList[]) => {
Expand All @@ -53,4 +53,7 @@ export declare const getCw20Assets: (chainName: string, ibc: IBCInfo[], assets:
chain_name: string;
assets: any;
}[];
export declare const getAssetLists: (chainName: string, ibc: IBCInfo[], assets: AssetList[]) => any[];
export declare const getAssetLists: (chainName: string, ibc: IBCInfo[], assets: AssetList[]) => {
chain_name: string;
assets: any;
};
7 changes: 4 additions & 3 deletions packages/utils/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './asset-list-util';
export * from './fees';
export * from './utils';
export * from './ibc';
export * from './calc';
export * from './chains';
export * from './assets';
45 changes: 0 additions & 45 deletions packages/utils/types/registry.d.ts

This file was deleted.

0 comments on commit 0537055

Please sign in to comment.