Skip to content
markpaper

src/index.ts

v0.3.0 · 2.5 KB

Download file
// @markpaper/hl-kit — practical add-on toolkit for Hyperliquid on top of @nktkas/hyperliquid.
//
// Flat named exports for the whole public API, plus one namespace per module
// (`format`, `assets`, `transport`, `errors`, `account`, `history`, `risk`, `ws`, `orders`).
//
// Name collisions between modules are resolved explicitly below (see README, "Renamed exports"):
//   - MarketKind, Numeric, CandleInterval, isSpotCoin: identical in several modules, exported once.
//   - parseUserFees (account)      -> parseUserFees      (returns UserFees; pairs with fetchUserFees)
//   - parseUserFees (risk)         -> parseUserFeeRates  (returns AccountFeeRates; pairs with readUserFees)
//   - PositionSide (history)       -> FillPositionSide   ('LONG' | 'SHORT')
//   - PositionSide (risk)          -> PositionSide       ('long' | 'short')
//   - normalizeAddress (account)   -> normalizeAddress   (throws HlAccountError)
//   - normalizeAddress (ws)        -> normalizeWsAddress (throws WsSubscriptionError)

// Shared contract.
export * from './transport/types.js';

// Namespaces.
export * as format from './format/index.js';
export * as assets from './assets/index.js';
export * as transport from './transport/index.js';
export * as errors from './errors/index.js';
export * as account from './account/index.js';
export * as history from './history/index.js';
export * as risk from './risk/index.js';
export * as ws from './ws/index.js';
export * as orders from './orders/index.js';

// Flat exports. `export *` re-exports everything that does not collide; colliding names are
// re-exported explicitly (an explicit export wins over the star exports in TypeScript and ESM).
export * from './format/index.js';
export * from './assets/index.js';
export * from './transport/index.js';
export * from './errors/index.js';
export * from './account/index.js';
export * from './history/index.js';
export * from './risk/index.js';
export * from './ws/index.js';
export * from './orders/index.js';

export type { MarketKind, Numeric } from './format/index.js';
export type { CandleInterval } from './history/index.js';
export { isSpotCoin } from './assets/index.js';

export { parseUserFees } from './account/index.js';
export { parseUserFees as parseUserFeeRates } from './risk/index.js';

export type { PositionSide as FillPositionSide } from './history/index.js';
export type { PositionSide } from './risk/index.js';

export { normalizeAddress } from './account/index.js';
export { normalizeAddress as normalizeWsAddress } from './ws/index.js';
All files