JS SDK Types
Symbiosis JS SDK Types
Checklist Before Going to Production (Mainnet)
Warning: 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: Always approve users' ERC20 tokens for only one contract — the
metaRouterGateway
— on each blockchain. Verify the contract addresses for all supported blockchains in this configuration.Contract Existence and Address Validation: Ensure that the contracts used in your integration are deployed on the respective blockchains, and that their addresses on each blockchain match those listed in this configuration.
Handling of Calldata: Do not modify, reuse, or cache calldata retrieved from Symbiosis SDKs or API methods.
Testing: After deployment to Mainnet, conduct at least one cross-chain operation to ensure proper functionality.
Reminder: Perform this checklist during the initial deployment and after every software update.
Types
Symbiosis JS SDK defines the following types:
ChainId
Lists identifiers of supported blockchains.
ChainConfig
Defines the network configuration for building cross-chain routes.
OmniPoolConfig
AdvisorConfig and Config
TokenConstructor
Specifies parameters for creating an instance of the Token
class.
PendingRequestState and PendingRequest
Used for reverting stuck cross-chain operations.
ChainId type
The ChainId
type lists named constants that represent integer identifiers for supported blockchains.
Example:
ChainConfig type
The ChainConfig
type defines the network configuration used to build cross-chain routes.
Example:
Where:
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
The range of blocks used to retrieve logs from the blockchain. Used for:
Getting a list of stuck transactions.
Checking the status of current cross-chain swap, bridging, or reverting operations.
stables
The list of stablecoins used to build cross-chain 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
metaRouterGateway
The address of the MetarouterGateway
contract.
multicallRouterGateway
The address of the MulticallRouter
contract.
bridge
synthesis
portal
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:
AdvisorConfig and Config types
The AdvisorConfig
and Config
types define details of the Advisor service.
For more information on Advisor, see Symbiosis & Fees
AdvisorConfig type
This type contains the address of the Advisor service.
Config type
This type defines the configuration for the Advisor service.
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.
Where:
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:
PendingRequestState and PendingRequest types
The PendingRequestState
and PendingRequest
types are used for reverting stuck cross-chain operations.
For more information, see Symbiosis & Emergencies
Example:
Where:
fromTokenAmount
The amount of tokens of the stuck cross-chain operation.
transactionHash
The hash of the transaction associated with the stuck operation.
state
The current state of the revert operation:
Default: No attempt to revert the operation was made.
Reverted: An attempt to revert the operation was made.
internalId
The internal identifier of the cross-chain operation.
externalId
The external identifier of the cross-chain operation. The identifier is derived from the internalId
and calculated together with the destination network id, the destination contract address, and the address that revert this transaction.
type
The type of the operation:
burn: The operation burns sTokens,
synthesize: The operation mints sTokens.
from
The sender's address.
to
The recipient's address.
revertableAddress
The address authorized to perform a revert operation for the stuck transaction.
chainIdFrom
The identifier of the source blockchain.
chainIdTo
The identifier of the destination blockchain.
revertChainId
The identifier of the blockchain where the revert transaction will be sent.
Last updated
Was this helpful?