AltLayer Documentation
  • 👋Welcome
    • Overview
  • Restaked Rollups
    • VITAL for Decentralised Verification
      • Tier-1 Finality
      • Tier-2 Finality
      • Tier-3 Finality
    • MACH for Faster Finality
      • Interoperability via MACH
    • SQUAD for Decentralised Sequencing
    • Staking of dApp Token
  • Wizard
    • Introduction
    • Technical overview
    • Create AVS
    • Manage AVS
    • Operator management
    • Hosted operator API (BLS based)
    • Custom AVS specification
      • Constructor specification requirements
      • Import Externally-Deployed AVS
    • Report bug or submit a feature request
  • Autonome
    • Deploy AI Agent
    • Autonome API guide
    • Uploading your own agent framework
    • Twitter/X login troubleshooting guide
  • ♾️AltLayer-Facilitated Actively Validated Services
    • Overview
    • AltLayer MACH AVS
      • Operator Guide
      • User Delegation Guide
    • Cyber MACH AVS for Cyber L2
      • Operator Guide
      • User Delegation Guide
    • DODOchain MACH AVS for DODO Chain
      • Operator Guide
      • User Delegation Guide
    • Fast Finality Layer for Soneium
      • Operator Guide
      • User Delegation Guide
    • Xterio MACH AVS for Xterio Chain
      • Operator Guide
      • User Delegation Guide
  • Upgrade Guide
  • 🥩ALT Restaking
    • Staking Info & Parameters
    • Restake ALT
    • Delegating reALT
    • Check and Claim Staking Rewards
    • Unstake ALT
    • Migration from Xterio (Legacy) ALT Pool to Xterio Restaked ALT Pool
    • Testnet reALT faucet
  • Rollup-as-a-Service
    • What is Rollup-as-a-Service (RaaS)?
    • AltLayer's RaaS Offering
    • RaaS Onboarding Guide
      • Optimism Rollup FAQ
      • Arbitrum Rollup FAQ
    • AltLayer Ecosystem
    • Clients in the Spotlight
    • Pricing Model
  • External Integrations
    • Account Abstraction using Biconomy
    • Enabling permissionless interoperability on AltLayer Rollup with Hyperlane
      • Deplying Hyperlane Warp Routes for ERC20 Token Bridging
      • Running Off-chain Agents
      • Setting up the bridging UI
    • Cross-chain Interoperability using Celer
      • Fungible Token Bridging
      • Non-fungible Token Bridging
      • Generic Message Passing
      • cBridge SDK
  • AltLayer's In-House Rollup Stack in Depth
    • How does AltLayer's in-house rollup stack work?
    • Decentralized Sequencer Set
    • Security via Fraud Proof
  • Rollup Types
    • Flash Layer Rollups
      • Example Use cases
        • NFT Mint Events
        • Games
        • Event Ticketing
    • Persistent Rollups
  • Core Features of AltLayer's In-House Rollup Stack
    • Modular
    • Elastic
    • Multi-VM Support
    • Fraud Proofs
    • Decentralized Sequencers
    • Tiered-Finality
  • FlashLayer Showcase
    • AltLayer's POAP NFTs Collection Mint
      • Performance Test in the Wild
    • Dark Forest Community Round
    • Oh Ottie! NFT Collection Mint
    • Dark Forest Community Round for Jump Crypto's Pit Event
    • Ottie 2048
    • Other demos
      • Fraud Proof Demo
      • Flash Layer Demo
      • Rollup Launchpad Demo
      • FlashGPT Demo
  • Implementation Status
    • Roadmap
    • Development Status
  • Community & Support
    • Community
    • Support
Powered by GitBook
On this page
  • Overview
  • SDK Working Flow
  • Installation
  • 1. Install the grpc-web
  • 2. Download cBridge type-script client and contract
  • 3. Import cBridge SDK into your projects
  1. External Integrations
  2. Cross-chain Interoperability using Celer

cBridge SDK

PreviousGeneric Message PassingNextHow does AltLayer's in-house rollup stack work?

Last updated 1 year ago

Overview

The enables new and existing applications to integrate with a rich subset of features available in cBridge to build in-app transfer functionality into their applications. Libraries and packages are available and allow you to implement functionalities into your dApp quickly. The cBridge SDK also allows you to customize UI and enable the native asset-transfer UX for users.

In addition, the provides a lightweight version of the cBridge SDK, which makes the integration easier and allows you to enable cBridge transfers with the complete source files supported.

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 requests to cBridge gateway through cBridge SDK

  2. Send the corresponding on-chain transaction to cBridge contract

Installation

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

  1. All messages are defined in protobuf, enum value could be used directly, such as Completed, instead of an integer value 1. It helps mitigate 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 requests

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

To begin development with cBridge SDK, each developer needs to install grpc-webthe 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. They can be used in your project. The following is the code snippet for type-script client usage in the 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);

1. Install the

Download auto-generated protobuf files(including xxx_pb.d.ts, xxx_pb.js) in.

grpc-web
cBridge typescript client repo
cBridge SDK
cBridge Transfer Web Widget