Rubic Documents
  • RUBIC
    • Overview
    • Rubic's Ecosystem
    • Security
    • Tokenomics
    • Roadmap
    • Rubic Discord Roles
    • “Swap to Earn” Program on Rubic
    • MEV-bot Protection
    • B2B Cross-Chain Toolkit
      • Use Cases
      • Why Rubic?
    • Refund Guidelines for Stuck Transactions
  • ⚒️Integrate SDK
    • SDK Overview
    • SDK Architecture
    • SDK Advantages
    • SDK Integration
    • 1️⃣Install SDK
    • 2️⃣Set up SDK
    • 3️⃣Trade calculation
    • 4️⃣Swap Execution
    • 📜Advanced documentation
    • Migration from V2 to V3
    • Contact Us
  • Integrate Widget
    • Widget Overview
    • Instruction
    • White Label Widget Integration Instruction
    • Partners
    • Listing of tokens
  • Rubic API
    • 🔐Tokens API
    • Referrer And Rate Limits
    • Rubic API
      • Supported chains
      • Supported providers
      • Request Quote
      • Request Data
      • Get Cross-Chain Status
      • Integration example
        • Swaps from EVM
        • Swaps from Solana
        • Swaps from TON
        • Swaps from Tron
        • Swaps from Bitcoin
        • Swaps VIA deposit
      • Swagger
      • Models
        • OnChainTradeType
        • CrossChainTradeType
        • FeesDto
        • RoutingDto
        • TransactionDto
        • ErrorDto
      • Errors
    • Monetization And Fees
  • FAQ
    • What is Rubic?
    • How to start using Rubic?
    • Who can use our service?
    • Is KYC required?
    • What are the minimum and maximum trade sizes?
    • Should I list my token before using your service?
    • How to create a Swap?
    • How long does it take to complete a transaction?
    • How is the privacy and security of the transaction ensured?
    • How does Rubic unite different DEX platforms?
    • Why does Rubic offer a choice between different providers?
    • How do I add the BNB Smart Chain and Polygon networks to MetaMask?
    • What should I do when I see the message: “Trading on Uniswap is not available?”
    • What should I do if Uniswap doesn’t display any rates?
    • How can we integrate the Rubic Relay widget?
    • How do we get listed on Rubic?
    • How to Complete swaps to/from TON network using Rubic
  • Contacts
    • Community
    • PR Marketing
    • Business Development
    • Support
    • Influencers Collaboration Requests
  • Legal Documentation
    • Privacy Policy
    • Terms of Use
    • Third-Party Software
  • Audits
    • MixBytes Audit
  • Pitch Deck
Powered by GitBook
On this page

Was this helpful?

  1. Integrate SDK

SDK Architecture

Rubic’s SDK is being constantly improved and streamlined on all levels.

PreviousSDK OverviewNextSDK Advantages

Last updated 10 months ago

Was this helpful?

Rubic’s SDK is a Cross-Chain tool & service with a unique architecture that provides the ultimate cross-chain swapping experience both for its users and integrators.

Overall, the architecture of the protocol is based on three parts: the core SDK modules, the modules related to external API (providers, CoinGecko), and the blockchain Interaction module (RPC Node).

  1. Rubic’s SDK, which is also deployed in its main app, consists of the following modules: Cross-Chain Manager, On-Chain Manager, Status Manager, Token Manager, and Revert Manager.

  2. Rubic’s SDK interacts with blockchains through the RPC Node. Rubic’s SDK accesses blockchain nodes to retrieve blockchain meta-information, invoke smart contracts, or send transactions.

  3. Cross-Chain Manager incorporates on-chain swaps as well. To find the best swap option and build up the optimal route, Rubic’s SDK reaches out to the providers’ API, and then the transaction is sent to Rubic’s smart contracts, which call the contracts of cross-chain providers, in return.

  4. On-Сhain Manager implies instant trades and means that you swap tokens on the same blockchain. To deliver transaction data and rates, Rubic appeals to 0x and 1inch as on-chain providers via external API. For the rest of the providers, Rubic receives the data from the blockchain through the RPC Node.

  5. Status Manager module provides the status of a cross-chain swap and is connected to the ‘My Trades’ section shown on app.rubic.exchange. In the cases of Celer and DeBridge, Status Manager reaches directly to the smart contract. Simbiosis and LIFI call their API. Finally, the Status Manager gets back with the ultimate status of a transaction.

  6. Token Manager module keeps the information about tokens and interacts with CoinGecko to receive the USD value of each of them.

  7. Revert Manager ensures the operation of the auto-refund function. If any error occurs in a transaction, the funds are saved in the form of transit tokens, and afterward, get back to their owners. In the case of Symbiosis, Rubic’s SDK contacts the Symbiosis Revert API. On Rubic’s app, it’s being realized through the “My Trades” section — “Recent Trades”. If a trade hasn’t been completed in the target network, users will see “Revert Transaction.”

⚒️
SDK Architecture