Migration from V2 to V3
The biggest update in rubic-sdk third version was TRON integration. It required big restructuring, because TRON is not an EVM-like chain, so most of the logic changes happened in blockchain-connected classes. Also, as common code refactoring, many classed were renamed, moved to another folder, or deleted.
This guide explains how to move from version 2 to version 3.
1. Basic configuration
Version 2
import SDK, { BLOCKCHAIN_NAME, Configuration, WalletProvider } from 'rubic-sdk';
// optional parameter
const walletProvider: WalletProvider = {
address: '0x123...', // user wallet address
chainId, // user wallet chain id
core: window.ethereum
};
// optional parameter
const providerAddress = '0xabc...';
const configuration: Configuration = {
rpcProviders: {
// optional blockchains
[BLOCKCHAIN_NAME.ETHEREUM]: {
mainRpc: '<your ethereum rpc>'
},
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: {
mainRpc: '<your bsc rpc>'
},
...
},
providerAddress,
walletProvider
};
const sdk = await SDK.createSDK(configuration);
...
// Later, if user changed address, you can update configuration:
await sdk.updateConfiguration(configuration);Version 3
2. Instant Trades -> On Chain Trades
Version 2
Version 3
3. Cross Chain Trades
Cross Chain did not change much, the main updates are:
4. Tokens Manager
TokensManager class was deleted. Now you can use Token classes directly.
5. Common changes
Last updated
Was this helpful?