@raccoonsdev/goatswap-sdk
v0.0.1-76b25b3.0
Published
Use `createReadonlyProgram` or `createProgram` to get an anchor `Program<Goatswap>` to interact with the Goatswap program.
Downloads
6
Readme
@raccoonsdev/goatswap-sdk
Use createReadonlyProgram or createProgram to get an anchor Program<Goatswap> to interact with the Goatswap program.
import { createProgram } from '@raccoonsdev/goatswap-sdk';
import { NodeWallet } from '@project-serum/anchor';
// ... Load your @solana/web3.js keypair
const nodeWallet = new NodeWallet(keypair);
const provider = new AnchorProvider(connection, anchorWallet, {});
const program = createProgram(anchorProvider);Program methods
initializePairInitialize a pairdeposit/withdrawmanage the lamports stored in the pair authority of a pair your owndepositNft/withdrawNftmanage the NFTs in a pair you ownswapNftForTokenSell a NFT to a pair for SOLswapTokenForNftBuy a NFT from a pair for SOL
Helpers
getPairMetasForCollection uses getProgramAccounts to find all the pairs for a given collection and fetches all the associated pair lamports and NFTs
pairMetasIntoOrderBooks Transform the pairs given their available liquidities into Asks and Bids orders, to allow order book like visualization
