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

@xend-finance/web-sdk

v0.2.2

Published

![Logo](https://xend.finance/assets-2/logo.svg)

Downloads

10

Readme

Logo

XendFinance SDK

Build applications on-top of the Xend Finance Smart Contract Protocols.

Authors

Installation

Using npm:

npm install @xend-finance/web-sdk

Using yarn:

yarn add @xend-finance/web-sdk

Xend Finance has different saving strategies that helps you save your money in stable currencies;

  • Personal Savings
  • Esusu
  • Cooperative Savings
  • Yield Aggregator(xAuto,xVault)

You can make use of one or all of these strategies

Setup Video

Follow this youtube link for an example of how you can setup this SDK for local development.

Scenario

You can use Xend Finance in as many scenario's you can come up with, but there are 2 examples

  1. Use one general address for all your transactions
  2. Create a new address for each of your users and use for their transactions

Example Personal Flexible Deposit

import XF from '@xend-finance/web-sdk';


const makeDeposit = async () => {
  const { Personal } = await XF(chainId, privateKey, { env:"mainnet" });

  const depositAmount = "100";

  const response = await Personal.flexibleDeposit(depositAmount);

  return response;
}

Example xAuto Deposit

import XF from '@xend-finance/web-sdk';


const makeDeposit = async () => {
  const { xAuto } = await XF(chainId, privateKey, { env:"mainnet" });

  const depositAmount = "100";
  let approval = await xAuto.approve("USDC", depositAmount);

	if (approval && approval.status) {

  const response = await xAuto.deposit("USDC",depositAmount);
  }

  return response;
}

Example xAuto Deposit BNB

import XF from '@xend-finance/web-sdk';


const makeDeposit = async () => {
  const { xAuto } = await XF(chainId, privateKey, { env:"mainnet" });

  const depositAmount = "100";

  const response = await xAuto.depositNative("BNB",depositAmount);

  return response;
}

Withdraw xAuto | xVault

import XF from '@xend-finance/web-sdk';
const withdraw = async () => {
const { xAuto,xVault } = await XF(chainId, privateKey, { env:"mainnet" });

const receiptXauto = await xAuto.withdraw("USDC", totalBUSDAdmount)
const receiptXvault = await xVault.withdraw("BUSD", totalBUSDAdmount)


}

Parameters

These parameters are used to create an instance of any of the saving strategies exported from the SDK

Name | Description --- | --- chainId | Chain ID of the network in use. 56 represents the BSC Mainnet, 1 is for Ethererum Mainnet, 97 is for BSC Testnet privateKey | Private key of address options | Optional

Options

When any of Xend Finance strategy is initialized without options, the SDK defaults to use the addresses for the testnet.

Properties | Values | Description --- | --- | --- env | local, testnet, mainnet | Required protocols | Array of protocols objects | This can only be used when the env is local. protocolName | | Used in the case of multiple protocols available

Note: whenever you use the options argument you have to provide value for the env property even if it is "testnet"

Protocol Type

This is the structure of a protocol to be used by the SDK and will be helpful when using the SDK on your local machine with an instance of tools like ganache.

{
  "name":"",
  "code":"",
  "addresses": {
    "PROTOCOL_ADAPTER": "",
    "PROTOCOL_SERVICE": "",
    "GROUPS": "",
    "CYCLES": "",
    "ESUSU_SERVICE": "",
    "ESUSU_STORAGE": "",
    "ESUSU_ADAPTER": "",
    "COOPERATIVE": "",
    "PERSONAL": "",
    "CLIENT_RECORD": "",
    "XEND_TOKEN": "",
    "TOKEN": "",
    "PROTOCOL_CURRENCY": "",
  }
}

Some Available Methods

General

Name | Parameters | Description --- | --- | --- getClientAddress | | address of account used to initialize SDK apys | | will only return values if you are on mainnet

Personal Savings

Name | Parameters | Description --- | --- | --- flexibleDeposit | depositAmount | fixedDeposit | | fixedInfo | | flexibleInfo | | withdrawFixed | recordId | withdrawFlexible | amount | walletBalance | |

Esusu

Name | Parameters | Description --- | --- | --- create | | walletBalance | |

Cooperative Savings

Name | Parameters | Description --- | --- | --- create | | walletBalance | |

xAuto ,xVault

​​Name | Parameters | Description --- | --- | --- deposit | | withdraw | |

🔗 Social Media Links

gitbook linkedin twitter discord telegram