Getting Started

Configuration

npm install @deltadefi-protocol/[email protected]

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: 0,
  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("preprod");
const swapIntentTx = new SwapIntentTx(config);

Create Swap Intent

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

circle-exclamation

Cancel Swap Intent

Cancel an existing swap intent and reclaim locked assets.

circle-exclamation

Open Source

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

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

Supported Pairs

  • ADAUSDM

  • NIGHTUSDM

Last updated