Collection of SDK(s) crafted to ease Hydration chain integration. This monorepo contains everything you need to build on Hydration — from low-level pool math to high-level trading SDKs and cross-chain transfer tooling.
- Overview
- Getting Started
- General — common, descriptors, sdk, sdk-next
- XC (Cross-Chain) — xc, xc-core, xc-cfg, xc-sdk, xc-scan
- XCM (Cross-Chain Legacy) — xcm-core, xcm-cfg, xcm-sdk
- Math — WASM pool math modules
- Examples
- Contributing
┌────────────────────────────────────────────────────────────┐
│ Your dApp │
├────────────────────────────────┬───────────────────────────┤
│ « sdk / sdk-next » │ « xc / xcm-sdk » │
│ ·················· │ ················ │
│ Trade routing │ Cross-chain │
│ Pool queries │ Transfers │
│ │ │ │
│ ┌────┴──────┐ │ │
│ │ math-* │ │ │
│ │ Pool math │ │ │
│ │ (WASM) │ │ │
│ └───────────┘ │ │
├───────────────────┬────────────┴───────────────────────────┤
│ « common » │ « descriptors » │
│ ··········· │ ················ │
│ Shared utils │ Chain metadata │
├───────────────────┴────────────────────────────────────────┤
│ polkadot-api / @polkadot/api │
│ Substrate SDKs │
└────────────────────────────────────────────────────────────┘
Two generations of packages coexist:
| Trading SDK | Cross-Chain SDK | Chain API | |
|---|---|---|---|
| Current (stable) | @galacticcouncil/sdk |
@galacticcouncil/xcm-sdk |
@polkadot/api |
| Next-gen | @galacticcouncil/sdk-next |
@galacticcouncil/xc-sdk |
polkadot-api (papi) |
The next-gen packages (sdk-next, xc-*) are built on the modern Polkadot API (papi) and are the recommended path for new integrations.
- Node.js 23+
- npm 10+
Pick the packages you need:
# Next-gen trading SDK (recommended for new projects)
npm i @galacticcouncil/sdk-next
# Next-gen cross-chain transfers
npm i @galacticcouncil/xc
# Stable trading SDK (Polkadot.js based)
npm i @galacticcouncil/sdk
# Stable cross-chain transfers (Polkadot.js based)
npm i @galacticcouncil/xcm-sdk @galacticcouncil/xcm-cfgCore packages providing shared utilities, chain metadata, and trading functionality.
| Package | Version | Changelog | Description |
|---|---|---|---|
@galacticcouncil/common |
changelog | Shared utilities (helpers, evm, xcm) | |
@galacticcouncil/descriptors |
changelog | Hydration papi type-safe metadata descriptors | |
@galacticcouncil/sdk |
changelog | Trade router & pool utilities (@polkadot/api) |
|
@galacticcouncil/sdk-next |
changelog | Next-gen trade router & pool utilities (polkadot-api) |
Next-generation cross-chain transfer toolkit built on polkadot-api. Modular architecture with clean separation between core types, configuration, and wallet interface.
| Package | Version | Changelog | Description |
|---|---|---|---|
@galacticcouncil/xc |
changelog | High-level context factory (batteries-included) | |
@galacticcouncil/xc-core |
changelog | Core types, asset & chain definitions | |
@galacticcouncil/xc-cfg |
changelog | Pre-built route configs & DEX integrations | |
@galacticcouncil/xc-sdk |
changelog | Wallet interface for multi-platform transfers | |
@galacticcouncil/xc-scan |
changelog | Cross-chain transaction scanning |
@galacticcouncil/xc ← Start here (context factory, DEX factory)
├── @galacticcouncil/xc-sdk ← Wallet, transfers, fee swaps
├── @galacticcouncil/xc-cfg ← Route configs, DEX implementations
└── @galacticcouncil/xc-core ← Core types, chain & asset definitions
Stable cross-chain transfer toolkit built on @polkadot/api. Production-proven with extensive route coverage.
| Package | Version | Changelog | Description |
|---|---|---|---|
@galacticcouncil/xcm-core |
changelog | Core types, chain & asset definitions | |
@galacticcouncil/xcm-cfg |
changelog | Pre-built route configs & DEX integrations | |
@galacticcouncil/xcm-sdk |
changelog | Wallet interface for cross-chain transfers |
@galacticcouncil/xcm-sdk ← Wallet, transfers, fee swaps
@galacticcouncil/xcm-cfg ← Route configs, DEX implementations
@galacticcouncil/xcm-core ← Core types, chain & asset definitions
WebAssembly math modules compiled from Rust. Each module provides high-performance, deterministic calculations for a specific Hydration pool type. These are standalone packages with zero JS dependencies.
| Package | Version | Changelog | Pool Type |
|---|---|---|---|
@galacticcouncil/math-omnipool |
changelog | Omnipool — single-sided unified liquidity | |
@galacticcouncil/math-stableswap |
changelog | Stableswap — low-slippage stable asset trading | |
@galacticcouncil/math-xyk |
changelog | XYK — constant product AMM | |
@galacticcouncil/math-lbp |
changelog | LBP — liquidity bootstrapping pool | |
@galacticcouncil/math-hsm |
changelog | HSM — isolated multi-pool | |
@galacticcouncil/math-ema |
changelog | EMA — exponential moving average oracle | |
@galacticcouncil/math-staking |
changelog | Staking reward calculations | |
@galacticcouncil/math-liquidity-mining |
changelog | Liquidity mining reward calculations |
Note: You typically don't need to install math packages directly — they are dependencies of
sdkandsdk-next.
Ready-to-run examples are available in the examples/ directory:
| Example | Description |
|---|---|
sdk-cjs |
SDK usage with CommonJS |
sdk-esm |
SDK usage with ES Modules |
sdk-next-cjs |
SDK-Next usage with CommonJS |
sdk-next-esm |
SDK-Next usage with ES Modules |
xc-transfer |
XC cross-chain transfer |
xcm-transfer |
XCM cross-chain transfer |
Everything about building, setting up development environment & releasing can be found in CONTRIBUTING.md.
In case of unexpected SDK behaviour, please create a well-written issue here. It makes it easier to find & fix the problem accordingly.
This file is part of https://github.com/galacticcouncil/*
$$$$$$$ Licensed under the Apache License, Version 2.0 (the "License")
$$$$$$$$$$$$$ you may only use this file in compliance with the License
$$$$$$$$$$$$$$$$$$$
$$$$$$$$$ Copyright (C) 2021-2024 Intergalactic, Limited (GIB)
$$$$$$$$$$$ $$$$$$$$$$ SPDX-License-Identifier: Apache-2.0
$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$ $ Built with <3 for decentralisation
$$$$$$$$$$$$$$$$$$$ $$$$$$$
$$$$$$$ $$$$$$$$$$$$$$$$$$ Unless required by applicable law or agreed to in
$ $$$$$$$$$$$$$$$$$$$$$$$ writing, software distributed under the License is
$$$$$$$$$$$$$$$$$$$$$$$$$$ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
$$$$$$$$$ $$$$$$$$$$$ OR CONDITIONS OF ANY KIND, either express or implied.
$$$$$$$$
$$$$$$$$$$$$$$$$$$ See the License for the specific language governing
$$$$$$$$$$$$$ permissions and limitations under the License.
$$$$$$$
$$
$$$$$ $$$$$ $$ $$
$$$ $$$ $$$ $$ $$$$$ $$ $$$ $$$$ $$$$$$$ $$$$ $$$ $$$$$$ $$ $$$$$$
$$$ $$$ $$$ $$ $$$ $$$ $$$ $ $$ $$ $$ $$ $$ $$$ $$$ $$$
$$$$$$$$$$$ $$ $$ $$$ $$ $$ $$$$$$$ $$ $$ $$ $$$ $$ $$
$$$ $$$ $$$$ $$$ $$ $$ $$$ $$ $$ $$ $$$ $$ $$ $$
$$$$$ $$$$$ $$ $$$ $$$ $$ $$$$ $$$ $$ $$ $$$ $$ $$ $$$
$$ $$$$$ $$$$$ $$ $$$$
$$$
For more details read LICENSE.md