Skip to content
SwapKit is a powerful suite of tools for building blockchain applications.
SwapKit logo SwapKit logo

SwapKit

Cross-chain swaps made easy

SwapKit provides everything you need to integrate blockchain functionality into your application with a single, unified API.

20+ Blockchains

Support for EVM chains, Bitcoin, Cosmos ecosystem, Solana, Ripple (XRP), and more - all through one consistent interface.

Multi-Wallet Support

Connect with 20+ wallets including MetaMask, WalletConnect, Ledger, Keystore, and hardware wallets.

DeFi Protocols

Built-in integrations with THORChain, Chainflip, 1inch, and other leading DeFi protocols.

Type-Safe & Modern

Built with TypeScript for complete type safety and excellent developer experience.

import { 
function createSwapKit(config?: Parameters<typeof SwapKit>[0]): {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
createSwapKit
, enum ChainChain,
const SwapKitApi: {
    mayachainMidgard: {
        getLiquidityPositionRaw: (address: string) => Promise<MemberDetailsMayachain>;
        getNameDetails: (name: string) => Promise<THORNameDetails>;
        getNamesByAddress: (address: string) => Promise<...>;
        getNamesByOwner: (address: string) => Promise<...>;
        getLiquidityPosition: (address: string) => Promise<...>;
    };
    ... 14 more ...;
    getChainflipDepositChannel(body: BrokerDepositChannelParams): Promise<...>;
}
SwapKitApi
} from '@swapkit/sdk';
// Initialize SwapKit const
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
=
function createSwapKit(config?: Parameters<typeof SwapKit>[0]): {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
createSwapKit
();
// Connect a keystore wallet (supports 20+ chains) await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.
connectKeystore: (chains: Chain[], phrase: string, derivationPathMapOrIndex?: number | {
    ARB?: DerivationPathArray | undefined;
    AVAX?: DerivationPathArray | undefined;
    ... 21 more ...;
    TRX?: DerivationPathArray | undefined;
} | undefined) => Promise<boolean>
connectKeystore
([enum ChainChain.function (enum member) Chain.Ethereum = "ETH"Ethereum, enum ChainChain.function (enum member) Chain.Bitcoin = "BTC"Bitcoin, enum ChainChain.function (enum member) Chain.Ripple = "XRP"Ripple], 'your mnemonic phrase');
// Get wallet balances const const ethBalance: AssetValue[]ethBalance = await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.getBalance: <Chain.Ethereum, boolean>(chain: Chain.Ethereum, refresh?: boolean | undefined) => AssetValue[] | Promise<AssetValue[]>getBalance(enum ChainChain.function (enum member) Chain.Ethereum = "ETH"Ethereum);
const const btcBalance: AssetValue[]btcBalance = await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.getBalance: <Chain.Bitcoin, boolean>(chain: Chain.Bitcoin, refresh?: boolean | undefined) => AssetValue[] | Promise<AssetValue[]>getBalance(enum ChainChain.function (enum member) Chain.Bitcoin = "BTC"Bitcoin);
const const xrpBalance: AssetValue[]xrpBalance = await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.getBalance: <Chain.Ripple, boolean>(chain: Chain.Ripple, refresh?: boolean | undefined) => AssetValue[] | Promise<AssetValue[]>getBalance(enum ChainChain.function (enum member) Chain.Ripple = "XRP"Ripple);
// Get a swap quote const {
const routes: {
    providers: ProviderName[];
    sellAsset: string;
    sellAmount: string;
    buyAsset: string;
    expectedBuyAmount: string;
    expectedBuyAmountMaxSlippage: string;
    sourceAddress: string;
    ... 12 more ...;
    estimatedTime?: {
        ...;
    } | undefined;
}[]
routes
} = await
const SwapKitApi: {
    mayachainMidgard: {
        getLiquidityPositionRaw: (address: string) => Promise<MemberDetailsMayachain>;
        getNameDetails: (name: string) => Promise<THORNameDetails>;
        getNamesByAddress: (address: string) => Promise<...>;
        getNamesByOwner: (address: string) => Promise<...>;
        getLiquidityPosition: (address: string) => Promise<...>;
    };
    ... 14 more ...;
    getChainflipDepositChannel(body: BrokerDepositChannelParams): Promise<...>;
}
SwapKitApi
.
function getSwapQuote(json: QuoteRequest): Promise<{
    quoteId: string;
    routes: {
        providers: ProviderName[];
        sellAsset: string;
        sellAmount: string;
        buyAsset: string;
        expectedBuyAmount: string;
        ... 14 more ...;
        estimatedTime?: {
            ...;
        } | undefined;
    }[];
    error?: string | undefined;
    providerErrors?: {
        ...;
    }[] | undefined;
}>
getSwapQuote
({
sellAsset: stringsellAsset: 'ETH.ETH', sellAmount: stringsellAmount: '1000000000000000000', // 1 ETH in wei buyAsset: stringbuyAsset: 'BTC.BTC', sourceAddress?: string | undefinedsourceAddress:
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.getAddress: <Chain.Ethereum>(chain: Chain.Ethereum) => stringgetAddress(enum ChainChain.function (enum member) Chain.Ethereum = "ETH"Ethereum),
destinationAddress?: string | undefineddestinationAddress:
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.getAddress: <Chain.Bitcoin>(chain: Chain.Bitcoin) => stringgetAddress(enum ChainChain.function (enum member) Chain.Bitcoin = "BTC"Bitcoin),
slippage?: number | undefinedslippage: 3 }); // Execute the swap if (
const routes: {
    providers: ProviderName[];
    sellAsset: string;
    sellAmount: string;
    buyAsset: string;
    expectedBuyAmount: string;
    expectedBuyAmountMaxSlippage: string;
    sourceAddress: string;
    ... 12 more ...;
    estimatedTime?: {
        ...;
    } | undefined;
}[]
routes
.Array<T>.length: number
Gets or sets the length of the array. This is a number one higher than the highest index in the array.
length
> 0) {
const const txHash: anytxHash = await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.
swap: <"chainflip" | "evm" | "mayachain" | "thorchain" | "radix" | "solana" | "near">({ route, pluginName, ...rest }: SwapParams<"chainflip" | "evm" | "mayachain" | "thorchain" | "radix" | "solana" | "near", {
    providers: ProviderName[];
    ... 18 more ...;
    estimatedTime?: {
        ...;
    } | undefined;
}>) => any
swap
({
route: {
    providers: ProviderName[];
    sellAsset: string;
    sellAmount: string;
    buyAsset: string;
    expectedBuyAmount: string;
    expectedBuyAmountMaxSlippage: string;
    sourceAddress: string;
    ... 12 more ...;
    estimatedTime?: {
        ...;
    } | undefined;
}
route
:
const routes: {
    providers: ProviderName[];
    sellAsset: string;
    sellAmount: string;
    buyAsset: string;
    expectedBuyAmount: string;
    expectedBuyAmountMaxSlippage: string;
    sourceAddress: string;
    ... 12 more ...;
    estimatedTime?: {
        ...;
    } | undefined;
}[]
routes
[0] });
}

