This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@hubbleprotocol/hubble-idl
TypeScript icon, indicating that this package has built-in type declarations

6.0.1 • Public • Published

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

Package Sidebar

Install

npm i @hubbleprotocol/hubble-idl

Weekly Downloads

294

Version

6.0.1

License

Apache-2.0

Unpacked Size

122 kB

Total Files

5

Last publish

Collaborators

  • andreihrs
  • elliotkennedy
  • hubbleadmin
  • mihalex
  • peroxy
  • siltros971
  • valqrtis