UNPKG

@pharosnames/address-encoder

Version:

Encodes and decodes address formats for various cryptocurrencies with Pharos network support

13 lines 1.26 kB
type Add<T, U> = T extends number ? U extends number ? number : never : never; type GtOrEq<T, U> = T extends U ? 1 : 0; type Lt<T, U> = T extends U ? 0 : 1; type Subtract<T, U> = T extends number ? U extends number ? number : never : never; import type { EvmChainId, EvmCoinType } from "../types.js"; export declare const SLIP44_MSB = 2147483648; export declare const isEvmCoinType: <TCoinType extends EvmCoinType | number = EvmCoinType | number>(coinType: TCoinType) => GtOrEq<TCoinType, typeof SLIP44_MSB> extends 1 ? true : false; type EvmChainIdToCoinType<TChainId extends EvmChainId | number = EvmChainId | number> = Lt<TChainId, typeof SLIP44_MSB> extends 1 ? Add<TChainId, typeof SLIP44_MSB> : never; export declare const evmChainIdToCoinType: <TChainId extends EvmChainId | number = EvmChainId | number>(chainId: TChainId) => EvmChainIdToCoinType<TChainId>; type CoinTypeToEvmChainId<TCoinType extends EvmCoinType | number = EvmCoinType | number> = Lt<TCoinType, typeof SLIP44_MSB> extends 1 ? never : Subtract<TCoinType, typeof SLIP44_MSB>; export declare const coinTypeToEvmChainId: <TCoinType extends EvmCoinType | number = EvmCoinType | number>(coinType: TCoinType) => CoinTypeToEvmChainId<TCoinType>; export {}; //# sourceMappingURL=evm.d.ts.map