20+ Blockchains
Support for EVM chains, Bitcoin, Cosmos ecosystem, Solana, Ripple (XRP), and more - all through one consistent interface.
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 Chain
Chain, 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 Chain
Chain.function (enum member) Chain.Ethereum = "ETH"
Ethereum, enum Chain
Chain.function (enum member) Chain.Bitcoin = "BTC"
Bitcoin, enum Chain
Chain.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 Chain
Chain.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 Chain
Chain.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 Chain
Chain.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: string
sellAsset: 'ETH.ETH',
sellAmount: string
sellAmount: '1000000000000000000', // 1 ETH in wei
buyAsset: string
buyAsset: 'BTC.BTC',
sourceAddress?: string | undefined
sourceAddress: const swapKit: {
chainflip: {
supportedSwapkitProviders: ProviderName[];
} & {
swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
};
... 5 more ...;
near: {
...;
} & {
...;
};
} & {
...;
} & {
...;
}
swapKit.getAddress: <Chain.Ethereum>(chain: Chain.Ethereum) => string
getAddress(enum Chain
Chain.function (enum member) Chain.Ethereum = "ETH"
Ethereum),
destinationAddress?: string | undefined
destinationAddress: const swapKit: {
chainflip: {
supportedSwapkitProviders: ProviderName[];
} & {
swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
};
... 5 more ...;
near: {
...;
} & {
...;
};
} & {
...;
} & {
...;
}
swapKit.getAddress: <Chain.Bitcoin>(chain: Chain.Bitcoin) => string
getAddress(enum Chain
Chain.function (enum member) Chain.Bitcoin = "BTC"
Bitcoin),
slippage?: number | undefined
slippage: 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: any
txHash = 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.
bun add @swapkit/sdk
pnpm add @swapkit/sdk
npm install @swapkit/sdk
yarn 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 | undefined
config: {
// Optional: Add SwapKit API key for enhanced features
apiKeys?: Partial<{
blockchair: string;
keepKey: string;
swapKit: string;
walletConnectProjectId: string;
}> | undefined
apiKeys: {
swapKit?: string | undefined
swapKit: '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 Chain
Chain, class AssetValue
AssetValue, enum FeeOption
FeeOption } 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 Chain
Chain.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 Chain
Chain.function (enum member) Chain.Ethereum = "ETH"
Ethereum);
// Transfer ETH
const const assetValue: AssetValue
assetValue = class AssetValue
AssetValue.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: string
value: '0.1'
});
const const txHash: any
txHash = await const swapKit: {
chainflip: {
supportedSwapkitProviders: ProviderName[];
} & {
swap: (swapParams: RequestSwapDepositAddressParams) => Promise<...>;
};
... 5 more ...;
near: {
...;
} & {
...;
};
} & {
...;
} & {
...;
}
swapKit.transfer: ({ assetValue, ...params }: GenericTransferParams | EVMTransferParams) => Promise<any>
transfer({
assetValue: AssetValue
assetValue,
recipient: string
recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f6E321',
feeOptionKey?: FeeOption | undefined
feeOptionKey: enum FeeOption
FeeOption.function (enum member) FeeOption.Fast = "fast"
Fast
});
Discord
Join our Discord server for support and discussions with the community.
GitHub
Contribute to SwapKit development or report issues on GitHub.