For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started

Configuration

npm install @deltadefi-protocol/khor@1.1.1

Obtain constants for creating transactions

import { BlockfrostProvider, MeshWallet } from "@meshsdk/core";
import { KhorConstants, SwapIntentTx } from "@deltadefi-protocol/khor";

// Setup
const blockfrost = new BlockfrostProvider("YOUR_BLOCKFROST_API_KEY");
const wallet = new MeshWallet({
  networkId: 1,
  fetcher: blockfrost,
  submitter: blockfrost,
  key: { type: "mnemonic", words: "your 24 words here".split(" ") },
});

// Get all required variables
const userAddress = await wallet.getChangeAddress();
const utxos = await wallet.getUtxos();
const collateral = (await wallet.getCollateral())[0];

// Create swap intent
const config = new KhorConstants("mainnet");
const swapIntentTx = new SwapIntentTx(config);

Create Swap Intent

Create a new swap intent to place a limit order on L1.

Cancel Swap Intent

Cancel an existing swap intent and reclaim locked assets.

Open Source

The full Aiken contract that processed the swap and its off-chain SDK can be accessed at https://github.com/deltadefi-protocol/khor.

Network parameters and constants can also be found in the SDK.

Supported Pairs

  • ADAUSDCx

  • ADAUSDM

  • NIGHTUSDM

  • ADANIGHT

Last updated