open-index/open-npm huggingface dataset:
npm package: @hubbleprotocol/distributor
Description: Distributor SDK
Author: Kamino Finance
Latest version: 0.1.4
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Distributor SDK

Distributor SDK is a TypeScript client SDK used to interact with the distributor contract

## How to install the SDK

[![npm](https://img.shields.io/npm/v/@hubbleprotocol/distributor-sdk)](https://www.npmjs.com/package/@hubbleprotocol/distributor-sdk)

```shell
yarn add @hubbleprotocol/distributor-sdk
```

```shell
yarn update @hubbleprotocol/distributor-sdk
```

## How to use the SDK

```typescript
// Initialize the client and then you can use it to fetch data by calling it
const distributorClient = new Distributor(env.provider.connection);

// To check wether tokens are claimable 
// merkleDistributorPublicKey - should be taken from the api
const isClaimable = await distributorClient.isClaimable(merkleDistributorPublicKey);

// To check wether tokens have been already claimed or not for a specific user
// merkleDistributorPublicKey - should be taken from the api
// userAddress - the address that is claiming
const userClaimed = await distributorClient.userClaimed(merkleDistributorPublicKey, userAddress);

// To get a new claim ixn - this includes the ATA creation ixn if it's needed
// merkleDistributorPublicKey - should be taken from the api
// userAddress - the address that is claiming
// amountLamports - should be taken from the api (it has to match the value from the api - can't do partial claim)
// proof - should be taken from the api
const newClaimIxn = await distributorClient.getNewClaimIx(merkleDistributorPublicKey, userAddress, amountLamports, proof);
```
npm package: @hubbleprotocol/farms-sdk
Description: Farms SDK
Author: Hubble Protocol
Latest version: 1.0.3
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Farms SDK

Farms SDK is a TypeScript client SDK for easy access to the Farms on-chain data.

## How to install the SDK

[![npm](https://img.shields.io/npm/v/@hubbleprotocol/farms-sdk)](https://www.npmjs.com/package/@hubbleprotocol/farms-sdk)

```shell
npm install @solana/web3.js decimal.js @hubbleprotocol/farms-sdk
```

```shell
npm update @hubbleprotocol/farms-sdk
```

## How to use the SDK

```typescript
// Initialize the client and then you can use it to fetch data by calling it
const farmsClient = new Farms(env.provider.connection);
```
npm package: @hubbleprotocol/hubble-config
Description: Hubble Protocol configuration
Author: Hubble Protocol
Latest version: 8.0.0

# Hubble Config

Hubble config is a public registry/configuration with Solana public keys that are used by the [Hubble Protocol](https://hubbleprotocol.io).

## Install

[![npm](https://img.shields.io/npm/v/@hubbleprotocol/hubble-config)](https://www.npmjs.com/package/@hubbleprotocol/hubble-config)

```shell
npm install @hubbleprotocol/hubble-config
```

## Usage

```js
// For ESM
import { getAllConfigs, getConfigByEnv } from "@hubbleprotocol/hubble-config";

// For CommonJS
const config = require("@hubbleprotocol/hubble-config");

// Get all configs: mainnet-beta, devnet, localnet, testnet configs
const configs = getAllConfigs();

// Get config by solana environment:
const mainnetConfig = getConfigByEnv('mainnet-beta');
const devnetConfig = getConfigByEnv('devnet');
```
npm package: @hubbleprotocol/hubble-db
Description: Hubble Protocol database models
Author: Hubble Protocol
Latest version: 8.0.0

# Hubble Database

The Hubble database project contains common database models used across multiple npm projects.

## Install

[![npm](https://img.shields.io/npm/v/@hubbleprotocol/hubble-db)](https://www.npmjs.com/package/@hubbleprotocol/hubble-db)

```shell
npm install @hubbleprotocol/hubble-db
```
npm package: @hubbleprotocol/hubble-idl
Description: Hubble Protocol IDL (Interface Description Language)
Author: Hubble Protocol
Latest version: 6.0.1
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Hubble IDL

Hubble IDL (Interface Description Language) is a package that contains the IDLs of Hubble on-chain programs used on Solana.
The IDL can be used to generate a client to speak to Hubble on-chain programs.
The IDL is generated by [Anchor](https://coral-xyz.github.io/anchor/).

## Install

[![npm](https://img.shields.io/npm/v/@hubbleprotocol/hubble-idl)](https://www.npmjs.com/package/@hubbleprotocol/hubble-idl)

```shell
npm install @hubbleprotocol/hubble-idl
```

## Usage

Import borrowing IDL JSON to your project:

```js
// For ESM
import { BORROWING_IDL } from "@hubbleprotocol/hubble-idl";

// For CommonJS
const config = require("@hubbleprotocol/hubble-config"); //config.BORROWING_IDL
```

### Example: get borrowing market state

Dependencies required:

- `@coral-xyz/anchor`,
- `@solana/web3.js`,
- `@hubbleprotocol/hubble-config`.

Use borrowing IDL with Anchor to get the borrowing market state (using readonly wallet):

```js
import { Connection, Keypair, PublicKey, clusterApiUrl } from '@solana/web3.js';
import { Idl, Program, AnchorProvider } from '@coral-xyz/anchor';
import { BORROWING_IDL } from '@hubbleprotocol/hubble-idl';
import { getConfigByEnv } from '@hubbleprotocol/hubble-config';

const mainnetConfig = getConfigByEnv('mainnet-beta');
const connection = new Connection(clusterApiUrl('mainnet-beta'));
const provider = new AnchorProvider(
  connection,
  {
    publicKey: Keypair.generate().publicKey,
    signAllTransactions: async (txs) => txs,
    signTransaction: async (txs) => txs,
  },
  { commitment: 'confirmed' }
);
const program = new Program(BORROWING_IDL, mainnetConfig.borrowing.programId, provider);

// get borrowing market state with Anchor
const state = await program.account.borrowingMarketState.fetch(mainnetConfig.borrowing.accounts.borrowingMarketState);
```