@quartz-labs/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.19.6 • Public • Published
Pyra

Pyra SDK

Typescript SDK for interacting with the Pyra Protocol.

Install using:

yarn add @quartz-labs/sdk
# or
npm install @quartz-labs/sdk

There is currently an issue with dependency resolutions, so add the following to your package.json to fix:

"resolutions": {
  "rpc-websockets": "9.0.4",
  "@solana/web3.js": "1.98.0"
}

If you want to use this SDK in a front-end, note that some Node modules don't work in the browser. Because of this, you'll normally want to import the SDK in your client side code like this:

import * from "@quartz-labs/sdk/browser";

Server-side code can still be imported without the /browser path at the end, but you may need to set up your config so your web app doesn't try to bundle the problematic Node modules with the and client side code.

Basic setup

Create a Quartz Client with:

import { QuartzClient } from "@quartz-labs/sdk";
import { Connection } from "@solana/web3.js";

const connection = new Connection("https://api.mainnet-beta.solana.com");
const client = QuartzClient.fetchClient(connection);

The majority of this SDK can then be accessed through the client, eg:

import { LAMPORTS_PER_SOL } from "@solana/web3.js";

const depositApy = client.getDepositRate(marketIndex);
const createAccountInstructions = client.makeInitQuartzUserIxs(address);

const user = client.getQuartzAccount(address);
const health = user.getHealth();
const stablecoinBalances = user.getMultipleTokenBalances(stablecoinIndices);
const depositInstructions = user.makeDepositIx(
  LAMPORTS_PER_SOL,
  marketIndexSol,
  true // true = can change position from loan <-> collateral, false = will limit amount deposited to prevent this
);

Links

Website: pyra.fi

Docs: docs.pyra.fi

X: @GetPyra

Discord: discord.gg/GetPyra

Contact: diego@pyra.fi

Package Sidebar

Install

npm i @quartz-labs/sdk

Weekly Downloads

140

Version

0.19.6

License

MIT

Unpacked Size

529 kB

Total Files

93

Last publish

Collaborators

  • quartz-labs