🌉
Celer cBridge
  • 👋Welcome to cBridge
  • Introduction
    • Architectural Benefits
    • State Guardian Network
    • SGN and cBridge
      • The SGN as a cBridge node gateway and Service Level Agreement (SLA) arbitrator
      • The SGN as a Shared Liquidity Pool Manager
    • Fungible Token Bridging Models
    • cBridge Security
  • Tutorial
    • Cross-chain Transfer
    • LP Guide
    • SGN V2 Staking Guide
    • SGN V1 Unbonding Guide
    • Smart Contract as LP
    • Aptos Bridging Guide
    • Ape Chain Bridging Guide
    • Flow Cadence Bridging Guide
    • Flow EVM Bridging Guide
  • Developer
    • Circle Cross-chain USDC Transfer Protocol(CCTP)
    • cBridge SDK
    • cBridge Pool-Based Transfer (xLiquidity)
      • Transfer
      • Transfer Refund
    • cBridge Canonical Mapping Transfer (xAsset)
      • Mint
      • Mint Refund
      • Burn
      • Burn Refund
    • cBridge Transfer Web Widget
    • cBridge Aptos Transfer (xAsset Only)
    • Custom Transfer URL Schemes
    • cBridge APIs for Sui
    • Referral Specific Transfer
    • cBridge Limit Parameters
    • API Reference
      • Gateway: GetTransferConfigsForAll
      • Gateway: EstimateAmt
      • Contract: Pool-Based Transfer
      • Gateway: GetTransferStatus
      • Contract: Pool-Based Transfer Refund
      • Gateway: TransferHistory
      • Contract: Mint Canonical Token(OriginalTokenVault)
      • Contract: Mint Canonical Token(OriginalTokenVaultV2)
      • Contract: Mint Canonical Token Transfer Refund
      • Contract: Burn Canonical Token(PeggedTokenBridge)
      • Contract: Burn Canonical Token (PeggedTokenBridgeV2)
      • Contract: Burn Canonical Token Transfer Refund
      • Gateway: MarkRefRelation
      • Contract: TransferAgent Mint Token Submission
      • Contract: TransferAgent Burn Token Submission
      • Contract: Aptos Vault Mint Token Submission
      • Contract: Aptos PegBridge Burn Token Submission
  • NFT Bridge
    • Introduction
    • NFT Bridge Fee
  • List Your Tokens
    • Simple Listing Process
  • Reference
    • FAQ
    • Audit Reports
    • Contract Addresses
Powered by GitBook
On this page
  • cBridge Testnet Website
  • cBridge Testnet Endpoint
  • cBridge Mainnet Endpoint
  • SDK Working Flow
  • Installation
  • 1. Install the grpc-web
  • 2. Download cBridge type-script client and contract
  • 3. Import cBridge SDK into your projects.
  • API Reference
  • Need help?
  1. Developer

cBridge SDK

PreviousCircle Cross-chain USDC Transfer Protocol(CCTP)NextcBridge Pool-Based Transfer (xLiquidity)

Last updated 1 year ago

cBridge SDK allows new and existing applications to integrate a rich subset of features that are available in the cBridge 2.0. Simple imported libraries and packages allow you to quickly implement the cBridge transfer functionality into new and existing applications.

cBridge Testnet Website

You can try our during the SDK integration

cBridge Testnet Endpoint

The testnet endpoint is:

cBridge Mainnet Endpoint

When you have finished implementation and testing on testnet, you are welcome to use cBridge mainnet for production test. The endpoint is:

SDK Working Flow

The following graph reveals a general cBridge SDK integration inside your application. In most cases, you need to support only two functions(red lines in the graph):

  1. Send request to cBridge gateway through cBridge SDK

  2. Send corresponding on-chain transaction to cBridge contract

Installation

It's highly recommended to communicate with cBridge gateway by using grpc-web.

  1. You don't need to put any effort for response value mapping. Since all messages are defined in protobuf, enum value could be used directly such as Completed instead of an integer value 1. It helps preventing bugs and errors due to random mapping issues

  2. Inside cBridge gateway, there are some post APIs needing serialized byteArray as input. It takes some steps to prepare format accepted request information. Just in case you prefer RESTful api request, we will provide some examples for you accordingly

  3. Since cBridge iterates frequently, the best way to keep everything updated is using grpc. You can always check the latest grpc generated files and keep in touch with the newest cBridge gateway

You can always use REST apis when communicating with cBridge gateway. We will provide examples and details in each api reference.

To begin development with cBridge SDK, each developer needs to install grpc-web for cBridge gateway communication

// Install via yarn
yarn add grpc-web
// Install via npm
npm install grpc-web

2. Download cBridge type-script client and contract

3. Import cBridge SDK into your projects.

Import the file and type-defined messages, then they can be used in your project. The following is code snippet for type-script client usage in JavaScript project.

// import getTransferConfig request message 
import {
  GetTransferConfigsRequest
  GetTransferConfigsResponse
} 
from "../ts-proto/sgn/gateway/v1/gateway_pb";

// import grpc-web WebClient
import { WebClient } 
from "../ts-proto/sgn/gateway/v1/GatewayServiceClientPb";

const request = new GetTransferConfigsRequest();
const client = new WebClient(`https://cbridge-prod2.celer.app/`, null, null);
const response = await client.getTransferConfigs(request, null);

API Reference

Once you have integrated cBridge SDK into your project, dive into the specifics of each API by checking out our complete documentation.

Need help?

1. Install the

Download auto-generated protobuf files(including xxx_pb.d.ts, xxx_pb.js) in . You can find all needed messages including client, request constructs and contracts there.

If you're looking for help, try join the

grpc-web
cBridge typescript client repo
API Reference
community Discord
testnet website
https://cbridge-v2-test.celer.network
https://cbridge-prod2.celer.app/