@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
| | | | | | --- | --- | --- | --- | --- | --- | 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
- Click on releases
- Write the changes
- Create new Tag
- Publish
Built With
- Typescript
- Love
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
See also the list of contributors who participated in this project.