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

gho-st-sdk

v0.1.7

Published

The GHO-ST SDK simplifies interactions with the Aave protocol, providing functions for common actions like supplying funds.

Downloads

21

Readme

Overview

The GHO-ST SDK simplifies interactions with the Aave protocol, providing functions for common actions like supplying funds.

Installation

To use the GHO-ST SDK in your project, install it via npm:

npm install gho-st-sdk

To use the GHO-ST SDK in your project, install it via yarn:

yarn add gho-st-sdk

Supply

Usage

This function allows users to supply funds to a aave reserve.

Parameters

  • user (string): User's Ethereum address.
  • reserve (string): Address of the reserve for fund supply.
  • amount (string): Amount to be supplied.
  • onBehalfOf (string): Address on behalf of which funds will be supplied.
  • provider (ethers.providers.Web3Provider): Ethereum provider.
  • signer (ethers.Signer): Ethereum signer.

Example

import { supply } from "gho-st-sdk";
import { ethers, Signer } from "ethers";

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer: Signer = provider.getSigner();

await supply({
  user: "0xxxxxxxxxxx",
  reserve: "0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8", // USDC address
  amount: "100", // Supplying 100 USDC to aave
  onBehalfOf: "0xxxxxxxxxx",
  provider,
  signer,
});

Borrow

Usage

This function allows users to borrow funds from a aave .

Parameters

  • user (string): User's Ethereum address.
  • reserve (string): Address of the reserve for fund borrowing.
  • amount (string): Amount to be borrowed.
  • interestRateMode (InterestRate): Interest rate mode for the borrow operation. It can be( Variable | Stable)
  • onBehalfOf (string): Address on behalf of which funds will be borrowed.
  • provider (ethers.providers.Web3Provider): Ethereum provider.
  • signer (ethers.Signer): Ethereum signer.

Example

import { borrow } from "gho-st-sdk";
import { ethers, Signer, InterestRate } from "ethers";
import { InterestRate } from "@aave/contract-helpers";
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer: Signer = provider.getSigner();

await borrow({
  user: "0xxxxxxxxxxx",
  reserve: "0xc4bF5CbDaBE595361438F8c6a187bDc330539c60", //Gho contract address for sepolia;
  amount: "100", // 100 GHO token is borrowed
  interestRateMode: InterestRate.Variable,
  onBehalfOf: "0xxxxxxxxxxxxxxxx",
  provider,
  signer,
});

Withdraw

Usage

This function allows users to withdraw funds from an Aave reserve.

Parameters

  • user (string): User's Ethereum address.
  • reserve (string): Address of the reserve for fund withdrawal.
  • amount (string): Amount to be withdrawn.
  • aTokenAddress (string): Address of the corresponding aToken for the reserve.
  • onBehalfOf (string): Address on behalf of which funds will be withdrawn.
  • provider (ethers.providers.Web3Provider): Ethereum provider.
  • signer (ethers.Signer): Ethereum signer.

Example

import { withdraw } from "gho-st-sdk";
import { ethers, Signer } from "ethers";

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer: Signer = provider.getSigner();

await withdraw({
  user: "0xxxxxxxxxxx",
  reserve: "0xf8Fb3713D459D7C1018BD0A49D19b4C44290EBE5", // Example reserve address
  amount: "50", // Withdrawing 50 units of the reserve
  aTokenAddress: "0x3FfAf50D4F4E96eB78f2407c090b72e86eCaed24", // Example aToken address
  onBehalfOf: "0xxxxxxxxxx",
  provider,
  signer,
});

Repay

Usage

This function allows users to repay borrowed funds on an Aave reserve.

Parameters

  • user (string): User's Ethereum address.
  • reserve (string): Address of the reserve for fund repayment.
  • amount (string): Amount to be repaid.
  • interestRateMode (enum): Interest rate mode for repayment (e.g., InterestRate.Variable).
  • onBehalfOf (string): Address on behalf of which funds will be repaid.
  • provider (ethers.providers.Web3Provider): Ethereum provider.
  • signer (ethers.Signer): Ethereum signer.

Example

import { Repay, InterestRate } from "gho-st-sdk";
import { ethers, Signer } from "ethers";

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer: Signer = provider.getSigner();

await Repay({
  user: "0xxxxxxxxxxx",
  reserve: "0xc4bF5CbDaBE595361438F8c6a187bDc330539c60", // Example reserve address
  amount: "50", // Repaying 50 units of the reserve
  interestRateMode: InterestRate.Variable,
  onBehalfOf: "0xxxxxxxxxx",
  provider,
  signer,
});

SupplyWithSignature

Usage

This function allows users to supply funds to a aave reserve with additional signature signed by the user

Parameters

  • user (string): User's Ethereum address.
  • reserve (string): Address of the reserve for fund supply.
  • amount (string): Amount to be supplied.
  • onBehalfOf (string): Address on behalf of which funds will be supplied.
  • provider (ethers.providers.Web3Provider): Ethereum provider.
  • signer (ethers.Signer): Ethereum signer.

Example

import { supplyWithSign } from "gho-st-sdk";
import { ethers, Signer } from "ethers";

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer: Signer = provider.getSigner();

await supplyWithSign({
  user: "0xxxxxxxxxxx",
  reserve: "0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8", // USDC address
  amount: "100", // Supplying 100 USDC to aave
  onBehalfOf: "0xxxxxxxxxx",
  provider,
  signer,
});

Repay With Signature

Usage

This function allows users to repay borrowed funds on an Aave reserve with additional signature signed by the user.

Parameters

  • user (string): User's Ethereum address.
  • reserve (string): Address of the reserve for fund repayment.
  • amount (string): Amount to be repaid.
  • interestRateMode (enum): Interest rate mode for repayment (e.g., InterestRate.Variable).
  • onBehalfOf (string): Address on behalf of which funds will be repaid.
  • provider (ethers.providers.Web3Provider): Ethereum provider.
  • signer (ethers.Signer): Ethereum signer.

Example

import { repayWithSign, InterestRate } from "gho-st-sdk";
import { ethers, Signer } from "ethers";

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer: Signer = provider.getSigner();

await repayWithSign({
  user: "0xxxxxxxxxxx",
  reserve: "0xc4bF5CbDaBE595361438F8c6a187bDc330539c60", // Example reserve address
  amount: "50", // Repaying 50 units of the reserve
  interestRateMode: InterestRate.Variable,
  onBehalfOf: "0xxxxxxxxxx",
  provider,
  signer,
});

RepayWithaToken

Usage

This function allows users to repay borrowed funds on an Aave reserve with the aave tokens you recieved while supplying the tokens .

Parameters

  • user (string): User's Ethereum address.
  • reserve (string): Address of the reserve for fund repayment.
  • amount (string): Amount to be repaid.
  • interestRateMode (enum): Interest rate mode for repayment (e.g., InterestRate.Variable).
  • provider (ethers.providers.Web3Provider): Ethereum provider.
  • signer (ethers.Signer): Ethereum signer.

Example

import { repayWithaToken, InterestRate } from "gho-st-sdk";
import { ethers, Signer } from "ethers";

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer: Signer = provider.getSigner();

await repayWithaToken({
  user: "0xxxxxxxxxxx",
  reserve: "0xc4bF5CbDaBE595361438F8c6a187bDc330539c60", // Example reserve address
  amount: "50", // Repaying 50 units of the reserve
  interestRateMode: InterestRate.Variable,
  provider,
  signer,
});