Socket
Book a DemoInstallSign in
Socket

@rsksmart/tokenbridge-sdk

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rsksmart/tokenbridge-sdk

SDK that simplifies interaction between RSK TokenBridge and client applications

0.4.13
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source

TokenBridge SDK

TokenBridge SDK simplifies the integration between client applications all the smart contracts that participate in the RSK token bridge.

Installation

npm install @rsksmart/tokenbridge-sdk

Usage

Create TokenBridge client instance

    const tokenBridge = new TokenBridge({ network: 'Testnet', rskConnection: connection })

Set the RPC URLs of the Networks that you'll be crossing and configure the SDK with those networks

    const networks = setNetworksRpcs({
      Sepolia: config.otherNetworkRpc,
      RskTestnet: config.rskRpc
    })
    tokenBridge.setCrossingNetworks(networks.RskTestnet, networks.Sepolia)

Then you can start doing operations with the client

    const toAddress = '0x123...'
    const pair = buildTokenPairs(networks.Sepolia.tokens, networks.RskTestnet.tokens)
      .find(tokenPair => tokenPair.originToken.tokenInfo.symbol === 'LINK') 
    const crossTx = await tokenBridge.cross(pair, 20, toAddress)

You can read more about RSK TokenBridge here.

Connect to RSK

You will need to be connected to the blockchain to execute most of the operations, to do that you need to create a RSKConnection object and provide it during SDK construction Flyover object

    const rsk = await BlockchainConnection.createUsingStandard(window.ethereum)
    const tokenBridge = new TokenBridge({ network: 'Testnet', rskConnection: connection })

Notice that the connection class is called BlockchainConnection. This will be renamed to BlockchainConnection in future updates.

Also you can change SDK connection at any moment by doing the following

    const sepolia = await BlockchainConnection.createUsingStandard(window.ethereum)
    await tokenBridge.changeConnection(sepolia)

There are 3 ways to create an RSK connection, you can check them in BlockchainConnection class documentation

Application Programming Interface

To see the full API of this package please refer to the the docs folder of this project

Keywords

SDK

FAQs

Package last updated on 10 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.