# JS SDK Types

{% hint style="warning" %}
Integrators and partners are expected to use the Symbiosis API for production integrations.
{% endhint %}

## Types

Symbiosis JS SDK defines the following types:

<table><thead><tr><th>Type</th><th width="398">Use</th></tr></thead><tbody><tr><td><strong>ChainId</strong></td><td>Lists identifiers of supported blockchains.</td></tr><tr><td><strong>ChainConfig</strong></td><td>Defines the network configuration for building cross-chain routes.</td></tr><tr><td><strong>OmniPoolConfig</strong></td><td>Defines an Octopool containing sTokens.<br>For more information on Octopools, see <a data-mention href="../../crosschain-liquidity-engine/symbiosis-octopools">symbiosis-octopools</a> </td></tr><tr><td><strong>AdvisorConfig and Config</strong></td><td>Defines details of the Microservice Advisor.<br>For more information on Advisor, see<a data-mention href="../../main-concepts/symbiosis-and-fees">symbiosis-and-fees</a></td></tr><tr><td><strong>TokenConstructor</strong></td><td>Specifies parameters for creating an instance of the <code>Token</code> class.</td></tr><tr><td><strong>PendingRequestState</strong> and <br><strong>PendingRequest</strong></td><td>Used for reverting stuck cross-chain operations.</td></tr></tbody></table>

### ChainId type

The `ChainId` type lists named constants that represent integer identifiers for supported blockchains.

Example:

```
export enum ChainId {
    ETH_MAINNET = 1,
    ETH_RINKEBY = 4,
    ETH_GOERLI = 5,
    ETH_KOVAN = 42,
    BSC_MAINNET = 56,
    BSC_TESTNET = 97,
    MATIC_MAINNET = 137,
    MATIC_MUMBAI = 80001,
    AVAX_MAINNET = 43114,
    AVAX_TESTNET = 43113,
    HECO_MAINNET = 128,
    HECO_TESTNET = 256,
    OKEX_MAINNET = 66,
    OKEX_TESTNET = 65,
    BOBA_MAINNET = 288,
    BOBA_BNB = 56288,
    BOBA_AVALANCHE = 43288,
    BOBA_RINKEBY = 28,
    MILKOMEDA_MAINNET = 2001,
    MILKOMEDA_DEVNET = 200101,
    BTC_MAINNET = 5555,
    BTC_TESTNET = 55555,
    AURORA_MAINNET = 1313161554,
    AURORA_TESTNET = 1313161555,
    TELOS_MAINNET = 40,
    TELOS_TESTNET = 41,
}
```

### ChainConfig type

The `ChainConfig` type defines the network configuration used to build cross-chain routes.

Example:

```
export type ChainConfig = {
    id: ChainId
    rpc: string
    dexFee: number
    filterBlockOffset: number
    stables: TokenConstructor[]
    metaRouter: string
    metaRouterGateway: string
    multicallRouter: string
    router: string
    bridge: string
    synthesis: string
    portal: string
    fabric: string
    waitForBlocksCount: number
}
```

Where:

