Skip to content

galacticcouncil/sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,290 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Galactic SDK

Build SDK License

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.

Table of Contents

Overview

┌────────────────────────────────────────────────────────────┐
│                         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.

Getting Started

Prerequisites

  • Node.js 23+
  • npm 10+

Installation

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-cfg

General

Core packages providing shared utilities, chain metadata, and trading functionality.

Package Version Changelog Description
@galacticcouncil/common common_v changelog Shared utilities (helpers, evm, xcm)
@galacticcouncil/descriptors descriptors_v changelog Hydration papi type-safe metadata descriptors
@galacticcouncil/sdk sdk_v changelog Trade router & pool utilities (@polkadot/api)
@galacticcouncil/sdk-next sdk-next_v changelog Next-gen trade router & pool utilities (polkadot-api)

XC (Cross-Chain)

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 xc_v changelog High-level context factory (batteries-included)
@galacticcouncil/xc-core xc-core_v changelog Core types, asset & chain definitions
@galacticcouncil/xc-cfg xc-cfg_v changelog Pre-built route configs & DEX integrations
@galacticcouncil/xc-sdk xc-sdk_v changelog Wallet interface for multi-platform transfers
@galacticcouncil/xc-scan xc-scan_v changelog Cross-chain transaction scanning

Architecture

@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

XCM (Cross-Chain Legacy)

Stable cross-chain transfer toolkit built on @polkadot/api. Production-proven with extensive route coverage.

Package Version Changelog Description
@galacticcouncil/xcm-core xcm-core_v changelog Core types, chain & asset definitions
@galacticcouncil/xcm-cfg xcm-cfg_v changelog Pre-built route configs & DEX integrations
@galacticcouncil/xcm-sdk xcm-sdk_v changelog Wallet interface for cross-chain transfers

Architecture

@galacticcouncil/xcm-sdk  ← Wallet, transfers, fee swaps
@galacticcouncil/xcm-cfg  ← Route configs, DEX implementations
@galacticcouncil/xcm-core ← Core types, chain & asset definitions

Math

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 math-omni_v changelog Omnipool — single-sided unified liquidity
@galacticcouncil/math-stableswap math-stable_v changelog Stableswap — low-slippage stable asset trading
@galacticcouncil/math-xyk math-xyk_v changelog XYK — constant product AMM
@galacticcouncil/math-lbp math-lbp_v changelog LBP — liquidity bootstrapping pool
@galacticcouncil/math-hsm math-hsm_v changelog HSM — isolated multi-pool
@galacticcouncil/math-ema math-ema_v changelog EMA — exponential moving average oracle
@galacticcouncil/math-staking math-stake_v changelog Staking reward calculations
@galacticcouncil/math-liquidity-mining math-lm_v changelog Liquidity mining reward calculations

Note: You typically don't need to install math packages directly — they are dependencies of sdk and sdk-next.

Examples

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

Contributing

Everything about building, setting up development environment & releasing can be found in CONTRIBUTING.md.

Issue Reporting

In case of unexpected SDK behaviour, please create a well-written issue here. It makes it easier to find & fix the problem accordingly.

Legal

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

About

Galactic SDK

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 16