Skip to main content

Contract Overview

The Bridge program exposes the following function for bridging:

IDL

idl

Setup

For this example we’ll use @solana/web3.js, @solana/spl-token and @coral-xyz/anchor to interact with the contract, but you can replace it with any Solana library of your choice. Make sure to install it first:

Set-up helpers for Solana accounts

solanaBridgeHelpers.js

Interacting with the Contract

To execute a bridge transaction, call the depositWithId (ERC20) or depositNativeWithId (native) function as follows:
The commitmentId required by the contract corresponds to the quoteId returned by the API.To obtain the commitmentId, first request a quote from the API, then commit it. The response will include the quoteId, which should be used as the commitmentId in the contract call.See the API bridge example for details.