List Available Contracts

Before you can get a quote for a staking, you'll need to choose the contract you want to stake into. The Swing SDK provides a few utility methods to a list of all available contracts. You'll need the to get a list of quotes and make a deposit.

import SwingSDK from '';
const sdk = new SwingSDK({
  // Your Swing Platform project identifier
  projectId: 'swing-project-id',
// Initialize the SDK with configuration data
await sdk.init();
// All available contracts are available
const contracts = sdk.contracts;
// Get a single contract by ID
const contract: Contract[] = sdk.getContract({ id: 'contract-id' });

Contract Interface

Below you will find the interface returned by the Swing SDK when interacting with contracts.

interface Contract {
  id: string; // Unique Swing Identifier
  type: 'deposit' | 'withdraw';
  address: string; // Deployed contract address
  method: string; // Contract method (eg. deposit, withdraw)
  chain: string;
  inputToken: Token; // Token you send to the contract
  outputToken: Token | null; // Token you receive from the contract
  // Swing's integration provider
  integration: {
    type: 'staking';
    slug: string;
    name: string;
    logo: string;
    monetization: boolean;

Get all chains with a staking contract

To get a list of staking contracts, you'll need to provide your starting chain as the fromChainSlug.

const stakingChains = sdk.getAvailableStakingChains({
  fromChainSlug: 'ethereum',

Get all available staking tokens for a chain

To get a list of staking tokens, you'll need to provide the destination chain as the chainSlug.

const stakingTokens = sdk.getAvailableStakingTokens({
  chainSlug: 'ethereum',

Get all available contracts for a chain

It might be useful to display a list of all available contracts for a chain. You can do this by providing the chainSlug to the getContractsForChain method.

const contracts = sdk.getContractsForChain({
  chainSlug: 'ethereum',

Get all available contracts for a chain + token

If you already know what token the user wants to deposit, you can quickly get a list of all contracts with a matching input token.

const contracts = sdk.getContractsForChainToken({
  chainSlug: 'ethereum',
  tokenSymbol: 'ETH',