npm package: @smartcredit/client-sdk
Description: Smarcredit client sdk
Latest version: 1.1.7

## Introduction

SmartCredit.io is a peer-to-peer marketplace for borrowers and lenders. It works as follows:

- Borrowers define their loan requests with [Credit Lines](https://learn.smartcredit.io/integrations/sdk-integrations/borrowing-sdk/credit-line).
- Lenders define their personal [Fixed-Income Funds](https://learn.smartcredit.io/how-does-it-work/fixed-income-funds).
- SmartCredit.io does the **matching** between the borrowers’ and lenders’ requests.

Most borrowing/lending platforms offer variable-rate, variable-term loans for borrowers. SmartCredit.io focuses on the real economy—it offers **fixed interest rates** and **fixed terms** for borrowers.

SmartCredit.io’s focus is on:

- **Fixed-term/Fixed-interest** loans for borrowers with [Credit Lines](https://learn.smartcredit.io/integrations/sdk-integrations/borrowing-sdk/credit-line).
- **DeFI [Fixed-Income Funds](https://learn.smartcredit.io/how-does-it-work/fixed-income-funds) for lenders—lenders** define into which maturities they want to invest. 

Why do we need a fixed interest rate? Because the **real economy works based on predictability**. It’s about knowing the costs of capital in advance. Or it’s about knowing the value of your liabilities.

Lenders define their personal DeFi [Fixed-Income Funds](https://learn.smartcredit.io/how-does-it-work/fixed-income-funds) in SmartCredit.io. They define what kind of loans they want to invest in and describe their investment rules. Every lender can choose if they prefer short-term lending strategies (with less interest) or long-term lending strategies (with more interest). Every lender can define how much of their portfolio to invest in the shorter-term and/or longer-term.

Borrowers define their [collateralized](https://learn.smartcredit.io/how-does-it-work/collaterals) loan requests within the [Credit Lines](https://learn.smartcredit.io/integrations/sdk-integrations/borrowing-sdk/credit-line). Concrete [collateral ratio](https://learn.smartcredit.io/integrations/sdk-integrations/borrowing-sdk/collateral-ratio) depends on the volatility of the collateral asset, on the [loan term](https://learn.smartcredit.io/how-does-it-work/loan-term) and on the [trust score](https://learn.smartcredit.io/how-does-it-work/trust-score) of the borrower. The [interest rate](https://learn.smartcredit.io/how-does-it-work/interest-rates) curves are predefined. Concrete interest rate depends on the underlying asset, on the loan term and trust score.

SmartCredit.io does in the background **automated matching of borrowers’ loan requests with lenders’ fixed-income funds**. 

SmartCredit.io monitors the loan, and if the borrower does not pay or the borrower’s collateral value sinks too much, the loan is [liquidated](https://learn.smartcredit.io/how-does-it-work/liquidations). The borrowers collateral assets in the smart contracts are protected with the [oracles](https://learn.smartcredit.io/how-does-it-work/oracles) - liquidation process starts only after the oracle will confirm the liquidation.

**SmartCredit.io never earns on [liquidations](https://learn.smartcredit.io/how-does-it-work/liquidations)**—what remains from the liquidation are transferred back to the borrower. This is one of the key differences from our competitors (Aave, Compound, and Maker). Our competitors earn revenue while liquidating the under-collateralized borrower because the collateral is sold at a discount, and the remainder of the collateral value becomes the profit of liquidator bots. Most of these bots are hosted by the respective platforms, and liquidation revenues transfer into the platform revenues; in some months, even 50% of the respective platforms’ revenues. 

In case the collateral does not cover the borrower's obligations, the [Loss-Provision Fund](https://learn.smartcredit.io/how-does-it-work/loss-provision-fund) will pay the gap to the lender.

And from [regulations](https://learn.smartcredit.io/regulations) point of view: 

- SmartCredit.io is not pooling client assets; it's pure [peer-to-peer play](https://learn.smartcredit.io/regulations/peer-to-peer-business-models). Therefore, it does not need to register as a security.
- Our competitors have implemented the [peer-to-pool-to-peer](https://learn.smartcredit.io/regulations/peer-to-pool-to-peer-business-models) business models, then they will need to register as a security (and they will probably never get this registration).

## Usage

Install SmartCredit.io SDK using [npm](https://www.npmjs.com/package/@smartcredit/client-sdk):

`npm i @smartcredit/client-sdk`

## Initialize Borrowing SDK

The basic initialization for integrating the Borrowing SDK will look like this:

```js
import { NewBorrowingService } from '@smartcredit/client-sdk';

public newBorrowingService;

this.injectedProvider = (window as any).ethereum;
this.newBorrowingService = new NewBorrowingService({
    web3Provider: new Web3(this.injectedProvider),
    env: "prod" or "beta" // Prod inluceds production config and Beta includes test config with ropsten network
});
```

## Initialize Lending SDK

The basic initialization for integrating the lending Widget will look like this:

```js
import {  LendingService } from '@smartcredit/client-sdk';

public LendingService;

this.injectedProvider = (window as any).ethereum;
this.LendingService = new NewBorrowingService({
    web3Provider: new Web3(this.injectedProvider),
    env: "prod" or "beta" // Prod inluceds production config and Beta includes test config with ropsten network
});
```

## Documentation 

Check the [GitBook](https://www.learn.smartcredit.io) on how to integrate [both widgets](https://learn.smartcredit.io/integrations/sdk-integrations) function by function.

## Further info

- [Application](https://app.smartcredit.io) https://appv2.smartcredit.io
- [Medium](https://medium.com/smartcredit-io) https://medium.com/smartcredit-io)
- [Twitter](https://twitter.com/Smartcredit_io) https://twitter.com/Smartcredit_io
- [Telegram](https://t.me/SmartCredit_Community) https://t.me/SmartCredit_Community
- [Website](https://smartcredit.io/) https://smartcredit.io/