Skip to main content

Info Methods

Info methods return metadata — supported blockchains, providers, and service health.

getChains

Returns a list of all blockchains supported by Rubic.
const chains = await sdk.getChains(includeTestnets?: boolean): Promise<ChainInterface[]>
ParameterTypeDefaultDescription
includeTestnetsbooleanfalseInclude testnet blockchains in the response

Example

const chains = await sdk.getChains();

chains.forEach(chain => {
    console.log(chain.name, chain.type, chain.id);
});
// → 'ETH'     'evm'     1
// → 'BSC'     'evm'     56
// → 'SOLANA'  'solana'  null
// → ...

ChainInterface

FieldTypeDescription
nameBlockchainNameBlockchain identifier used in all SDK requests
typestringChain type: 'evm', 'solana', 'tron', 'ton', 'bitcoin', etc.
idnumber | nullChain ID (EVM only; null for non-EVM chains)
proxyAvailablebooleanWhether fee collection via Rubic proxy contracts is available
testnetbooleanWhether this is a testnet

Example — get EVM chains only

const chains = await sdk.getChains();
const evmChains = chains.filter(c => c.type === 'evm' && !c.testnet);
console.log('EVM mainnet chains:', evmChains.map(c => c.name));

Example — with testnets

const allChains = await sdk.getChains(true);
const testnets = allChains.filter(c => c.testnet);
console.log('Testnets:', testnets.map(c => c.name));

getProviders

Returns all available swap providers grouped by type.
const providers = await sdk.getProviders(includeTestnets?: boolean): Promise<ProvidersInterface>
ParameterTypeDefaultDescription
includeTestnetsbooleanfalseInclude providers that only support testnets

Example

const providers = await sdk.getProviders();

// Cross-chain providers (bridges, aggregators)
providers.crossChain.forEach(p => {
    console.log(p.name, '→ supports', p.chains.length, 'chains');
});

// On-chain providers (DEXes)
providers.onChain.forEach(p => {
    console.log(p.name, '→ supports', p.chains.length, 'chains');
});

ProvidersInterface

FieldTypeDescription
crossChainCrossChainProviderInterface[]Bridge and aggregator providers
onChainOnChainProviderInterface[]DEX providers
Each provider has:
FieldTypeDescription
namestringProvider identifier (e.g. 'across', 'uniswap-v3')
chainsProviderChainInterface[]Blockchains this provider supports

Example — check if a provider supports a chain pair

const providers = await sdk.getProviders();

const across = providers.crossChain.find(p => p.name === 'across');
const supportsEth = across?.chains.some(c => c.from === 'ETH' && c.to === 'ARBITRUM');
console.log('Across supports ETH→ARB:', supportsEth);

healthcheck

Checks whether the Rubic API is up and responsive.
const result = await sdk.healthcheck(): Promise<string>
Returns 'I am alive' when the service is healthy.
const health = await sdk.healthcheck();
// → 'I am alive'