🟧JS SDK Types
Symbiosis JS SDK Types
Checklist Before Going to Production (Mainnet)
If any of these checks fail, you put the assets of your users at risk. Therefore, you must not go to Mainnet with real assets and real users. This could result in the loss of your users' assets.
Approval of ERC20 Tokens: Approve users’ ERC20 tokens only for one contract, which is '
metaRouterGateway'
on each blockchain. You can verify the addresses of the contracts for all blockchains supported by Symbiosis protocol V2 in this configuration.Existence and Correct Addresses of Contracts: Ensure that all contracts used in your software exist on the corresponding blockchains and that their addresses on each blockchain match those in this configuration.
Handling of Calldata: Do not modify, reuse, or cache the calldata obtained from calling methods of the Symbiosis SDKs and API.
Acknowledgement of 'from' Address Usage: Acknowledge that the 'from' address is used to revert a cross-chain swap if the cross-chain operation gets stuck. For more information see #address-eligible-to-revert-cross-chain-swaps
Testing: After deployment to Mainnet, run at least one cross-chain operation.
Please do these checks for the initial deployment AND each software update.
Types
Symbiosis JS SDK defines the following types:
Type | Use |
---|---|
ChainId | The type lists identifiers of supported blockchains. |
ChainConfig | The type defines the network configuration to build cross-chain routes. |
OmniPoolConfig | The type defines a liquidity pool consisting of a stablecoins and an sTokens. |
AdvisorConfig and Config | The types define details of Microservice Advisor. For more information on Advisor, please check Gas Fees for Cross-chain Operations via Symbiosis |
TokenConstructor | The type defines a set of parameters used to create an instance of Token class. |
PendingRequestState and PendingRequest | The types are used for reverting stuck cross-chain operations. |
ChainId type
ChainId type lists named constants with the integer identifiers of supported blockchains.
ChainConfig type
ChainConfig type defines the network configuration used to build cross-chain routes.
Property | Description |
---|---|
id | The blockchain identifier |
rpc | The HTTP RPC of the blockchain. Used to retrieve information about liquidity pools' reserves for this blockchain. |
dexFee | The liquidity provider fee for the chosen DEX. It's an integer value (for example, 30 that equals 0.3%) |
filterBlockOffset | The range of blocks within which to get log from the blockchain. Used:
|
stables | The list of stablecoins used to build cross-chain routes. This list should contain one stablecoin of this blockchain and N sToken that connect this blockchain to other blockchains. |
router | The address of a DEX router for this blockchain. For example, it can be UniSwap for Ethereum. |
metaRouter | The address of the Metarouter contract.
------------------
IMPORTANT The |
metaRouterGateway | The address of the MetarouterGateway contract. |
multicallRouterGateway | The address of the MulticallRouter contract. |
bridge | The address of the BridgeV2 contract. ------------------ For more information on the contracts and the reason why it works this way, please refer to Symbiosis Routing Contracts |
synthesis | The address of the Synthesis contract. ------------------ For more information on the contracts and the reason why it works this way, please refer to Symbiosis Routing Contracts |
portal | The address of the Portal contract. ------------------ For more information on the contracts and the reason why it works this way, please refer to Symbiosis Routing Contracts |
fabric | The address of the Fabric contract that stores a list of an sToken and a stablecoin pairs. |
waitForBlocksCount | The number of blocks for the destination blockchain to wait for a transaction to be mined. |
OmniPoolConfig type
OmniPoolConfig type defines a liquidity pool containing stablecoins and sTokens.
AdvisorConfig and Config types
AdvisorConfig and Config types define details of the Advisor service.
For more information on Advisor, please check Gas Fees for Cross-chain Operations via Symbiosis
AdvisorConfig type
This type contains the address of the Advisor service.
Config type
This type defines the configuration for the Advisor service.
Property | Description |
---|---|
advisor | The configuration to access the Advisor service. |
chains | A 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 | Config of liquidity pool consisting of a stablecoins and an sTokens |
TokenConstructor type
TokenConstructor type defines a set of parameters used to create an instance of Token class.
Property | Description |
---|---|
name | The cryptocurrency name |
symbols | The cryptocurrency ticker symbol |
address | The cryptocurrency address |
decimals | The decimals for the cryptocurrency |
isNative | A flag indicating that the cryptocurrency is a native cryptocurrency or an ЕРС20 token |
isStable | A flag indicating that the cryptocurrency is a stablecoin used in cross-chain swaps. |
chainFromId | The network identifier the sToken was received from |
icons | A list of icons for the cryptocurrency |
userToken | A flag indicating that the cryptocurrency was added manually by a user. |
PendingRequestState and PendingRequest types
PendingRequestState and PendingRequest types are used for reverting stuck cross-chain operations.
An explanation of reverting cross-chain operations: Symbiosis & Emergencies
Property | Description |
---|---|
fromTokenAmount | The amount of tokens that were in the stuck cross-chain operation. |
transactionHash | The hash of the stuck transaction |
state | The state of the revert:
|
internalId | The internal identifier of the cross-chain operation. The identifier of the minting/burning request is calculated without the destination network id, the recipient contract address (Portal or Synthesis), and the address that can perform a revert. |
externalId | The external identifier of the cross-chain operation. The identifier is derived from the |
type | The type of the operation:
|
from | The sender's address |
to | The recipient's address |
revertableAddress | The address which can revert the operation |
chainIdFrom | The identifier of the source blockchain |
chainIdTo | The identifier of the destination blockchain |
revertChainId | The identifier of the blockchain to send revert transaction |
Last updated