Skip to main content

Official SDK Status

We do not currently ship a monolithic SDK. The recommended integration path is:
  1. Call the Gas API to fetch fees and signatures.
  2. Interact directly with the CashmereCCTP contracts.
  3. Use the Monitoring API for analytics and monitoring.
This approach keeps client code transparent and portable across frameworks.

Helper Snippets

TypeScript Utility

/**
 * Fetches a signed fee quote for Cashmere transferV2 transactions.
 */
export async function getTransferV2Quote({
  localDomain,
  destinationDomain,
  isNative,
}: {
  localDomain: number;
  destinationDomain: number;
  isNative: boolean;
}) {
  const res = await fetch(
    'https://gas.cashmere.exchange/getEcdsaSig_native?' +
      new URLSearchParams({
        localDomain: String(localDomain),
        destinationDomain: String(destinationDomain),
        isV2: 'true',
        isNative: String(isNative),
      })
  );
  if (!res.ok) throw new Error('Gas API error');
  return (await res.json()) as {
    fee: string;
    deadline: string;
    signature: string;
    isNative: boolean;
    cctpVersion: number;
  };
}

Go Utility

package cashmere

import (
    "encoding/json"
    "fmt"
    "net/http"
)

type EcdsaQuote struct {
    Fee         string `json:"fee"`
    Deadline    string `json:"deadline"`
    Signature   string `json:"signature"`
    IsNative    bool   `json:"isNative"`
    CctpVersion int    `json:"cctpVersion"`
}

func GetECDSAQuote(local, dest int, isNative bool) (*EcdsaQuote, error) {
    url := fmt.Sprintf("https://gas.cashmere.exchange/getEcdsaSig_native?localDomain=%d&destinationDomain=%d&isV2=true&isNative=%t", local, dest, isNative)
    resp, err := http.Get(url)
    if err != nil {
        return nil, err
    }
    defer resp.Body.Close()

    if resp.StatusCode != http.StatusOK {
        return nil, fmt.Errorf("Gas API returned status %s", resp.Status)
    }

    var quote EcdsaQuote
    if err := json.NewDecoder(resp.Body).Decode(&quote); err != nil {
        return nil, err
    }
    return &quote, nil
}

Rust (Solana Client)

use anyhow::{bail, Result};
use reqwest;

pub async fn get_ed25519_quote(local: u32, dest: u32, is_native: bool) -> Result<Ed25519Quote> {
    let url = format!(
        "https://gas.cashmere.exchange/getEd25519Sig_native?localDomain={}&destinationDomain={}&isNative={}&version=2",
        local, dest, is_native
    );
    let resp = reqwest::get(&url).await?;
    if !resp.status().is_success() {
        bail!("gas api error: {}", resp.status());
    }
    Ok(resp.json::<Ed25519Quote>().await?)
}
Ed25519Quote should mirror the Gas API response fields (signature, message, publicKey, fee, deadline, isNative, version).

Future Plans

  • Lightweight TypeScript package (@cashmere/gas-client) that wraps the REST calls.
  • Sample repositories for Solana and Sui once Anchor/Move SDKs stabilise.
If you would like to contribute, open an issue in the public contracts repository.