Integration of SDK
Complete the integration of Rubic Cross-Chain protocol with our brand new SDK. Allow your users to complete swaps on and between 9 networks in 1 click!

Important!

Rubic SDK is at the Beta Stage.
Rubic team recommends you complete several tests before using it in productions code
This will allow you to explore our solution and try it out in a test environment. An example of using Rubic SDK.

The latest update of our SDK could always be found at: https://github.com/Cryptorubic/rubic-sdk

Please contact our developers in Discord if you have any questions regarding the development
You also can contact Rubic in order to get marketing support by contacting the Head of Rubic Business Development team - Sven:
Discord: Sven_Rubic#9198

Description

The Rubic SDK offers On-Chain and Cross-Chain swaps at the best-possible rates. 50% of Rubic commission goes to partners. Integration is free!
Our SDK is built on the basis of Rubic Cross-Chain protocol frontend part. Rubic SDK is a library for interacting with more than 60 DEX's, as well as Rubic Cross-Chain swaps.

Supported DEX-es

Cross-Chain swaps are supported on the following blockchains:

Ethereum, BNB Chain, Polygon, Harmony, Avalanche, Moonriver, Fantom, Solana, Arbitrum and Aurora.

Installation

Installation with cdn

1
<script src="https://unpkg.com/[email protected]/dist/rubic-sdk.min.js"></script>
Copied!

Installation with npm and webpack (React, ...)

  1. 1.
    npm install rubic-sdk
ℹ️️ Skip the rest of the steps if your have already installed web3 in your project.
  1. 1.
    npm install --save-dev http-browserify https-browserify stream-browserify crypto-browserify
  2. 2.
    modify webpack.config.js. If you use create-react-app, run npm run eject to extract config
    1. 1.
      add to plugins
      1
      new webpack.ProvidePlugin({
      2
      Buffer: ['buffer', 'Buffer'],
      3
      process: 'process/browser'
      4
      })
      Copied!
    2. 2.
      add resolve.fallback
      1
      "fallback": {
      2
      "fs": false,
      3
      "constants": false,
      4
      "querystring": false,
      5
      "url": false,
      6
      "path": false,
      7
      "os": false,
      8
      "http": require.resolve("http-browserify"),
      9
      "https": require.resolve("https-browserify"),
      10
      "zlib": false,
      11
      "stream": require.resolve("stream-browserify"),
      12
      "crypto": require.resolve("crypto-browserify")
      13
      }
      Copied!

Installation with npm for Angular

  1. 1.
    npm install rubic-sdk
ℹ️️ Skip the rest of the steps if your have already installed web3 in your project.
  1. 1.
    npm install --save-dev stream-browserify assert https-browserify os-browserify stream-http crypto-browserify process buffer
  2. 2.
    Modify tsconfig.json
    1
    {
    2
    "compilerOptions": {
    3
    ...
    4
    "paths" : {
    5
    ...
    6
    "stream": ["./node_modules/stream-browserify"],
    7
    "assert": ["./node_modules/assert"],
    8
    "https": ["./node_modules/https-browserify"],
    9
    "os": ["./node_modules/os-browserify"],
    10
    "http": ["./node_modules/stream-http"],
    11
    "crypto": ["./node_modules/crypto-browserify"]
    12
    }
    13
    }
    Copied!
  3. 3.
    Modify polyfills.ts
    1
    import Process = NodeJS.Process;
    2
    3
    export interface AppWindow extends Window {
    4
    process: Process;
    5
    Buffer: Buffer;
    6
    }
    7
    8
    (window as AppWindow).process = window.process || require('process');
    9
    (window as AppWindow).Buffer = (window as any).Buffer || require('buffer').Buffer;
    Copied!

Rubic team is constantly in a process of upgrading an SDK feature and we are planning to release more updates during this year.

In order to keep up with the updates, please refer to the https://github.com/Cryptorubic/rubic-sdk

Please contact our developers in Discord if you have any questions regarding the development

You also can contact Rubic in order to get marketing support by contacting the Head of Rubic Business Development team - Sven:

Discord: Sven_Rubic#9198