6.0.1 • Published 10 months ago

@hubbleprotocol/hubble-idl v6.0.1

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

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.

Install

npm

npm install @hubbleprotocol/hubble-idl

Usage

Import borrowing IDL JSON to your project:

// 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):

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);
6.0.1

10 months ago

6.0.0

11 months ago

5.0.16

1 year ago

5.0.12

1 year ago

5.0.4

1 year ago

5.0.0

1 year ago

4.0.0

1 year ago

3.0.29

1 year ago

3.0.20

2 years ago

3.0.17

2 years ago

2.2.17

2 years ago

2.2.0

2 years ago

2.2.16

2 years ago

2.2.7

2 years ago

2.1.8

2 years ago

2.1.0

2 years ago

3.0.10

2 years ago

3.0.6

2 years ago

2.1.9

2 years ago

3.0.0

2 years ago

2.2.40

2 years ago

2.0.11

2 years ago

2.0.0

2 years ago

1.0.276

2 years ago

1.0.204

2 years ago

1.0.217

2 years ago

1.0.184

2 years ago

1.0.171

2 years ago

1.0.158

3 years ago

1.0.179

2 years ago

1.0.134

3 years ago

1.0.144

3 years ago

1.0.133

3 years ago

1.0.91

3 years ago

1.0.84

3 years ago

1.0.49

3 years ago

1.0.46

3 years ago

1.0.25

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.12

3 years ago

1.0.10-alpha.2

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago