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

@verislabs/unlockd-sdk

v0.0.11

Published

<p align="center" style="margin-bottom:32px"> <a href="https://unlockd.finance"> <img alt="Unlockd logo" src="https://miro.medium.com/v2/resize:fit:478/1*XczVr9Gw1fm5duTt1IvvYA.png" width="auto" height="92px" /> </a> </p>

Downloads

11

Readme

🗂️ Table of Contents

About

Unlockd is a permissionless RWA liquidity protocol powered by advanced AI, enabling users to participate as depositors or borrowers. It provides a secure and cost-effective way to borrow against tokenized Real-World Assets and financial assets with instant loans and auto-compounding yield for lenders. Built on Ethereum and Polygon with plans for expansion to multiple Layer 2 networks, Unlockd offers a Peer-to-Pool model that ensures efficient and fair lending and borrowing.

The Unlockd SDK allows developers to integrate these RWA-backed borrowing functionalities into their applications. It is particularly useful for Unlockd partners with supported and whitelisted assets, enabling them to offer borrowing against assets or portfolios directly within their interfaces and provide financing options at the point of purchase.

Features

  • Create signatures for:
    • Borrow
    • Repay
    • Bid
    • Redeem
    • Sell now
    • Market calls
  • Calculate:
    • Minimum amount to repay a loan
    • Liquidation price of a loan
    • Health factor of a loan
    • Available amount to action

Browser Support

Chrome | Firefox | Safari | Opera | Edge | IE | --- | --- | --- | --- | --- | --- | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |

Installing

Package manager

Using npm:

$ npm install @verislabs/unlockd-sdk

Using bower:

$ bower install @verislabs/unlockd-sdk

Using yarn:

$ yarn add @verislabs/unlockd-sdk

Using pnpm:

$ pnpm add @verislabs/unlockd-sdk

Example

Fetch prices

import { UnlockdApi} from "@verislabs/unlockd-sdk";

const api= new UnlockdApi()
 const params = {
            "nfts":
                [
                    {
                        "collection": "0x1750d2e6f2fb7fdd6a751833f55007cf76fbb358",
                        "tokenId": "10"
                    }
                ],
            "underlyingAsset": "0x7b79995e5f793a07bc00c21412e50ecae098e7f9"
        }
const response = await api.prices(params.nfts, params.underlyingAsset)

Login

import { UnlockdApi} from "@verislabs/unlockd-sdk";

const api= new UnlockdApi()
const address='0x0000000000000000000000000000000000000000'
const message = await api.signatureMessage(address)
//Sign message from your wallet or with Pk
//...
const signedMessage='...'
const authToken = await api.validateMessage(signedMessage)

Borrow signature

//At least one of the props
import {ActionRequest, UnlockdApi} from "@verislabs/unlockd-sdk";
const api= new UnlockdApi()

const params: ActionRequest = {
  loanId: '0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0',//Optional
  nfts: [{collection: '0x1234567890abcdefABCDEF1234567890abcdefAB', tokenId: 'testTokenId'}]//Optional 
}
const authToken = await api.borrowSignature(authToken, params)

Minimum Repay

import {minimumToRepay} from "@verislabs/unlockd-sdk";

const params = {
    initialLoans: [
        {
            valuation: 10000000n,
            ltv: 5000n,
        },
        {
            valuation: 10000000n,
            ltv: 5000n,
        },
    ],
    indicesToDelete: [1],
    totalDebt: 2n,
}
const result = minimumToRepay(params)

Liquidation price

import {liquidationPrice} from "@verislabs/unlockd-sdk";
const oneEth = BigInt(1e18)

const params = {
    debt: (BigInt(50) * oneEth),
    liquidationThreshold: BigInt(8500)
}
const result = liquidationPrice(params)

Health Factor

import {healthFactor} from "@verislabs/unlockd-sdk";
const oneEth = BigInt(1e18)

const params = {
  collateral: (BigInt(100) * oneEth),
  debt: (BigInt(50) * oneEth),
  liquidationThreshold: BigInt(8500)
}
const result = healthFactor(params)

Available to action

import {availableToBorrow} from "@verislabs/unlockd-sdk";

const nfts = [
  {
    valuation: (BigInt(100) * oneEth).toString(),
    ltv: '5000'
  },
  {
    valuation: (BigInt(50) * oneEth).toString(),
    ltv: '3000'
  }
]

const result = availableToBorrow(nfts)

Keywords

  • RWA
  • Real World Assets
  • Tokenization
  • NFT lending
  • Liquidity pool
  • Blockchain
  • Decentralized Finance
  • DeFi
  • Crypto
  • Permissionless
  • Loans

Publish

  1. Click on releases
  2. Write the changes
  3. Create new Tag
  4. Publish

Built With

  • Typescript
  • Love

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Enric Borrallo - Initial work - eborrallo
  • Alejandro Roige - All the other cool stuff - roigecode

See also the list of contributors who participated in this project.