| Property                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **id**                     | The identifier of the blockchain.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **rpc**                    | The HTTP RPC endpoint of the blockchain. Used to retrieve information about liquidity pools' reserves for this blockchain.                                                                                                                                                                                                                                                                                                                                                                                                  |
| **dexFee**                 | The liquidity provider fee for the selected DEX, expressed as an integer value. For example, 30 represents a fee of 0.3%.                                                                                                                                                                                                                                                                                                                                                                                                   |
| **filterBlockOffset**      | <p></p><p>The range of blocks used to retrieve logs from the blockchain. Used for:</p><ol><li>Getting a list of stuck transactions.</li><li>Checking the status of current cross-chain swap, bridging, or reverting operations.</li></ol>                                                                                                                                                                                                                                                                                   |
| **stables**                | The list of stablecoins used to build cros&#x73;**-**&#x63;hain routes. This list should include at least one stablecoin of this blockchain and N sToken that connect this blockchain to others.                                                                                                                                                                                                                                                                                                                            |
| **router**                 | The address of a DEX router for this blockchain. For example, UniSwap for Ethereum.                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| **metaRouter**             | <p>The address of the <code>Metarouter</code> contract. <br>------------------<br><strong>IMPORTANT</strong>: The <code>metaRouter</code> contract can only interact with ERC20 tokens approved by the <code>metaRouterGateway</code> contract. <strong>Do not</strong> approve ERC20 tokens directly for the <code>metaRouter</code> contract.<br>------------------<br>For more information, see <a data-mention href="../../crosschain-liquidity-engine/symbiosis-routing-contracts">symbiosis-routing-contracts</a></p> |
| **metaRouterGateway**      | The address of the `MetarouterGateway` contract.                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **multicallRouterGateway** | The address of the `MulticallRouter` contract.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **bridge**                 | <p>The address of the <code>BridgeV2</code> contract.<br>------------------<br>For more information, see <a data-mention href="../../crosschain-liquidity-engine/symbiosis-routing-contracts">symbiosis-routing-contracts</a></p>                                                                                                                                                                                                                                                                                           |
| **synthesis**              | <p>The address of the <code>Synthesis</code> contract.<br>------------------<br>For more information, see <a data-mention href="../../crosschain-liquidity-engine/symbiosis-routing-contracts">symbiosis-routing-contracts</a></p>                                                                                                                                                                                                                                                                                          |
| **portal**                 | <p>The address of the <code>Portal</code> contract.<br>------------------<br>For more information, see <a data-mention href="../../crosschain-liquidity-engine/symbiosis-routing-contracts">symbiosis-routing-contracts</a></p>                                                                                                                                                                                                                                                                                             |
| **fabric**                 | The address of the `Fabric` contract that stores a list of {sToken <-> Token} pairs.                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **waitForBlocksCount**     | The number of blocks for the destination blockchain to wait for a transaction to be mined.                                                                                                                                                                                                                                                                                                                                                                                                                                  |

### OmniPoolConfig type

The `OmniPoolConfig` type defines an Octopool.

Example:

```
export type OmniPoolConfig = {
    chainId: ChainId
    address: string
    oracle: string
}
```

### **AdvisorConfig and Config types**

The `AdvisorConfig` and `Config` types define details of the Advisor service.&#x20;

