Skip to content

Latest commit

Β 

History

2,722 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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.

Note: The previous @polkadot/api-based toolkit (sdk, xcm-core, xcm-cfg, xcm-sdk) has been moved to galacticcouncil/sdk-legacy.

Table of Contents

Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         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).

Getting Started

Prerequisites

  • Node.js 25+
  • npm 11+

Installation

Pick the packages you need:

# Trading SDK
npm i @galacticcouncil/sdk-next

# Cross-chain transfers
npm i @galacticcouncil/xc

Quick Start

Solo Trading (sdk-next)

import { 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);

Full docs & API reference β†’

Solo Cross-Chain (xc)

import { createXcContext } from '@galacticcouncil/xc';

const xc = await createXcContext();

Full docs & API reference β†’

Combo (sdk-next + xc)

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);

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-next sdk-next_v changelog Trade router & pool utilities (polkadot-api)

XC (Cross-Chain)

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

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-next.

Examples

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

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

Contributing

Stars

27 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages