npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@raft-fi/sdk

v0.6.4

Published

Raft Protocol SDK

Downloads

116

Readme

Raft SDK

npm (tag) CI Tests npm bundle size (version) npm (downloads)

Raft is an immutable, decentralized lending protocol that allows people to take out stablecoin loans against capital-efficient collateral.

R is the first Ethereum USD stablecoin solely backed by stETH (Lido Staked Ether). R provides the most capital-efficient way to borrow using your stETH. R aims to be the stablecoin of choice within the decentralized ecosystem, with deep liquidity across many trading pairs and a stable peg.

This repository contains the Raft SDK: a TypeScript-based library that provides a set of utilities for building applications using the Raft protocol. It abstracts away the complexity of interacting with the Raft smart contracts, and provides a simple interface for interacting with the protocol.

Quick Start

First of all, install the SDK:

npm install @raft-fi/sdk
# or
yarn add @raft-fi/sdk

Opening a position in Raft is as simple as the following:

import { Decimal } from '@tempusfinance/decimal';
import { UserPosition } from '@raft-fi/sdk';
import { Signer } from 'ethers';

async function main() {
  const signer = new Signer(...);
  const position = new UserPosition(signer);
  await position.open(new Decimal(4.2), new Decimal(3000));
}

Closing the position is just as easy:

await position.close();

Although the SDK is designed to be as simple as possible, it requires a bit of configuration before use. The main point of configuration is the RaftConfig class, where the consumer can specify the network to use (either Mainnet or Goerli) as well as the URL of the subgraph endpoint (e.g. our official subgraph):

import { RaftConfig } from '@raft-fi/sdk';

RaftConfig.setNetwork('mainnet');
RaftConfig.setSubgraphEndpoint(
  'https://gateway.thegraph.com/api/<api-key>/subgraphs/id/93YgGPdoraNcpG6531Jo3KqTcrmQ4BR4Ny9MfkH49NLX',
);

Getting Started

Prerequisites

To build and test the Raft SDK, you will need the following:

Installation

Clone the repository and install the dependencies via NPM:

npm install

Building

To build the SDK, run the following command:

npm run build

Testing

To run the tests, run the following command:

npm run test

The CI testing requires a local mainnet instance to be running on port 8545. To start the instance, download Foundry and run the following command:

ANVIL_FORK_URL=<RPC URL> ANVIL_BLOCK_NUMBER=<block number> npm run anvil

Community

Check out the following places for more Raft-related information and support:

License

The Raft SDK is licensed under the MIT License.