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

goosefx-ssl-sdk

v1.2.24

Published

SDK for interacting with GooseFX Single-sided Liquidity pools

Downloads

423

Readme

Contents

Trading GooseFX Liquidity Pools

  • Get detailed quotes and make swaps between trading pairs in a GooseFx Pool
  • Check your GooseFX Pool LP token balance and total supply

Installation

Use your environment's package manager to install goosefx-ssl-sdk and other related packages into your project.

yarn add goosefx-ssl-sdk
npm install goosefx-ssl-sdk

Usage

Get Quotes and Price Impact

import { Connection } from "@solana/web3.js";
import { Swap } from "goosefx-ssl-sdk";

const connection = new Connection(
  "https://api.mainnet-beta.solana.com/",
  "finalized"
);

const quote = async () => {
  const swap = new Swap(connection);
  const { out: outAmount, impact } = await swap.getQuote(
    new PublicKey("So11111111111111111111111111111111111111112"), //SOL
    new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), //USD
    1000000n
  );
  console.log(`out: ${outAmount} ${impact}`);
  return { outAmount, impact };
};
quote();

Get Minimum Amount Out and Swap Tokens

import { Connection } from "@solana/web3.js";
import { Swap } from "goosefx-ssl-sdk";

const connection = new Connection(
  "https://api.mainnet-beta.solana.com/",
  "finalized"
);

async function main() {
  const wallet = new Keypair();
  const swap = new Swap(connection);

  const ixs = await swap.createSwapIx(
    new PublicKey("So11111111111111111111111111111111111111112"),
    new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),
    100000n, // 0.0001 SOL
    100n, // 0.0001 USDC
    wallet.publicKey
  );

  let tx = new Transaction();
  for (const ix of ixs) {
    tx.add(ix);
  }

  // Send out the tx use browser wallet or keypair
}

main();

Get Status of the SSL Pool

import { Connection } from "@solana/web3.js";
import { SSL, ADDRESSES } from "goosefx-ssl-sdk";
import { NATIVE_MINT } from "@solana/spl-token";

const connection = new Connection(
  "https://api.mainnet-beta.solana.com/",
  "finalized"
);

//get the pool status for SOl native token
async function getSolPoolStatus() {
  const ssl = (await SSL.loadByMint(
    connection,
    ADDRESSES["MAINNET"].GFX_CONTROLLER,
    NATIVE_MINT
  ))!;
  const isSuspended = ssl.suspended;
  return isSuspended;
  // interprete the meaning from this: if true, the pool have been suspended and all txns to it will fail, if false the pool is active
}

getSolPoolStatus();

Build

yarn build: this will output the bundled js in the dist folder.

Technical Notes

Stability of the Functions

We hope you find the tools we used to build our API useful in the ts/src folder. Due to our on-going development of the GooseFX platform api, we cannot guarantee the stability of the SDK swap beyond 1 SOL. The SDK will be updated in later version to increase the compute units.

Support

Integration Questions

Have problems integrating with the SDK? Pop by over to our Discord #general channel and chat with one of our engineers.

Issues / Bugs

If you found a bug, open up an issue on github with the prefix ISSUE. To help us be more effective in resolving the problem, be specific in the steps it took to reproduce the problem (ex. when did the issue occur, code samples, debug logs etc).

Feedback

Got ideas on how to improve the system? Open up an issue on github with the prefix [FEEDBACK] and let's brainstorm more about it together!

Addresses

Devnet

CONTROLLER_PROGRAM=3Gwyhoudx8XgYry8dzKQ2GGsofkUdm7VZUvddHxchL3x
SSL_PROGRAM=JYe7AcuQ7CqhkGvchJGvSKF8ei41FuDKb1h47qkbFNf
CONTROLLER=ApkmzBaTPUAeVj3QuqDcz6iLE6xZSLd29nke4McqrKw5

Mainnet

CONTROLLER_PROGRAM=8KJx48PYGHVC9fxzRRtYp4x4CM2HyYCm2EjVuAP4vvrx
SSL_PROGRAM=7WduLbRfYhTJktjLw5FDEyrqoEv61aTTCuGAetgLjzN5
CONTROLLER=8CxKnuJeoeQXFwiG6XiGY2akBjvJA5k3bE52BfnuEmNQ

License

MIT