For more information on Advisor, see [symbiosis-and-fees](https://docs.symbiosis.finance/main-concepts/symbiosis-and-fees "mention")

#### **AdvisorConfig type**&#x20;

This type contains the address of the Advisor service.

```
export type AdvisorConfig = {
    url: string
}
```

#### **Config type**&#x20;

This type defines the configuration for the Advisor service.

```
export type Config = {
    advisor: AdvisorConfig
    chains: ChainConfig[]
    minSwapAmountInUsd: number
    maxSwapAmountInUsd: number
    omniPool: OmniPoolConfig
}
```

| Property               | Description                                                |
| ---------------------- | ---------------------------------------------------------- |
| **advisor**            | The configuration to access the Advisor service.           |
| **chains**             | The list of networks' configurations.                      |
| **minSwapAmountInUsd** | The minimum sum of cross-chain swap in the USD equivalent. |
| **maxSwapAmountInUsd** | The maximal sum of cross-chain swap in the USD equivalent. |
| **omniPool**           | The Octopool config.                                       |

### **TokenConstructor** **type**

The `TokenConstructor` type defines parameters for creating an instance of the `Token` class.

```
export type TokenConstructor = {
    name?: string
    symbol?: string
    address: string
    decimals: number
    chainId: ChainId
    isNative?: boolean
    isStable?: boolean
    chainFromId?: ChainId
    icons?: Icons
    userToken?: boolean
}
```

Where:

| Property        | Description                                                                                    |
| --------------- | ---------------------------------------------------------------------------------------------- |
| **name**        | The full name of the cryptocurrency.                                                           |
| **symbols**     | The ticker symbol of the cryptocurrency (e.g., BTC, ETH).                                      |
| **address**     | The cryptocurrency address.                                                                    |
| **decimals**    | The number of decimal places supported by the cryptocurrency.                                  |
| **isNative**    | A flag indicating whether the cryptocurrency is native to the blockchain or is an ERC20 token. |
| **isStable**    | A flag indicating whether the cryptocurrency is a stablecoin used in cross-chain swaps.        |
| **chainFromId** | The identifier of the blockchain network where the cryptocurrency (or sToken) originated.      |
| **icons**       | A list of icon URLs or paths associated with the cryptocurrency for UI purposes.               |
| **userToken**   | A flag indicating whether the cryptocurrency was manually added by a user.                     |

Example:

```
export class Token {
   ....

    /**
     * Constructs an instance of the base class `Token`.
     * @param params TokenConstructor
     */
    constructor(params: TokenConstructor) {
        validateSolidityTypeInstance(JSBI.BigInt(params.decimals), SolidityType.uint8)

        this.decimals = params.decimals
        this.symbol = params.symbol
        this.name = params.name
        this.chainId = params.chainId
        this.address = validateAndParseAddress(params.address)
        this.isNative = !!params.isNative
        this.icons = params.icons
        this.chainFromId = params.chainFromId
        this.isStable = params.isStable
        this.userToken = params.userToken
    }
    ...
}
```

```
export class TokenAmount extends Fraction {

    ...

    public constructor(token: Token, amount: BigintIsh) {
        const parsedAmount = parseBigintIsh(amount)
        validateSolidityTypeInstance(parsedAmount, SolidityType.uint256)

        super(parsedAmount, JSBI.exponentiate(TEN, JSBI.BigInt(token.decimals)))
        this.token = token

    }

    ...
}
```

### PendingRequestState and PendingRequest **types**

The `PendingRequestState` and `PendingRequest` types are used for reverting stuck cross-chain operations.

For more information, see [symbiosis-and-emergencies](https://docs.symbiosis.finance/crosschain-liquidity-engine/symbiosis-and-emergencies "mention")

Example:

```
enum PendingRequestState {
    Default = 0,
    Reverted,
}

export type PendingRequestType = 'burn' | 'synthesize'

export interface PendingRequest {
    fromTokenAmount: TokenAmount
    transactionHash: string
    state: PendingRequestState
    internalId: string
    externalId: string
    type: PendingRequestType
    from: string
    to: string
    revertableAddress: string
    chainIdFrom: ChainId
    chainIdTo: ChainId
    revertChainId: ChainId
}
```

Where:

<table><thead><tr><th width="243">Property</th><th>Description</th></tr></thead><tbody><tr><td><strong>fromTokenAmount</strong> </td><td>The amount of tokens of the stuck cross-chain operation.</td></tr><tr><td><strong>transactionHash</strong> </td><td>The hash of the transaction associated with the stuck operation.</td></tr><tr><td><strong>state</strong> </td><td><p>The current state of the revert operation:</p><ol><li><strong>Default</strong>: No attempt to revert the operation was made.</li><li><strong>Reverted</strong>: An attempt to revert the operation was made.</li></ol></td></tr><tr><td><strong>internalId</strong> </td><td><p>The internal identifier of the cross-chain operation.</p><pre><code>internalID = keccak256(
                abi.encodePacked(this, requestCount, block.chainid)
            );
</code></pre></td></tr><tr><td><strong>externalId</strong> </td><td><p>The external identifier of the cross-chain operation. The identifier is derived from the <code>internalId</code> and calculated together with the destination network id, the destination contract address, and the address that revert this transaction.</p><pre><code>externalID = keccak256(abi.encodePacked(internalID, _receiveSide, _revertableAddress, _chainID)
</code></pre></td></tr><tr><td><strong>type</strong> </td><td><p>The type of the operation:</p><ol><li> <strong>burn:</strong> The operation burns sTokens,</li><li><strong>synthesize:</strong> The operation mints sTokens.</li></ol></td></tr><tr><td><strong>from</strong> </td><td>The sender's address.</td></tr><tr><td><strong>to</strong> </td><td>The recipient's address.</td></tr><tr><td><strong>revertableAddress</strong> </td><td>The address authorized to perform a revert operation for the stuck transaction.</td></tr><tr><td><strong>chainIdFrom</strong> </td><td>The identifier of the source blockchain.</td></tr><tr><td><strong>chainIdTo</strong> </td><td>The identifier of the destination blockchain.</td></tr><tr><td><strong>revertChainId</strong></td><td>The identifier of the blockchain where the revert transaction will be sent.</td></tr></tbody></table>
