5.0.4 • Published 2 months ago

@hubbleprotocol/hubble-idl v5.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 months ago

Hubble IDL

Hubble IDL (Interface Description Language) is a package that contains the IDLs of Hubble on-chain programs used on Solana (Hubble borrowing, Kamino and Scope programs supported). The IDL can be used to generate a client to speak to Hubble on-chain programs. The IDL is generated by Anchor.

Install

npm

npm install @hubbleprotocol/hubble-idl

Usage

Import borrowing IDL JSON to your project:

// For ESM
import { BORROWING_IDL, SCOPE_IDL, KAMINO_IDL } from "@hubbleprotocol/hubble-idl";

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

Example: get borrowing market state

Dependencies required:

  • @project-serum/anchor,
  • @solana/web3.js,
  • @hubbleprotocol/hubble-config.

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

import { Connection, Keypair, PublicKey, clusterApiUrl } from '@solana/web3.js';
import { Idl, Program, Provider } from '@project-serum/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 Provider(
  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);
5.0.4

2 months ago

5.0.0

3 months ago

4.0.0

4 months ago

3.0.29

4 months ago

3.0.20

5 months ago

3.0.17

5 months ago

2.2.17

8 months ago

2.2.0

8 months ago

2.2.16

8 months ago

2.2.7

8 months ago

2.1.8

9 months ago

2.1.0

9 months ago

3.0.10

6 months ago

3.0.6

6 months ago

2.1.9

8 months ago

3.0.0

6 months ago

2.2.40

7 months ago

2.0.11

11 months ago

2.0.0

12 months ago

1.0.276

1 year ago

1.0.204

1 year ago

1.0.217

1 year ago

1.0.184

1 year ago

1.0.171

1 year ago

1.0.158

1 year ago

1.0.179

1 year ago

1.0.134

2 years ago

1.0.144

2 years ago

1.0.133

2 years ago

1.0.91

2 years ago

1.0.84

2 years ago

1.0.49

2 years ago

1.0.46

2 years ago

1.0.25

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.12

2 years ago

1.0.10-alpha.2

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago