Quick start

1) SDK

cd packages/sdk-ts
npm i
npm run build

Use in Node/Next:

import { Splenex } from "@splenex/sdk";

const splenex = new Splenex("http://localhost:4000");

// quote
const quote = await splenex.quoteSwap({
  fromChain: "Ethereum",
  toChain:  "Solana",
  tokenIn:  "ETH",
  tokenOut: "SOL",
  amount:   "1.0",
  slippageBps: 50
});

// execute
const tx = await splenex.executeSwap({
  ...quote,
  fromChain: "Ethereum",
  toChain: "Solana",
  tokenIn: "ETH",
  tokenOut: "SOL",
  amount: "1.0",
  routeId: quote.routeId,
  recipient: "0xYourAddress"
});

// status
const status = await splenex.getTx(tx.id);

// stream
const ws = splenex.subscribe(console.log);

2) Contracts (Hardhat)

cd contracts
npm i
npx hardhat compile
# configure RPC + PK in your .env, then:
npx hardhat run scripts/deploy.ts --network <network>

Last updated