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.
Note: The previous @polkadot/api-based toolkit (sdk, xcm-core, xcm-cfg, xcm-sdk) has been moved to galacticcouncil/sdk-legacy.
- Overview
- Getting Started
- Quick Start β factories for sdk-next & xc
- General β common, descriptors, sdk-next
- XC (Cross-Chain) β xc, xc-core, xc-cfg, xc-sdk, xc-scan
- Math β WASM pool math modules
- Examples
- Contributing
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your dApp β
ββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ€
β Β« sdk-next Β» β Β« xc Β» β
β Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· β Β·Β·Β·Β·Β·Β·Β· β
β Trade routing β Cross-chain β
β Pool queries β Transfers β
β β β β
β ββββββ΄βββββββ β β
β β math-* β β β
β β Pool math β β β
β β (WASM) β β β
β βββββββββββββ β β
βββββββββββββββββββββ¬βββββββββββββ΄ββββββββββββββββββββββββββββ€
β Β« common Β» β Β« descriptors Β» β
β Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· β Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· β
β Shared utils β Chain metadata β
βββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββ€
β polkadot-api β
β Substrate SDK β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
All packages are built on the modern Polkadot API (papi).
- Node.js 25+
- npm 11+
Pick the packages you need:
# Trading SDK
npm i @galacticcouncil/sdk-next
# Cross-chain transfers
npm i @galacticcouncil/xcimport { api, createSdkContext } from '@galacticcouncil/sdk-next';
import { createClient } from 'polkadot-api';
const provider = api.getWs('wss://hydradx-rpc.dwellir.com');
const client = createClient(provider);
const sdk = await createSdkContext(client);import { createXcContext } from '@galacticcouncil/xc';
const xc = await createXcContext();import { api, createSdkContext } from '@galacticcouncil/sdk-next';
import { createXcContext } from '@galacticcouncil/xc';
import { createClient } from 'polkadot-api';
const provider = api.getWs('wss://hydradx-rpc.dwellir.com');
const client = createClient(provider);
const sdk = await createSdkContext(client);
// Shared pool context
const xc = await createXcContext(sdk.ctx.pool);Core 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-next |
changelog | Trade router & pool utilities (polkadot-api) |
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
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
sdk-next.
Ready-to-run examples are available in the examples/ directory:
| Example | Description |
|---|---|
sdk-next-cjs |
SDK-Next usage with CommonJS |
sdk-next-esm |
SDK-Next usage with ES Modules |
xc-transfer |
XC 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