0.6.4 • Published 6 months ago

@raft-fi/sdk v0.6.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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.

0.5.4

8 months ago

0.5.3

9 months ago

0.5.5

8 months ago

0.5.0

10 months ago

0.5.2

10 months ago

0.5.1

10 months ago

0.6.3

7 months ago

0.6.2

7 months ago

0.6.4

6 months ago

0.6.1

7 months ago

0.6.0

8 months ago

0.4.9

11 months ago

0.4.8

11 months ago

0.4.10

11 months ago

0.4.11

11 months ago

0.4.12

11 months ago

0.4.7

11 months ago

0.4.5

11 months ago

0.4.4

11 months ago

0.4.3

11 months ago

0.4.2

11 months ago

0.4.1

11 months ago

0.4.0

11 months ago

0.3.11

11 months ago

0.3.10

11 months ago

0.3.9

11 months ago

0.3.8

11 months ago

0.3.7

11 months ago

0.3.6

11 months ago

0.3.5

11 months ago

0.3.4

11 months ago

0.3.3

11 months ago

0.3.2

11 months ago

0.3.1

11 months ago

0.3.0

11 months ago

0.2.22

11 months ago

0.2.21

11 months ago

0.2.20

11 months ago

0.2.19

11 months ago

0.2.18

11 months ago

0.2.17

11 months ago

0.2.16

11 months ago

0.2.15

11 months ago

0.2.14

12 months ago

0.2.13

12 months ago

0.2.12

12 months ago

0.2.11

12 months ago

0.2.10

12 months ago

0.2.9

12 months ago

0.2.8

12 months ago

0.2.7

12 months ago

0.2.6

12 months ago

0.2.5

12 months ago

0.2.4

12 months ago

0.2.3

12 months ago

0.2.2

12 months ago

0.2.0

12 months ago

0.1.8

12 months ago

0.1.7

12 months ago

0.1.6

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago