open-index/open-npm huggingface dataset:
npm package: @raccoonsdev/goatswap-sdk
Description: Use `createReadonlyProgram` or `createProgram` to get an anchor `Program<Goatswap>` to interact with the Goatswap program.
Latest version: 0.0.1-76b25b3.0

# @raccoonsdev/goatswap-sdk

Use `createReadonlyProgram` or `createProgram` to get an anchor `Program<Goatswap>` to interact with the Goatswap program.

```typescript
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

- `initializePair` Initialize a pair
- `deposit` / `withdraw` manage the lamports stored in the pair authority of a pair your own
- `depositNft` / `withdrawNft` manage the NFTs in a pair you own
- `swapNftForToken` Sell a NFT to a pair for SOL
- `swapTokenForNft` Buy 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