Unified API

One consistent API for all chains and protocols. No need to learn different interfaces for each blockchain.

Production Ready

Battle-tested in production by THORSwap and other leading DeFi applications.

Modular Design

Use only what you need - from lightweight toolboxes to the full SDK.

Active Development

Regular updates, new chain integrations, and responsive community support.

  • 🔗 Cross-Chain Swaps: Seamlessly swap assets across different blockchains
  • 💰 Multi-Chain Wallets: Manage wallets and balances across all supported chains
  • 🔐 Hardware Wallet Support: Full support for Ledger, Trezor, and KeepKey
  • 📊 Real-Time Quotes: Get accurate swap quotes from multiple DEX aggregators
  • 🛠️ Toolbox System: Low-level utilities for direct blockchain interactions
  • 🔌 Plugin Architecture: Extend functionality with custom plugins
  • 📱 Mobile Ready: Works in React Native and mobile environments
  • ⚡ Optimized Performance: Efficient caching and request batching
bun add @swapkit/sdk
import { 
function createSwapKit(config?: Parameters<typeof SwapKit>[0]): {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
createSwapKit
} from '@swapkit/sdk';
const
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
=
function createSwapKit(config?: Parameters<typeof SwapKit>[0]): {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
createSwapKit
({
config?: SKConfigState | undefinedconfig: { // Optional: Add SwapKit API key for enhanced features
apiKeys?: Partial<{
    blockchair: string;
    keepKey: string;
    swapKit: string;
    walletConnectProjectId: string;
}> | undefined
apiKeys
: {
swapKit?: string | undefinedswapKit: 'your-swapkit-api-key', // Get from https://api.swapkit.dev } } });
import { 
function createSwapKit(config?: Parameters<typeof SwapKit>[0]): {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
createSwapKit
, enum ChainChain, class AssetValueAssetValue, enum FeeOptionFeeOption } from '@swapkit/sdk';
// Initialize SwapKit const
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
=
function createSwapKit(config?: Parameters<typeof SwapKit>[0]): {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
createSwapKit
();
// Connect EVM wallet (MetaMask) await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.connectEVMWallet: (chains: Chain[], walletType?: EVMWalletOptions | undefined, eip1193Provider?: Eip1193Provider | undefined) => Promise<boolean>connectEVMWallet([enum ChainChain.function (enum member) Chain.Ethereum = "ETH"Ethereum]);
// Get wallet balance const const balance: AssetValue[]balance = await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.getBalance: <Chain.Ethereum, boolean>(chain: Chain.Ethereum, refresh?: boolean | undefined) => AssetValue[] | Promise<AssetValue[]>getBalance(enum ChainChain.function (enum member) Chain.Ethereum = "ETH"Ethereum);
// Transfer ETH const const assetValue: AssetValueassetValue = class AssetValueAssetValue.
AssetValue.from<{
    asset: "ETH.ETH";
    value: string;
}>({ value, fromBaseDecimal, asyncTokenLookup, ...fromAssetOrChain }: {
    asset: "ETH.ETH";
    value: string;
} & AssetValueFromParams): AssetValue
from
({
asset: "ETH.ETH"asset: 'ETH.ETH', value: stringvalue: '0.1' }); const const txHash: anytxHash = await
const swapKit: {
    chainflip: {
        supportedSwapkitProviders: ProviderName[];
    } & {
        swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
    };
    ... 5 more ...;
    near: {
        ...;
    } & {
        ...;
    };
} & {
    ...;
} & {
    ...;
}
swapKit
.transfer: ({ assetValue, ...params }: GenericTransferParams | EVMTransferParams) => Promise<any>transfer({
assetValue: AssetValueassetValue, recipient: stringrecipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f6E321', feeOptionKey?: FeeOption | undefinedfeeOptionKey: enum FeeOptionFeeOption.function (enum member) FeeOption.Fast = "fast"Fast });

Discord

Join our Discord server for support and discussions with the community.

Join Discord →