diff --git a/packages/hubble-idl/.npmignore b/packages/hubble-idl/.npmignore deleted file mode 100644 index 712e1464..00000000 --- a/packages/hubble-idl/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -tests \ No newline at end of file diff --git a/packages/hubble-idl/README.md b/packages/hubble-idl/README.md deleted file mode 100644 index 77439234..00000000 --- a/packages/hubble-idl/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# 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](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, 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: - -- `@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); -``` diff --git a/packages/hubble-idl/package-lock.json b/packages/hubble-idl/package-lock.json deleted file mode 100644 index 684ac3f0..00000000 --- a/packages/hubble-idl/package-lock.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "@hubbleprotocol/hubble-idl", - "version": "6.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@hubbleprotocol/hubble-idl", - "version": "5.0.16", - "license": "Apache-2.0" - } - } -} diff --git a/packages/hubble-idl/package.json b/packages/hubble-idl/package.json deleted file mode 100644 index a9007979..00000000 --- a/packages/hubble-idl/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@hubbleprotocol/hubble-idl", - "description": "Hubble Protocol IDL (Interface Description Language)", - "main": "dist/index.js", - "version": "6.0.0", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc", - "build:watch": "tsc -w" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/hubbleprotocol/hubble-common.git" - }, - "keywords": [ - "hubble", - "hubbleprotocol", - "common", - "idl" - ], - "author": "Hubble Protocol", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/hubbleprotocol/hubble-common/issues" - }, - "homepage": "https://github.com/hubbleprotocol/hubble-common/blob/master/packages/hubble-idl", - "publishConfig": { - "access": "public" - } -} diff --git a/packages/hubble-idl/src/index.ts b/packages/hubble-idl/src/index.ts deleted file mode 100644 index 9b972700..00000000 --- a/packages/hubble-idl/src/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -import BorrowingIdl from './borrowing.json'; -import ScopeIdl from './scope.json'; -import KaminoIdl from './kamino.json'; - -/** - * Hubble Borrowing IDL - */ -export const BORROWING_IDL = BorrowingIdl; - -/** - * Scope IDL - */ -export const SCOPE_IDL = ScopeIdl; - -/** - * Kamino IDL - */ -export const KAMINO_IDL = KaminoIdl; diff --git a/packages/hubble-idl/src/kamino_lending.json b/packages/hubble-idl/src/kamino_lending.json deleted file mode 100644 index c9739c3a..00000000 --- a/packages/hubble-idl/src/kamino_lending.json +++ /dev/null @@ -1,1973 +0,0 @@ -{ - "version": "0.1.0", - "name": "kamino_lending", - "instructions": [ - { - "name": "initLendingMarket", - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true - }, - { - "name": "lendingMarket", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": true, - "isSigner": false - }, - { - "name": "oracleProgramId", - "isMut": false, - "isSigner": false - }, - { - "name": "switchboardOracleProgramId", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgramId", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "quoteCurrency", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - }, - { - "name": "setLendingMarketOwner", - "accounts": [ - { - "name": "lendingMarketOwner", - "isMut": false, - "isSigner": true - }, - { - "name": "lendingMarket", - "isMut": true, - "isSigner": false - } - ], - "args": [ - { - "name": "newOwner", - "type": "publicKey" - } - ] - }, - { - "name": "initReserve", - "accounts": [ - { - "name": "lendingMarketOwner", - "isMut": true, - "isSigner": true - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveLiquidityMint", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveLiquiditySupply", - "isMut": true, - "isSigner": false - }, - { - "name": "feeReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveCollateralMint", - "isMut": true, - "isSigner": true - }, - { - "name": "reserveCollateralSupply", - "isMut": true, - "isSigner": true - }, - { - "name": "sourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "destinationCollateral", - "isMut": true, - "isSigner": true - }, - { - "name": "pythProductInfo", - "isMut": false, - "isSigner": false - }, - { - "name": "pythPriceInfo", - "isMut": false, - "isSigner": false - }, - { - "name": "switchboardFeedInfo", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - }, - { - "name": "config", - "type": { - "defined": "ReserveConfig" - } - } - ] - }, - { - "name": "refreshReserve", - "accounts": [ - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "pythOracle", - "isMut": false, - "isSigner": false - }, - { - "name": "switchboardOracle", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "depositReserveLiquidity", - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveLiquiditySupply", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveCollateralMint", - "isMut": true, - "isSigner": false - }, - { - "name": "userSourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - } - ] - }, - { - "name": "redeemReserveCollateral", - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveCollateralMint", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveLiquiditySupply", - "isMut": true, - "isSigner": false - }, - { - "name": "userSourceCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "collateralAmount", - "type": "u64" - } - ] - }, - { - "name": "initObligation", - "accounts": [ - { - "name": "obligationOwner", - "isMut": true, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "refreshObligation", - "accounts": [ - { - "name": "obligation", - "isMut": true, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "depositObligationCollateral", - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "depositReserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveDestinationCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "userSourceCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "collateralAmount", - "type": "u64" - } - ] - }, - { - "name": "withdrawObligationCollateral", - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "withdrawReserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveSourceCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "collateralAmount", - "type": "u64" - } - ] - }, - { - "name": "borrowObligationLiquidity", - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "borrowReserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveSourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "borrowReserveLiquidityFeeReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - } - ] - }, - { - "name": "repayObligationLiquidity", - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "repayReserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveDestinationLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "userSourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - } - ] - }, - { - "name": "depositReserveLiquidityAndObligationCollateral", - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveLiquiditySupply", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveCollateralMint", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveDestinationDepositCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "userSourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveLiquidityPythOracle", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveLiquiditySwitchboardOracle", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - } - ] - }, - { - "name": "withdrawObligationCollateralAndRedeemReserveCollateral", - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "withdrawReserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveSourceCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveCollateralMint", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveLiquiditySupply", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "collateralAmount", - "type": "u64" - } - ] - }, - { - "name": "updateReserveConfig", - "accounts": [ - { - "name": "lendingMarketOwner", - "isMut": false, - "isSigner": true - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "pythProduct", - "isMut": false, - "isSigner": false - }, - { - "name": "pythPrice", - "isMut": false, - "isSigner": false - }, - { - "name": "switchboardFeed", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "config", - "type": { - "defined": "ReserveConfig" - } - } - ] - }, - { - "name": "liquidateObligationAndRedeemReserveCollateral", - "accounts": [ - { - "name": "liquidator", - "isMut": false, - "isSigner": true - }, - { - "name": "obligation", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "repayReserve", - "isMut": true, - "isSigner": false - }, - { - "name": "repayReserveLiquiditySupply", - "isMut": true, - "isSigner": false - }, - { - "name": "withdrawReserve", - "isMut": true, - "isSigner": false - }, - { - "name": "withdrawReserveCollateralMint", - "isMut": true, - "isSigner": false - }, - { - "name": "withdrawReserveCollateralSupply", - "isMut": true, - "isSigner": false - }, - { - "name": "withdrawReserveLiquiditySupply", - "isMut": true, - "isSigner": false - }, - { - "name": "withdrawReserveLiquidityFeeReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "userSourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationCollateral", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - } - ] - }, - { - "name": "redeemFees", - "accounts": [ - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveLiquidityFeeReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveSupplyLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "flashRepayReserveLiquidity", - "accounts": [ - { - "name": "userTransferAuthority", - "isMut": false, - "isSigner": true - }, - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveDestinationLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "hostFeeReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveLiquidityFeeReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "userSourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "sysvarInfo", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - }, - { - "name": "borrowInstructionIndex", - "type": "u8" - } - ] - }, - { - "name": "flashBorrowReserveLiquidity", - "accounts": [ - { - "name": "lendingMarket", - "isMut": false, - "isSigner": false - }, - { - "name": "lendingMarketAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveSourceLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "userDestinationLiquidity", - "isMut": true, - "isSigner": false - }, - { - "name": "sysvarInfo", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityAmount", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "LendingMarket", - "type": { - "kind": "struct", - "fields": [ - { - "name": "version", - "docs": [ - "Version of lending market" - ], - "type": "u64" - }, - { - "name": "bumpSeed", - "docs": [ - "Bump seed for derived authority address" - ], - "type": "u64" - }, - { - "name": "owner", - "docs": [ - "Owner authority which can add new reserves" - ], - "type": "publicKey" - }, - { - "name": "quoteCurrency", - "docs": [ - "Currency market prices are quoted in", - "e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey" - ], - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "tokenProgramId", - "docs": [ - "Token program id" - ], - "type": "publicKey" - }, - { - "name": "oracleProgramId", - "docs": [ - "Oracle (Pyth) program id" - ], - "type": "publicKey" - }, - { - "name": "switchboardOracleProgramId", - "docs": [ - "Oracle (Switchboard) program id" - ], - "type": "publicKey" - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 256 - ] - } - } - ] - } - }, - { - "name": "Obligation", - "docs": [ - "Lending market obligation state" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "version", - "docs": [ - "Version of the struct" - ], - "type": "u64" - }, - { - "name": "lastUpdate", - "docs": [ - "Last update to collateral, liquidity, or their market values" - ], - "type": { - "defined": "LastUpdate" - } - }, - { - "name": "lendingMarket", - "docs": [ - "Lending market address" - ], - "type": "publicKey" - }, - { - "name": "owner", - "docs": [ - "Owner authority which can borrow liquidity" - ], - "type": "publicKey" - }, - { - "name": "depositsLen", - "type": "u64" - }, - { - "name": "borrowsLen", - "type": "u64" - }, - { - "name": "deposits", - "docs": [ - "TODO: Does this break the stack size when copied onto the stack, if too big?", - "Deposited collateral for the obligation, unique by deposit reserve address" - ], - "type": { - "array": [ - { - "defined": "ObligationCollateral" - }, - 10 - ] - } - }, - { - "name": "borrows", - "docs": [ - "Borrowed liquidity for the obligation, unique by borrow reserve address" - ], - "type": { - "array": [ - { - "defined": "ObligationLiquidity" - }, - 10 - ] - } - }, - { - "name": "depositedValue", - "docs": [ - "Market value of deposits" - ], - "type": "u128" - }, - { - "name": "borrowedValue", - "docs": [ - "Market value of borrows" - ], - "type": "u128" - }, - { - "name": "allowedBorrowValue", - "docs": [ - "The maximum borrow value at the weighted average loan to value ratio" - ], - "type": "u128" - }, - { - "name": "unhealthyBorrowValue", - "docs": [ - "The dangerous borrow value at the weighted average liquidation threshold" - ], - "type": "u128" - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 256 - ] - } - } - ] - } - }, - { - "name": "Reserve", - "type": { - "kind": "struct", - "fields": [ - { - "name": "version", - "docs": [ - "Version of the reserve" - ], - "type": "u64" - }, - { - "name": "lastUpdate", - "docs": [ - "Last slot when supply and rates updated" - ], - "type": { - "defined": "LastUpdate" - } - }, - { - "name": "lendingMarket", - "docs": [ - "Lending market address" - ], - "type": "publicKey" - }, - { - "name": "liquidity", - "docs": [ - "Reserve liquidity" - ], - "type": { - "defined": "ReserveLiquidity" - } - }, - { - "name": "collateral", - "docs": [ - "Reserve collateral" - ], - "type": { - "defined": "ReserveCollateral" - } - }, - { - "name": "config", - "docs": [ - "Reserve configuration values" - ], - "type": { - "defined": "ReserveConfig" - } - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 512 - ] - } - } - ] - } - } - ], - "types": [ - { - "name": "LastUpdate", - "docs": [ - "Last update state" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "slot", - "docs": [ - "Last slot when updated" - ], - "type": "u64" - }, - { - "name": "stale", - "docs": [ - "True when marked stale, false when slot updated" - ], - "type": "bool" - }, - { - "name": "placeholder", - "type": { - "array": [ - "u8", - 7 - ] - } - } - ] - } - }, - { - "name": "ObligationCollateral", - "docs": [ - "Obligation collateral state" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "depositReserve", - "docs": [ - "Reserve collateral is deposited to" - ], - "type": "publicKey" - }, - { - "name": "depositedAmount", - "docs": [ - "Amount of collateral deposited" - ], - "type": "u64" - }, - { - "name": "marketValue", - "docs": [ - "Collateral market value in quote currency" - ], - "type": "u128" - } - ] - } - }, - { - "name": "ObligationLiquidity", - "docs": [ - "Obligation liquidity state" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "borrowReserve", - "docs": [ - "Reserve liquidity is borrowed from" - ], - "type": "publicKey" - }, - { - "name": "cumulativeBorrowRateWads", - "docs": [ - "Borrow rate used for calculating interest" - ], - "type": "u128" - }, - { - "name": "borrowedAmountWads", - "docs": [ - "Amount of liquidity borrowed plus interest" - ], - "type": "u128" - }, - { - "name": "marketValue", - "docs": [ - "Liquidity market value in quote currency" - ], - "type": "u128" - } - ] - } - }, - { - "name": "ReserveLiquidity", - "docs": [ - "Reserve liquidity" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "mintPubkey", - "docs": [ - "Reserve liquidity mint address" - ], - "type": "publicKey" - }, - { - "name": "supplyPubkey", - "docs": [ - "Reserve liquidity supply address" - ], - "type": "publicKey" - }, - { - "name": "pythOraclePubkey", - "docs": [ - "Reserve liquidity pyth oracle account" - ], - "type": "publicKey" - }, - { - "name": "switchboardOraclePubkey", - "docs": [ - "Reserve liquidity switchboard oracle account" - ], - "type": "publicKey" - }, - { - "name": "availableAmount", - "docs": [ - "Reserve liquidity available" - ], - "type": "u64" - }, - { - "name": "borrowedAmountWads", - "docs": [ - "Reserve liquidity borrowed" - ], - "type": "u128" - }, - { - "name": "cumulativeBorrowRateWads", - "docs": [ - "Reserve liquidity cumulative borrow rate" - ], - "type": "u128" - }, - { - "name": "accumulatedProtocolFeesWads", - "docs": [ - "Reserve cumulative protocol fees" - ], - "type": "u128" - }, - { - "name": "marketPrice", - "docs": [ - "Reserve liquidity market price in quote currency" - ], - "type": "u128" - }, - { - "name": "mintDecimals", - "docs": [ - "Reserve liquidity mint decimals" - ], - "type": "u64" - } - ] - } - }, - { - "name": "ReserveCollateral", - "docs": [ - "Reserve collateral" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "mintPubkey", - "docs": [ - "Reserve collateral mint address" - ], - "type": "publicKey" - }, - { - "name": "mintTotalSupply", - "docs": [ - "Reserve collateral mint supply, used for exchange rate" - ], - "type": "u64" - }, - { - "name": "supplyPubkey", - "docs": [ - "Reserve collateral supply address" - ], - "type": "publicKey" - } - ] - } - }, - { - "name": "ReserveConfig", - "docs": [ - "Reserve configuration values" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "optimalUtilizationRate", - "docs": [ - "Optimal utilization rate, as a percentage" - ], - "type": "u8" - }, - { - "name": "loanToValueRatio", - "docs": [ - "Target ratio of the value of borrows to deposits, as a percentage", - "0 if use as collateral is disabled" - ], - "type": "u8" - }, - { - "name": "liquidationBonus", - "docs": [ - "Bonus a liquidator gets when repaying part of an unhealthy obligation, as a percentage" - ], - "type": "u8" - }, - { - "name": "liquidationThreshold", - "docs": [ - "Loan to value ratio at which an obligation can be liquidated, as a percentage" - ], - "type": "u8" - }, - { - "name": "minBorrowRate", - "docs": [ - "Min borrow APY" - ], - "type": "u8" - }, - { - "name": "optimalBorrowRate", - "docs": [ - "Optimal (utilization) borrow APY" - ], - "type": "u8" - }, - { - "name": "maxBorrowRate", - "docs": [ - "Max borrow APY" - ], - "type": "u8" - }, - { - "name": "protocolLiquidationFee", - "docs": [ - "Cut of the liquidation bonus that the protocol receives, as a percentage" - ], - "type": "u8" - }, - { - "name": "protocolTakeRate", - "docs": [ - "Protocol take rate is the amount borrowed interest protocol receives, as a percentage" - ], - "type": "u8" - }, - { - "name": "placeholder", - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "fees", - "docs": [ - "Program owner fees assessed, separate from gains due to interest accrual" - ], - "type": { - "defined": "ReserveFees" - } - }, - { - "name": "depositLimit", - "docs": [ - "Maximum deposit limit of liquidity in native units, u64::MAX for inf" - ], - "type": "u64" - }, - { - "name": "borrowLimit", - "docs": [ - "Borrows disabled" - ], - "type": "u64" - }, - { - "name": "feeReceiver", - "docs": [ - "Reserve liquidity fee receiver address" - ], - "type": "publicKey" - } - ] - } - }, - { - "name": "ReserveFees", - "docs": [ - "Additional fee information on a reserve", - "", - "These exist separately from interest accrual fees, and are specifically for the program owner", - "and frontend host. The fees are paid out as a percentage of liquidity token amounts during", - "repayments and liquidations." - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "borrowFeeWad", - "docs": [ - "Fee assessed on `BorrowObligationLiquidity`, expressed as a Wad.", - "Must be between 0 and 10^18, such that 10^18 = 1. A few examples for", - "clarity:", - "1% = 10_000_000_000_000_000", - "0.01% (1 basis point) = 100_000_000_000_000", - "0.00001% (Aave borrow fee) = 100_000_000_000" - ], - "type": "u64" - }, - { - "name": "flashLoanFeeWad", - "docs": [ - "Fee for flash loan, expressed as a Wad.", - "0.3% (Aave flash loan fee) = 3_000_000_000_000_000" - ], - "type": "u64" - }, - { - "name": "hostFeePercentage", - "docs": [ - "Amount of fee going to host account, if provided in liquidate and repay" - ], - "type": "u64" - } - ] - } - }, - { - "name": "FeeCalculation", - "docs": [ - "Calculate fees exlusive or inclusive of an amount" - ], - "type": { - "kind": "enum", - "variants": [ - { - "name": "Exclusive" - }, - { - "name": "Inclusive" - } - ] - } - }, - { - "name": "AccountType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Unknown" - }, - { - "name": "Mapping" - }, - { - "name": "Product" - }, - { - "name": "Price" - } - ] - } - }, - { - "name": "PriceStatus", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Unknown" - }, - { - "name": "Trading" - }, - { - "name": "Halted" - }, - { - "name": "Auction" - } - ] - } - }, - { - "name": "CorpAction", - "type": { - "kind": "enum", - "variants": [ - { - "name": "NoCorpAct" - } - ] - } - }, - { - "name": "PriceType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Unknown" - }, - { - "name": "Price" - } - ] - } - } - ], - "errors": [ - { - "code": 6000, - "name": "InstructionUnpackError", - "msg": "Failed to unpack instruction data" - }, - { - "code": 6001, - "name": "AlreadyInitialized", - "msg": "Account is already initialized" - }, - { - "code": 6002, - "name": "NotRentExempt", - "msg": "Lamport balance below rent-exempt threshold" - }, - { - "code": 6003, - "name": "InvalidMarketAuthority", - "msg": "Market authority is invalid" - }, - { - "code": 6004, - "name": "InvalidMarketOwner", - "msg": "Market owner is invalid" - }, - { - "code": 6005, - "name": "InvalidAccountOwner", - "msg": "Input account owner is not the program address" - }, - { - "code": 6006, - "name": "InvalidTokenOwner", - "msg": "Input token account is not owned by the correct token program id" - }, - { - "code": 6007, - "name": "InvalidTokenAccount", - "msg": "Input token account is not valid" - }, - { - "code": 6008, - "name": "InvalidTokenMint", - "msg": "Input token mint account is not valid" - }, - { - "code": 6009, - "name": "InvalidTokenProgram", - "msg": "Input token program account is not valid" - }, - { - "code": 6010, - "name": "InvalidAmount", - "msg": "Input amount is invalid" - }, - { - "code": 6011, - "name": "InvalidConfig", - "msg": "Input config value is invalid" - }, - { - "code": 6012, - "name": "InvalidSigner", - "msg": "Input account must be a signer" - }, - { - "code": 6013, - "name": "InvalidAccountInput", - "msg": "Invalid account input" - }, - { - "code": 6014, - "name": "MathOverflow", - "msg": "Math operation overflow" - }, - { - "code": 6015, - "name": "TokenInitializeMintFailed", - "msg": "Token initialize mint failed" - }, - { - "code": 6016, - "name": "TokenInitializeAccountFailed", - "msg": "Token initialize account failed" - }, - { - "code": 6017, - "name": "TokenTransferFailed", - "msg": "Token transfer failed" - }, - { - "code": 6018, - "name": "TokenMintToFailed", - "msg": "Token mint to failed" - }, - { - "code": 6019, - "name": "TokenBurnFailed", - "msg": "Token burn failed" - }, - { - "code": 6020, - "name": "InsufficientLiquidity", - "msg": "Insufficient liquidity available" - }, - { - "code": 6021, - "name": "ReserveCollateralDisabled", - "msg": "Input reserve has collateral disabled" - }, - { - "code": 6022, - "name": "ReserveStale", - "msg": "Reserve state needs to be refreshed" - }, - { - "code": 6023, - "name": "WithdrawTooSmall", - "msg": "Withdraw amount too small" - }, - { - "code": 6024, - "name": "WithdrawTooLarge", - "msg": "Withdraw amount too large" - }, - { - "code": 6025, - "name": "BorrowTooSmall", - "msg": "Borrow amount too small to receive liquidity after fees" - }, - { - "code": 6026, - "name": "BorrowTooLarge", - "msg": "Borrow amount too large for deposited collateral" - }, - { - "code": 6027, - "name": "RepayTooSmall", - "msg": "Repay amount too small to transfer liquidity" - }, - { - "code": 6028, - "name": "LiquidationTooSmall", - "msg": "Liquidation amount too small to receive collateral" - }, - { - "code": 6029, - "name": "ObligationHealthy", - "msg": "Cannot liquidate healthy obligations" - }, - { - "code": 6030, - "name": "ObligationStale", - "msg": "Obligation state needs to be refreshed" - }, - { - "code": 6031, - "name": "ObligationReserveLimit", - "msg": "Obligation reserve limit exceeded" - }, - { - "code": 6032, - "name": "InvalidObligationOwner", - "msg": "Obligation owner is invalid" - }, - { - "code": 6033, - "name": "ObligationDepositsEmpty", - "msg": "Obligation deposits are empty" - }, - { - "code": 6034, - "name": "ObligationBorrowsEmpty", - "msg": "Obligation borrows are empty" - }, - { - "code": 6035, - "name": "ObligationDepositsZero", - "msg": "Obligation deposits have zero value" - }, - { - "code": 6036, - "name": "ObligationBorrowsZero", - "msg": "Obligation borrows have zero value" - }, - { - "code": 6037, - "name": "InvalidObligationCollateral", - "msg": "Invalid obligation collateral" - }, - { - "code": 6038, - "name": "InvalidObligationLiquidity", - "msg": "Invalid obligation liquidity" - }, - { - "code": 6039, - "name": "ObligationCollateralEmpty", - "msg": "Obligation collateral is empty" - }, - { - "code": 6040, - "name": "ObligationLiquidityEmpty", - "msg": "Obligation liquidity is empty" - }, - { - "code": 6041, - "name": "NegativeInterestRate", - "msg": "Interest rate is negative" - }, - { - "code": 6042, - "name": "InvalidOracleConfig", - "msg": "Input oracle config is invalid" - }, - { - "code": 6043, - "name": "InvalidFlashLoanReceiverProgram", - "msg": "Input flash loan receiver program account is not valid" - }, - { - "code": 6044, - "name": "NotEnoughLiquidityAfterFlashLoan", - "msg": "Not enough liquidity after flash loan" - }, - { - "code": 6045, - "name": "NullOracleConfig", - "msg": "Null oracle config" - }, - { - "code": 6046, - "name": "InsufficientProtocolFeesToRedeem", - "msg": "Insufficent protocol fees to claim or no liquidity availible" - }, - { - "code": 6047, - "name": "FlashBorrowCpi", - "msg": "No cpi flash borrows allowed" - }, - { - "code": 6048, - "name": "NoFlashRepayFound", - "msg": "No corresponding repay found for flash borrow" - }, - { - "code": 6049, - "name": "InvalidFlashRepay", - "msg": "Invalid repay found" - }, - { - "code": 6050, - "name": "FlashRepayCpi", - "msg": "No cpi flash repays allowed" - }, - { - "code": 6051, - "name": "MultipleFlashBorrows", - "msg": "Multiple flash borrows not allowed in the same transaction" - }, - { - "code": 6052, - "name": "FlashLoansDisabled", - "msg": "Flash loans are disabled for this reserve" - }, - { - "code": 6053, - "name": "DeprecatedInstruction", - "msg": "Instruction is deprecated" - }, - { - "code": 6054, - "name": "SwitchboardV2Error", - "msg": "Switchboard error" - } - ] -} \ No newline at end of file diff --git a/packages/hubble-idl/tests/idl.test.ts b/packages/hubble-idl/tests/idl.test.ts deleted file mode 100644 index 70899252..00000000 --- a/packages/hubble-idl/tests/idl.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { BORROWING_IDL } from '../dist'; -import { KAMINO_IDL, SCOPE_IDL } from '../src'; - -describe('IDL Tests', () => { - test('should return Hubble borrowing IDL ', () => { - expect(BORROWING_IDL).not.toBeNull(); - expect(BORROWING_IDL.name).toBe('borrowing'); - expect(BORROWING_IDL.errors.length).toBeGreaterThan(0); - expect(BORROWING_IDL.accounts.length).toBeGreaterThan(0); - expect(BORROWING_IDL.types.length).toBeGreaterThan(0); - expect(BORROWING_IDL.instructions.length).toBeGreaterThan(0); - }); - - test('should return Scope IDL ', () => { - expect(SCOPE_IDL).not.toBeNull(); - expect(SCOPE_IDL.name).toBe('scope'); - expect(SCOPE_IDL.errors.length).toBeGreaterThan(0); - expect(SCOPE_IDL.accounts.length).toBeGreaterThan(0); - expect(SCOPE_IDL.types.length).toBeGreaterThan(0); - expect(SCOPE_IDL.instructions.length).toBeGreaterThan(0); - }); - - test('should return Kamino IDL ', () => { - expect(KAMINO_IDL).not.toBeNull(); - expect(KAMINO_IDL.name).toBe('yvaults'); - expect(KAMINO_IDL.errors.length).toBeGreaterThan(0); - expect(KAMINO_IDL.accounts.length).toBeGreaterThan(0); - expect(KAMINO_IDL.types.length).toBeGreaterThan(0); - expect(KAMINO_IDL.instructions.length).toBeGreaterThan(0); - }); -}); diff --git a/packages/hubble-idl/tsconfig.json b/packages/hubble-idl/tsconfig.json deleted file mode 100644 index e6ad57fd..00000000 --- a/packages/hubble-idl/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src" - }, - "include": ["src/**/*"], - "exclude": [ - "node_modules", - "dist", - "tests" - ] -} \ No newline at end of file diff --git a/packages/hubble-sdk/package-lock.json b/packages/hubble-sdk/package-lock.json index 05c45928..4d088fcb 100644 --- a/packages/hubble-sdk/package-lock.json +++ b/packages/hubble-sdk/package-lock.json @@ -6,14 +6,13 @@ "packages": { "": { "name": "@hubbleprotocol/hubble-sdk", - "version": "5.0.20", + "version": "6.0.0", "license": "Apache-2.0", "dependencies": { "@coral-xyz/anchor": "^0.29.0", "@coral-xyz/borsh": "^0.30.1", - "@hubbleprotocol/hubble-config": "^5.0.0", - "@hubbleprotocol/hubble-idl": "^5.0.16", - "@hubbleprotocol/scope-sdk": "^5.0.20", + "@hubbleprotocol/hubble-config": "^6.0.0", + "@hubbleprotocol/scope-sdk": "^6.0.0", "@solana/web3.js": "^1.78.4", "@streamflow/stream": "6.3.8", "bn.js": "^5.2.1", @@ -2679,34 +2678,23 @@ } }, "node_modules/@hubbleprotocol/hubble-config": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@hubbleprotocol/hubble-config/-/hubble-config-5.0.0.tgz", - "integrity": "sha512-oLdS2SwdYN8sggZhIesN+Kk8KQXGrbYn0kvnvTnk5Wh4pck1kR458ze5gh0XrMDpRVTdgwItf4mXhqiLXvQCKQ==", - "license": "Apache-2.0", - "peerDependencies": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@hubbleprotocol/hubble-config/-/hubble-config-6.0.0.tgz", + "integrity": "sha512-ZdyNvFbKH0PtOQyI+7tryhseQy6ajQTKVo8cY1kkdC+ulHsGn9UufO+jWnEErQHIdZZJ7s8y762YBftblz34tg==", + "dependencies": { "@solana/web3.js": "^1.78.4" } }, - "node_modules/@hubbleprotocol/hubble-idl": { - "version": "5.0.16", - "resolved": "https://registry.npmjs.org/@hubbleprotocol/hubble-idl/-/hubble-idl-5.0.16.tgz", - "integrity": "sha512-Hjo+WL2UXyqbJpOzs3nDlfrTbbQ2BMkZwCPc0TKifCPUTJ8q8OqYUVaCEpszxDBlFMibQftVS97Ut1IQRqyWvw==", - "license": "Apache-2.0" - }, "node_modules/@hubbleprotocol/scope-sdk": { - "version": "5.0.20", - "resolved": "https://registry.npmjs.org/@hubbleprotocol/scope-sdk/-/scope-sdk-5.0.20.tgz", - "integrity": "sha512-l1EMtSEaYE4f8j2h6/386OCsYvN8Kx+3IPsfYl301pIcdSTynK3jVP/NjRyCb3RXeonmly4GsxiOHa5HLyVmZw==", - "license": "Apache-2.0", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@hubbleprotocol/scope-sdk/-/scope-sdk-6.0.0.tgz", + "integrity": "sha512-JNIL8EwLQLI2Pu8vR406RUDWnipzJ/hU3/I0cBc5HloN/K8oSGhCLVGJVEcE5MTspHD7JS3TAvNtos2T232lTw==", "dependencies": { - "@hubbleprotocol/hubble-config": "^5.0.0", - "@project-serum/anchor": "^0.21.0", - "@project-serum/serum": "^0.13.65", + "@coral-xyz/anchor": "^0.29.0", + "@hubbleprotocol/hubble-config": "^6.0.0", "@solana/buffer-layout": "^4.0.1", - "bn.js": "^5.2.1" - }, - "peerDependencies": { "@solana/web3.js": "^1.78.4", + "bn.js": "^5.2.1", "decimal.js": "^10.3.1" } }, @@ -3125,107 +3113,6 @@ "integrity": "sha512-HaW78NszGzRZd9SeoI3JD11JqY+lubnaOx7Pewj5pfjqWXOEATpeKIFb9Z4t2WBUK2iryiXX3lzWwmYWgUL0Ug==", "license": "MIT" }, - "node_modules/@project-serum/anchor": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.21.0.tgz", - "integrity": "sha512-flRuW/F+iC8mitNokx82LOXyND7Dyk6n5UUPJpQv/+NfySFrNFlzuQZaBZJ4CG5g9s8HS/uaaIz1nVkDR8V/QA==", - "license": "(MIT OR Apache-2.0)", - "dependencies": { - "@project-serum/borsh": "^0.2.4", - "@solana/web3.js": "^1.17.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", - "cross-fetch": "^3.1.5", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "find": "^0.3.0", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } - }, - "node_modules/@project-serum/anchor/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@project-serum/borsh": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", - "integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==", - "license": "Apache-2.0", - "dependencies": { - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@solana/web3.js": "^1.2.0" - } - }, - "node_modules/@project-serum/serum": { - "version": "0.13.65", - "resolved": "https://registry.npmjs.org/@project-serum/serum/-/serum-0.13.65.tgz", - "integrity": "sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==", - "license": "MIT", - "dependencies": { - "@project-serum/anchor": "^0.11.1", - "@solana/spl-token": "^0.1.6", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@project-serum/serum/node_modules/@project-serum/anchor": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.11.1.tgz", - "integrity": "sha512-oIdm4vTJkUy6GmE6JgqDAuQPKI7XM4TPJkjtoIzp69RZe0iAD9JP2XHx7lV1jLdYXeYHqDXfBt3zcq7W91K6PA==", - "license": "(MIT OR Apache-2.0)", - "dependencies": { - "@project-serum/borsh": "^0.2.2", - "@solana/web3.js": "^1.17.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.0", - "camelcase": "^5.3.1", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "find": "^0.3.0", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } - }, - "node_modules/@project-serum/serum/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/@radix-ui/primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", @@ -3614,23 +3501,6 @@ "node": ">= 10" } }, - "node_modules/@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/@solana/wallet-adapter-base": { "version": "0.9.19", "resolved": "https://registry.npmjs.org/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.19.tgz", @@ -5242,15 +5112,6 @@ "tslib": "^2.0.3" } }, - "node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=10" - } - }, "node_modules/eip1193-provider": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/eip1193-provider/-/eip1193-provider-1.0.1.tgz", @@ -5466,15 +5327,6 @@ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", "license": "MIT" }, - "node_modules/find": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/find/-/find-0.3.0.tgz", - "integrity": "sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw==", - "license": "MIT", - "dependencies": { - "traverse-chain": "~0.1.0" - } - }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -7058,12 +6910,6 @@ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "license": "MIT" }, - "node_modules/traverse-chain": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", - "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==", - "license": "MIT" - }, "node_modules/trim-newlines": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-4.1.1.tgz", diff --git a/packages/hubble-sdk/package.json b/packages/hubble-sdk/package.json index 3862295d..b00c80a2 100644 --- a/packages/hubble-sdk/package.json +++ b/packages/hubble-sdk/package.json @@ -38,7 +38,6 @@ "@coral-xyz/anchor": "^0.29.0", "@coral-xyz/borsh": "^0.30.1", "@hubbleprotocol/hubble-config": "^6.0.0", - "@hubbleprotocol/hubble-idl": "^6.0.0", "@hubbleprotocol/scope-sdk": "^6.0.0", "@solana/web3.js": "^1.78.4", "@streamflow/stream": "6.3.8", diff --git a/packages/hubble-sdk/src/Hubble.ts b/packages/hubble-sdk/src/Hubble.ts index 4d9f9f67..782a80d0 100644 --- a/packages/hubble-sdk/src/Hubble.ts +++ b/packages/hubble-sdk/src/Hubble.ts @@ -4,7 +4,7 @@ import StakingPoolState from './models/StakingPoolState'; import StabilityPoolState from './models/StabilityPoolState'; import BorrowingMarketState from './models/BorrowingMarketState'; import { Idl, Program, AnchorProvider } from '@coral-xyz/anchor'; -import { BORROWING_IDL } from '@hubbleprotocol/hubble-idl'; +import BorrowingIdl from './borrowing.json'; import { calculatePendingGains, calculateStabilityProvided, @@ -63,7 +63,7 @@ export class Hubble { this._provider = new AnchorProvider(connection, getReadOnlyWallet(), { commitment: connection.commitment, }); - this._borrowingProgram = new Program(BORROWING_IDL as Idl, this._config.borrowing.programId, this._provider); + this._borrowingProgram = new Program(BorrowingIdl as Idl, this._config.borrowing.programId, this._provider); } /** diff --git a/packages/hubble-idl/src/borrowing.json b/packages/hubble-sdk/src/borrowing.json similarity index 100% rename from packages/hubble-idl/src/borrowing.json rename to packages/hubble-sdk/src/borrowing.json diff --git a/packages/scope-sdk/package.json b/packages/scope-sdk/package.json index 39babf2c..b9cccf54 100644 --- a/packages/scope-sdk/package.json +++ b/packages/scope-sdk/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "tsc", "build:watch": "tsc -w", - "codegen": "anchor-client-gen ../hubble-idl/src/scope.json ./src/ --program-id HFn8GnPADiny6XqUoWE8uRPPxb29ikn4yTuPa9MF2fWJ && anchor-client-gen ../hubble-idl/src/kamino.json ./src/@codegen/kamino --program-id 6LtLpnUFNByNXLyCoK9wA2MykKAmQNZKBdY8s47dehDc" + "codegen": "anchor-client-gen ./src/scope.json ./src/ --program-id HFn8GnPADiny6XqUoWE8uRPPxb29ikn4yTuPa9MF2fWJ && anchor-client-gen ./src/kamino.json ./src/@codegen/kamino --program-id 6LtLpnUFNByNXLyCoK9wA2MykKAmQNZKBdY8s47dehDc" }, "repository": { "type": "git", diff --git a/packages/hubble-idl/src/kamino.json b/packages/scope-sdk/src/kamino.json similarity index 100% rename from packages/hubble-idl/src/kamino.json rename to packages/scope-sdk/src/kamino.json diff --git a/packages/hubble-idl/src/scope.json b/packages/scope-sdk/src/scope.json similarity index 100% rename from packages/hubble-idl/src/scope.json rename to packages/scope-sdk/src/scope.json diff --git a/packages/scope-sdk/tests/runner/env.ts b/packages/scope-sdk/tests/runner/env.ts index 2252ef97..3ce57536 100644 --- a/packages/scope-sdk/tests/runner/env.ts +++ b/packages/scope-sdk/tests/runner/env.ts @@ -1,7 +1,7 @@ import { Idl, Program, AnchorProvider, Wallet } from '@coral-xyz/anchor'; import { Connection, ConnectionConfig, Keypair, LAMPORTS_PER_SOL } from '@solana/web3.js'; import { sleep } from './utils'; -import idl from '../../../hubble-idl/src/scope.json'; +import idl from '../../src/scope.json'; import { PROGRAM_ID } from '../../src/programId'; export type Env = {