Using the SDK

Install (example for local dApp integration):

npm install @crosterix/sdk

Import the SDK into your project:

import { Crosterix } from "@crosterix/sdk";
const crosterix = new Crosterix();

Example 1: Private Token Swap

const swap = await crosterix.privateSwap({
  fromToken: "0xC02aa...", // WETH
  toToken: "0xA0b86...",   // USDC
  amount: "1000000000000000000", // 1 ETH
  chainId: 1, // Ethereum Mainnet
  stealthMode: true, // Enable privacy
});
console.log("Transaction sent:", swap.txHash);

Result: Tokens are swapped through the 1inch/0x router, executed from a stealth address. No logs, no backend, and no link to your main wallet.


Example 2: Generate a Stealth Address

const stealth = await crosterix.generateStealthAddress({
  recipientPubKey: "0x04bfc5...",
});
console.log("New Stealth Address:", stealth.address);

Result: A unique one-time wallet address is generated locally using elliptic-curve Diffie–Hellman. This address cannot be linked to the user’s main wallet.


Example 3: Encrypt & Upload a File

const encrypted = await crosterix.encryptFile({
  file,
  recipient: "0xRecipientAddress",
});

const ipfs = await crosterix.uploadToIPFS({
  file: encrypted.file,
  apiKey: "YOUR_LIGHTHOUSE_API_KEY",
});

const link = await crosterix.createFileLink({
  cid: ipfs.cid,
  expiresIn: 86400, // 24 hours
});
console.log("Private File Link:", link.url);

Result: File is encrypted in the browser, uploaded to IPFS (Lighthouse), and accessible only to authorized wallets. No plaintext or metadata is stored on Crosterix servers.


Example 4: Cross-Chain Private Bridge

await crosterix.bridgeAssets({
  fromChainId: 1,
  toChainId: 137,
  fromToken: "0xC02aa...",
  toToken: "0x7ceB0...",
  amount: "500000000000000000", // 0.5 ETH
  stealthMode: true,
});

Result: Assets are bridged from Ethereum → Polygon through Socket or Li.Fi APIs. Funds arrive at a stealth address on the target chain.

Last updated