dsov-utils

SDX Utils

Documentation npm version License npm Prettier

Installation

To install SDX Utils, you need to have Node.js and yarn installed on your system. If you have those, you can install the package via yarn:

yarn add dsov-utils

Usage

Here is a basic example of how to use SDX Utils:

import * as anchor from "@project-serum/anchor";
import { PublicKey } from "@solana/web3.js";
import { client, programTypes } from "dsov-utils";

const sdxClient = new client.SdxClient({
clusterUrl: "https://api.devnet.solana.com",
sdxProgramId: new PublicKey(...),
euroPrimitiveProgramId: new PublicKey(...),
wallet: new anchor.Wallet(...),
idl: programTypes.IDL,
});

// Add Asset Details
const btcAssetDetails = {...};
sdxClient.addAsset(client.AssetType.BTC, btcAssetDetails);

// Deposit as Liquidity Provider
await sdxClient.depositToVault(
client.AssetType.BTC,
new BN(...),
new BN(...)
);

Documentation

We use TypeDoc for generating API documentation. To generate docs, follow these steps:

  1. Install the project dependencies:
yarn install
  1. Generate the docs:
yarn build:docs

The documentation will be generated in the docs directory in the project root.

  1. Deploying the docs:

Our docs are hosted with Netlify as Github Pages doesn't work with private repos. You can use Netlify's Command Line Interface (CLI) to deploy the documentation site. Here's how to do it:

npm install netlify-cli -g   # install Netlify CLI
netlify deploy # create a draft deployment
netlify deploy --prod # create a production deployment

The netlify deploy command will prompt you to provide a publish directory. This should be the docs directory where your built documentation resides.

The first netlify deploy command creates a draft version of your site and provides a draft URL for you to check. If everything looks good on your draft URL, deploy it to your main site URL with the --prod flag using netlify deploy --prod.

Publishing

To build and publish the package, run:

yarn publish

Contributing

We welcome contributions! Please see our Contributing Guide for more details.

Generated using TypeDoc