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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@neptuneprotocol/neptune-sdk

v0.0.73

Published

* `src` has two new directories within it: `token-lending` holds code to interact with the token lending program and `timelock` has code to interact with the timelock staking program. * code to interact with the timelock staking program lives in `src/time

Readme

What's new in this SDK version?

  • src has two new directories within it: token-lending holds code to interact with the token lending program and timelock has code to interact with the timelock staking program.
  • code to interact with the timelock staking program lives in src/timelock/actions. initializeLock will initialize a lock action, and initializeUnlock will initialize an unlock action.
  • both initializeLock and initializeUnlock will build and send the transactions needed for lock and unlock staking actions. They will both return the signatures of the transactions as a string. initializeLock may need to send multiple transactions.
  • Both initializeLock and initializeUnlock require a keypair, and the sendTransaction function generated by the wallet provider. initializeLock also requires the amount of tokens to lock in lamports and the yearsToLock the tokens in the form of a number. If a user locks tokens for 6 months, then yearsToLock equals 0.5. If a user locks tokens for 24 months, then yearsToLock equals 2.0.
  • there are new data points in the reserve data structure for baseRewardAprDeposits and baseRewardAprBorrows. This is the base APR a user receives for depositing or borrowing tokens with zero voting power expressed as a percentage. To calculate the APR a user receives with a full multiplier, multiply this value by 3.
  • there are new data points in the obligation data structure. obligation.obligationStats now has a field for netApy to calculate a user's net APY for their deposit and borrow positions. The obligation data structure also has a new field for neptuneStats that holds a user's multiplier, their current votingPower, their amount of lockedNeptune and their claimableRewards.

Got a basic webserver working with the Neptune SDK

New code is within the src/classes directory. The new files are server.ts, utils.ts, constant.ts and the routes directory.

First install dependancies with yarn and set solana config to devnet

Next, fill in the USER_PK and USER_SK values in the constant.ts file to your public key string and the uint8 array of your devnet wallet.

Run the script to generate a deposit transaction with ts-node scripts/testDeposit.ts.

The script is dependant on the API_ENDPOINT constant defined in src/classes/action.ts. It is currently set to the Neptune Devnet endpoint. We can change it to the API that we've created (http://neptune-finance-api.herokuapp.com/info) but this one currently returns Neptune account info from PRD, and will cause transactions to fail on devnet if used.


Quickstart examples

See the examples in the scripts folder for examples of how to configure the following types of transactions:

  1. Deposit
  2. Borrow
  3. Repay
  4. Withdraw

The following example illustrates how to set up a transaction that will deposit 2 SOL into our lending protocol, and then borrows 1 SOL from that deposited collateral

Private Key Storage (UNIX):

  • You can store your wallets private key as an environment variable in your .bashrc file (this keeps it as permanent storage every time you boot up your UNIX instance)
  • Do this:
    1. Go to your root directory of your UNIX instance, run vi ~/bash.rc
    2. Now go to the bottom of this file using your arrow keys, then press i to insert
    3. Now enter: export PRIVATE_KEY=insert byte array of private key here
    4. Now enter: export PUBLIC_KEY=insert string of public key here
    5. Press ESC then :wq
import {NeptuneAction} from '../src/classes/action'
import {
  Connection,
  clusterApiUrl, 
} from "@solana/web3.js";
import {sendTransaction} from './utils'

const dotenv = require('dotenv');
dotenv.config();
const USER_SK = process.env.PRIVATE_KEY
const USER_PK = process.env.PUBLIC_KEY

const tryDeposit = async () => {
  const conn = new Connection(clusterApiUrl('devnet'), 'confirmed');
  try {
    //build instructions for a deposit transaction
    const depositAction = await NeptuneAction.buildDepositTxns(
      conn,
      "2000000000", //note, amount is in lamports for transactions in SOL
      "SOL",
      USER_PK,
      "devnet"
    )

    //send the transaction to the blockchain. 
    const sig = await depositAction.sendTransactions(sendTransaction)
    console.log("Deposit signature", sig)
  } catch(err: any) {
    console.log(err.message)
  }
}

const tryBorrow = async () => {
  const conn = new Connection(clusterApiUrl('devnet'), 'confirmed');
  try {
    //build instructions for a deposit transaction
    const borrowAction = await NeptuneAction.buildBorrowTxns(
      conn,
      "1000000000", //note, amount is in lamports for transactions in SOL
      "SOL",
      USER_PK,
      "devnet"
    )

    //send the transaction to the blockchain. 
    const sig = await borrowAction.sendTransactions(sendTransaction)
    console.log("Borrow signature", sig)
  } catch(err: any) {
    console.log(err.message)
  }
}

tryDeposit();
tryBorrow();