@liqpro/liq-core
v0.38.1
Published
SDK foundation — types, enums, EIP-712 helpers, chain config, and contract addresses for the Liq perpetuals exchange.
Readme
@liq/core
SDK foundation — types, enums, EIP-712 helpers, chain config, and contract addresses for the Liq perpetuals exchange.
Overview
@liq/core is the zero-framework base layer shared by all Liq SDK packages. It provides the canonical EIP-712 domain and order type definitions, chain configuration with contract addresses for each supported network, shared TypeScript types and enums for orders/positions/accounts, and the branded numeric primitives (Price, Qty, Usd, Margin) used throughout the system. The only runtime dependency is zod.
Key Exports
Chain config
getChainConfig(chainId)— returnsChainConfig(contracts, rpcUrl, subgraphUrl) for a given chain IDgetContractAddress(chainId, contract)— shortcut to a single contract addressChainConfig— interface withPerpsMarketProxy,SynthetixCoreProxy,PerpsAccountProxy,SpotMarketProxy,TrustedMulticallForwarder,USDC,sUSDC
Supported chains: MegaETH Testnet (chainId 6343)
EIP-712
EIP712_ORDER_TYPES— typed data schema for order signingEIP712_DOMAIN_NAME/EIP712_DOMAIN_VERSION—"PerpExchange"/"1"buildEip712Domain(chainId, verifyingContract)— constructs the EIP-712 domain objectbuildLimitOrderMessage(params)— builds a signed limit order payloadbuildMarketOrderMessage(params)— builds a signed market order payloadbuildConditionalOrderMessage(params)— builds a signed TP/SL/stop order payloadORDER_TYPE_INDEX— numeric index mapping forOrderTypeenum values
Types (src/types/)
OrderTypeenum —MARKET,LIMIT,STOP_MARKET,STOP_LIMIT,TAKE_PROFIT_MARKET,TAKE_PROFIT_LIMIT- Order, position, account, fill, market, and API types shared across SDK packages
Branded primitives (src/primitives.ts)
Price,Qty,Usd,Margin,Bps— brandedbiginttypes (18 decimals)- Each brand: constructor,
.parse(str),.fmt(val),.zodschema,.mul()arithmetic
Install
pnpm add @liq/coreBuild
moon run liq-core:build # tsup → dist/