From 622ee02ec83ea5848d23ba50c3f985b4c8d43284 Mon Sep 17 00:00:00 2001 From: 0xodia <0xodia@solend.fi> Date: Thu, 7 Nov 2024 10:36:21 -0500 Subject: [PATCH 1/2] eclipse changes --- solend-sdk/.gitignore | 1 + solend-sdk/__tests__/oracle.test.ts | 4 +- solend-sdk/package.json | 2 +- solend-sdk/src/core/actions.ts | 67 +++++--- solend-sdk/src/core/constants.ts | 9 +- solend-sdk/src/core/margin.ts | 186 +++++++++++++++++++++ solend-sdk/src/core/utils/obligations.ts | 2 +- solend-sdk/src/core/utils/pools.ts | 41 ++++- solend-sdk/src/core/utils/wallet.ts | 19 ++- solend-sdk/src/instructions/initReserve.ts | 2 +- solend-sdk/src/transaction.ts | 1 - yarn.lock | 13 +- 12 files changed, 297 insertions(+), 50 deletions(-) diff --git a/solend-sdk/.gitignore b/solend-sdk/.gitignore index 8e01851b..bbe7e6c5 100644 --- a/solend-sdk/.gitignore +++ b/solend-sdk/.gitignore @@ -1,3 +1,4 @@ +scripts.ts __tests__/scripts.test.ts dist/ node_modules/ diff --git a/solend-sdk/__tests__/oracle.test.ts b/solend-sdk/__tests__/oracle.test.ts index a0e1cf59..1e90ad64 100644 --- a/solend-sdk/__tests__/oracle.test.ts +++ b/solend-sdk/__tests__/oracle.test.ts @@ -12,7 +12,7 @@ import { import { PythSolanaReceiver, pythSolanaReceiverIdl } from "@pythnetwork/pyth-solana-receiver"; import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet"; import { AnchorProvider, Program } from "@coral-xyz/anchor-30"; - import { CrossbarClient, loadLookupTables, PullFeed, SB_ON_DEMAND_PID } from "@switchboard-xyz/on-demand"; + import { CrossbarClient, loadLookupTables, PullFeed, ON_DEMAND_MAINNET_PID } from "@switchboard-xyz/on-demand"; import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes"; jest.setTimeout(50_000); @@ -29,7 +29,7 @@ import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes"; const provider = new AnchorProvider(connection, new NodeWallet(Keypair.fromSecretKey(new Uint8Array( testKey ))), {}); - const idl = (await Program.fetchIdl(SB_ON_DEMAND_PID, provider))!; + const idl = (await Program.fetchIdl(ON_DEMAND_MAINNET_PID, provider))!; const sbod = new Program(idl, provider); const sbPulledOracles = [ diff --git a/solend-sdk/package.json b/solend-sdk/package.json index d35ea89d..8cbff3af 100644 --- a/solend-sdk/package.json +++ b/solend-sdk/package.json @@ -23,7 +23,7 @@ "@project-serum/anchor": "^0.24.2", "@pythnetwork/client": "^2.12.0", "@pythnetwork/price-service-client": "^1.9.0", - "@pythnetwork/pyth-solana-receiver": "^0.8.0", + "@pythnetwork/pyth-solana-receiver": "^0.8.2", "@solana/buffer-layout": "=4.0.1", "@solana/spl-token": "^0.3.7", "@solana/web3.js": "=1.92.3", diff --git a/solend-sdk/src/core/actions.ts b/solend-sdk/src/core/actions.ts index 82b4b822..cb6eb939 100644 --- a/solend-sdk/src/core/actions.ts +++ b/solend-sdk/src/core/actions.ts @@ -65,7 +65,6 @@ import { createWithdrawAndBurnWrapperTokensInstruction, } from "@solendprotocol/token2022-wrapper-sdk"; import { ReserveType } from "./utils"; -import { getSizeOfTransaction } from "../transaction"; const SOL_PADDING_FOR_INTEREST = "1000000"; @@ -80,6 +79,8 @@ type ActionConfigType = { token2022Mint?: string; repayToken2022Mint?: string; debug?: boolean; + computeUnitPriceMicroLamports?: number; + computeUnitLimit?: number; }; type SupportType = @@ -219,6 +220,10 @@ export class SolendActionCore { environment: EnvironmentType; + computeUnitPriceMicroLamports?: number; + + computeUnitLimit?: number; + private constructor( programId: PublicKey, connection: Connection, @@ -250,6 +255,8 @@ export class SolendActionCore { token2022Mint?: PublicKey; wrappedAta?: PublicKey; debug?: boolean; + computeUnitPriceMicroLamports?: number; + computeUnitLimit?: number; } ) { this.programId = programId; @@ -282,6 +289,8 @@ export class SolendActionCore { // temporarily default to true this.debug = config?.debug ?? true; this.environment = config?.environment ?? "production"; + this.computeUnitPriceMicroLamports = config?.computeUnitPriceMicroLamports; + this.computeUnitLimit = config?.computeUnitLimit; } static async initialize( @@ -391,7 +400,6 @@ export class SolendActionCore { amount, depositReserves, borrowReserves, - { environment: config.environment, hostAta: config.hostAta, @@ -428,6 +436,9 @@ export class SolendActionCore { TOKEN_2022_PROGRAM_ID ) : undefined, + debug: config.debug, + computeUnitPriceMicroLamports: config.computeUnitPriceMicroLamports, + computeUnitLimit: config.computeUnitLimit, } ); } @@ -675,7 +686,7 @@ export class SolendActionCore { return new VersionedTransaction( new TransactionMessage({ payerKey: this.publicKey, - recentBlockhash: (await this.connection.getRecentBlockhash()).blockhash, + recentBlockhash: (await this.connection.getLatestBlockhash()).blockhash, instructions: [ ...this.preTxnIxs, ...this.setupIxs, @@ -702,17 +713,17 @@ export class SolendActionCore { if (this.preTxnIxs.length) { txns.preLendingTxn = new Transaction({ feePayer: this.publicKey, - recentBlockhash: (await this.connection.getRecentBlockhash()).blockhash, + recentBlockhash: (await this.connection.getLatestBlockhash()).blockhash, }).add(...this.preTxnIxs); } txns.lendingTxn = new Transaction({ feePayer: this.publicKey, - recentBlockhash: (await this.connection.getRecentBlockhash()).blockhash, + recentBlockhash: (await this.connection.getLatestBlockhash()).blockhash, }).add(...this.setupIxs, ...this.lendingIxs, ...this.cleanupIxs); if (this.postTxnIxs.length) { txns.postLendingTxn = new Transaction({ feePayer: this.publicKey, - recentBlockhash: (await this.connection.getRecentBlockhash()).blockhash, + recentBlockhash: (await this.connection.getLatestBlockhash()).blockhash, }).add(...this.postTxnIxs); } return txns; @@ -754,6 +765,14 @@ export class SolendActionCore { pullPriceTxns: null, }; + const priorityFeeIx = ComputeBudgetProgram.setComputeUnitPrice({ + microLamports: this.computeUnitPriceMicroLamports ?? 500_000, + }); + + const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({ + units: this.computeUnitLimit ?? 1_000_000, + }); + if (this.pullPriceTxns.length) { txns.pullPriceTxns = this.pullPriceTxns; } @@ -763,7 +782,7 @@ export class SolendActionCore { new TransactionMessage({ payerKey: this.publicKey, recentBlockhash: blockhash.blockhash, - instructions: this.preTxnIxs, + instructions: [priorityFeeIx, modifyComputeUnits, ...this.preTxnIxs], }).compileToV0Message() ); } @@ -780,13 +799,6 @@ export class SolendActionCore { instructions.push(tip); } - const priorityFeeIx = ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: 1_000_000, - }); - const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({ - units: 1_000_000, - }); - txns.lendingTxn = new VersionedTransaction( new TransactionMessage({ payerKey: this.publicKey, @@ -802,7 +814,7 @@ export class SolendActionCore { new TransactionMessage({ payerKey: this.publicKey, recentBlockhash: blockhash.blockhash, - instructions: this.postTxnIxs, + instructions: [priorityFeeIx, modifyComputeUnits, ...this.postTxnIxs], }).compileToV0Message() ); } @@ -1167,6 +1179,13 @@ export class SolendActionCore { } private async buildPullPriceTxns(oracleKeys: Array) { + const priorityFeeIx = ComputeBudgetProgram.setComputeUnitPrice({ + microLamports: this.computeUnitPriceMicroLamports ?? 1_000_000, + }); + const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({ + units: 1_000_000, + }); + const oracleAccounts = await this.connection.getMultipleAccountsInfo( oracleKeys.map((o) => new PublicKey(o)), "processed" @@ -1230,15 +1249,6 @@ export class SolendActionCore { accountLookups ); - const priorityFeeIx = ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: 1_000_000, - }); - const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit( - { - units: 1_000_000, - } - ); - const instructions = [priorityFeeIx, modifyComputeUnits, ix]; if (this.debug) @@ -1326,9 +1336,13 @@ export class SolendActionCore { 0 // shardId of 0 ); + transactionBuilder.addInstructions([ + { instruction: priorityFeeIx, signers: [] }, + { instruction: modifyComputeUnits, signers: [] }, + ]); + const transactionsWithSigners = await transactionBuilder.buildVersionedTransactions({ - tightComputeBudget: true, jitoTipLamports: this.pullPriceTxns.length ? undefined : this.jitoTipAmount, @@ -1337,6 +1351,7 @@ export class SolendActionCore { for (const transaction of transactionsWithSigners) { const signers = transaction.signers; const tx = transaction.tx; + if (signers) { tx.sign(signers); } @@ -1363,8 +1378,6 @@ export class SolendActionCore { ]) ); - console.log(allReserveAddresses); - await this.buildPullPriceTxns([ ...allReserveAddresses.map((address) => reserveMap[address].pythOracle), ...allReserveAddresses.map( diff --git a/solend-sdk/src/core/constants.ts b/solend-sdk/src/core/constants.ts index ab373e7f..df12bbb5 100644 --- a/solend-sdk/src/core/constants.ts +++ b/solend-sdk/src/core/constants.ts @@ -1,13 +1,14 @@ -import { Cluster, PublicKey } from "@solana/web3.js"; +import { PublicKey } from "@solana/web3.js"; import BigNumber from "bignumber.js"; import { EnvironmentType } from "./types"; export const WAD = "1".concat(Array(18 + 1).join("0")); export const POSITION_LIMIT = 6; export const SOL_PADDING_FOR_INTEREST = "1000000"; export const SLOTS_PER_YEAR = 63072000; -export const WRAPPER_PROGRAM_ID = new PublicKey( - "3JmCcXAjmBpFzHHuUpgJFfTQEQnAR7K1erNLtWV1g7d9" -); +export const WRAPPER_PROGRAM_ID = + process.env.NEXT_PUBLIC_BRANCH === "eclipse" + ? new PublicKey("55ttmJsE9v5PtScfnA2q6S9VXgSPopV6WziiwH94SYws") + : new PublicKey("3JmCcXAjmBpFzHHuUpgJFfTQEQnAR7K1erNLtWV1g7d9"); export const SOLEND_ADDRESSES = [ "5pHk2TmnqQzRF9L6egy5FfiyBgS7G9cMZ5RFaJAvghzw", "yaDPAockQPna7Srx5LB2TugJSKHUduHghyZdQcn7zYz", diff --git a/solend-sdk/src/core/margin.ts b/solend-sdk/src/core/margin.ts index 685f8ceb..f6b86b06 100644 --- a/solend-sdk/src/core/margin.ts +++ b/solend-sdk/src/core/margin.ts @@ -139,6 +139,192 @@ export class Margin { : []; } + static calculateMaxUserBorrowPower = ( + shortReserve: ReserveType, + longReserve: ReserveType, + exchangeRate?: string, + closeMode?: "keepLong" | "keepShort", + obligation?: ObligationType + ) => { + const shortTokenPrice = shortReserve.price; + const longTokenPrice = longReserve.price; + const conversion = exchangeRate + ? new BigNumber(exchangeRate) + : longTokenPrice.dividedBy(shortTokenPrice); + + let curShortSupplyAmount = + obligation?.deposits.find( + (d) => d.reserveAddress === shortReserve.address + )?.amount ?? new BigNumber(0); + let curShortBorrowAmount = + obligation?.borrows.find((d) => d.reserveAddress === shortReserve.address) + ?.amount ?? new BigNumber(0); + let curLongSupplyAmount = + obligation?.deposits.find((d) => d.reserveAddress === longReserve.address) + ?.amount ?? new BigNumber(0); + let curLongBorrowAmount = + obligation?.borrows.find((d) => d.reserveAddress === longReserve.address) + ?.amount ?? new BigNumber(0); + + if (closeMode) { + const shortTokenToRepayAll = + closeMode === "keepLong" + ? conversion.multipliedBy(curLongBorrowAmount) + : curShortSupplyAmount; + + // convert to base and round up to match calculation logic in margin.tsx + const flashLoanFeeBase = shortTokenToRepayAll + .multipliedBy(shortReserve.flashLoanFee) + .multipliedBy(new BigNumber(10 ** shortReserve.decimals)) + .integerValue(BigNumber.ROUND_CEIL); + const flashLoanFee = new BigNumber( + flashLoanFeeBase + .dividedBy(new BigNumber(10 ** shortReserve.decimals)) + .toString() + ); + + let maxPossibleSwap = + closeMode === "keepLong" + ? shortTokenToRepayAll.plus(flashLoanFee) + : shortTokenToRepayAll.minus(flashLoanFee); + + // If user doesn't have enough short token supplied, we re-calculate given their max short token supplied + if ( + curShortSupplyAmount.isLessThan(maxPossibleSwap) && + closeMode === "keepLong" + ) { + // convert to base and round up to match calculation logic in margin.tsx + const flashLoanFeeBase = curShortSupplyAmount + .multipliedBy(shortReserve.flashLoanFee) + .multipliedBy(new BigNumber(10 ** shortReserve.decimals)) + .integerValue(BigNumber.ROUND_CEIL); + const flashLoanFee = new BigNumber( + flashLoanFeeBase + .dividedBy(new BigNumber(10 ** shortReserve.decimals)) + .toString() + ); + maxPossibleSwap = curShortSupplyAmount.minus(flashLoanFee); + } + + return maxPossibleSwap.toNumber(); + } + + // handle the case where short token has non-zero ltv / infitie borrow weight e.g mSOL/stSOL + if ( + shortReserve.addedBorrowWeightBPS.toString() === U64_MAX || + new BigNumber(shortReserve.totalBorrow).isGreaterThanOrEqualTo( + new BigNumber(shortReserve.reserveBorrowLimit) + ) + ) { + // convert to base and round up to match calculation logic in margin.tsx + const flashLoanFeeBase = curShortSupplyAmount + .multipliedBy(new BigNumber(shortReserve.flashLoanFee)) + .multipliedBy(new BigNumber(10 ** shortReserve.decimals)) + .integerValue(BigNumber.ROUND_CEIL); + const flashLoanFee = new BigNumber( + flashLoanFeeBase + .dividedBy(new BigNumber(10 ** shortReserve.decimals)) + .toString() + ); + const maxPossibleSwap = curShortSupplyAmount.minus(flashLoanFee); + + return maxPossibleSwap.toNumber(); + } + + const shortTokenBorrowWeight = new BigNumber( + shortReserve.addedBorrowWeightBPS.toString() + ) + .plus(new BigNumber(10000)) + .dividedBy(new BigNumber(10000)); + const longTokenBorrowWeight = new BigNumber( + longReserve.addedBorrowWeightBPS.toString() + ) + .plus(new BigNumber(10000)) + .dividedBy(new BigNumber(10000)); + let totalShortSwapable = new BigNumber(0); + let curMinPriceBorrowLimit = + obligation?.minPriceBorrowLimit ?? BigNumber(0); + let curMaxPriceUserTotalWeightedBorrow = + obligation?.maxPriceUserTotalWeightedBorrow ?? BigNumber(0); + + for (let i = 0; i < 20; i += 1) { + if ( + curMaxPriceUserTotalWeightedBorrow.isGreaterThanOrEqualTo( + curMinPriceBorrowLimit + ) + ) { + break; + } + let swapable = new BigNumber(0); + const marginAvailible = curMinPriceBorrowLimit.minus( + curMaxPriceUserTotalWeightedBorrow + ); + if (curShortSupplyAmount > new BigNumber(0)) { + // case you still have longs of your short token to sell + if (shortReserve.loanToValueRatio.toString() === "0") { + swapable = curShortSupplyAmount; + } else { + swapable = BigNumber.min( + marginAvailible + .dividedBy(shortTokenPrice) + .dividedBy(new BigNumber(shortReserve.loanToValueRatio)), + curShortSupplyAmount + ); + } + + curShortSupplyAmount = curShortSupplyAmount.minus(swapable); + curMinPriceBorrowLimit = curMinPriceBorrowLimit.minus( + swapable + .times(shortTokenPrice) + .times(new BigNumber(shortReserve.loanToValueRatio)) + ); + } else { + // you are already short your short token + swapable = marginAvailible + .dividedBy(shortTokenBorrowWeight) + .dividedBy(shortTokenPrice); + curShortBorrowAmount = curShortBorrowAmount.plus(swapable); + + curMaxPriceUserTotalWeightedBorrow = + curMaxPriceUserTotalWeightedBorrow.plus( + swapable.times(shortTokenPrice).times(shortTokenBorrowWeight) + ); + } + + totalShortSwapable = totalShortSwapable.plus(swapable); + const longRecievedInSwap = swapable.dividedBy(conversion); + + if (curLongBorrowAmount > longRecievedInSwap) { + curLongBorrowAmount = curLongBorrowAmount.minus(longRecievedInSwap); + curMaxPriceUserTotalWeightedBorrow = + curMaxPriceUserTotalWeightedBorrow.minus( + longRecievedInSwap + .times(longReserve.maxPrice) + .times(longTokenBorrowWeight) + ); + } else { + curLongSupplyAmount = curLongSupplyAmount + .plus(longRecievedInSwap) + .minus(curLongBorrowAmount); + curMaxPriceUserTotalWeightedBorrow = + curMaxPriceUserTotalWeightedBorrow.minus( + curLongBorrowAmount + .times(longReserve.maxPrice) + .times(longTokenBorrowWeight) + ); + curMinPriceBorrowLimit = curMinPriceBorrowLimit.plus( + longRecievedInSwap + .minus(curLongBorrowAmount) + .times(longReserve.minPrice) + .times(new BigNumber(longReserve.loanToValueRatio)) + ); + curLongBorrowAmount = new BigNumber(0); + } + } + + return totalShortSwapable.times(new BigNumber(".975")).toNumber(); + }; + calculateMaxUserBorrowPower = ( closeMode?: "keepLong" | "keepShort", exchangeRate?: string diff --git a/solend-sdk/src/core/utils/obligations.ts b/solend-sdk/src/core/utils/obligations.ts index 35d55dd7..1e3156c6 100644 --- a/solend-sdk/src/core/utils/obligations.ts +++ b/solend-sdk/src/core/utils/obligations.ts @@ -129,7 +129,7 @@ export function formatObligation( : totalBorrowValue.dividedBy(borrowLimit); const weightedBorrowUtilization = minPriceBorrowLimit.isZero() ? new BigNumber(0) - : weightedTotalBorrowValue.dividedBy(borrowLimit); + : weightedTotalBorrowValue.dividedBy(minPriceBorrowLimit); const isBorrowLimitReached = borrowUtilization.isGreaterThanOrEqualTo( new BigNumber("1") ); diff --git a/solend-sdk/src/core/utils/pools.ts b/solend-sdk/src/core/utils/pools.ts index c7034f2c..2da92b16 100644 --- a/solend-sdk/src/core/utils/pools.ts +++ b/solend-sdk/src/core/utils/pools.ts @@ -4,7 +4,7 @@ import SwitchboardProgram from "@switchboard-xyz/sbv2-lite"; import { fetchPrices } from "./prices"; import { calculateBorrowInterest, calculateSupplyInterest } from "./rates"; import { PoolType } from "../types"; -import { parseReserve, Reserve, RawReserveType } from "../../state"; +import { parseReserve, RawReserveType } from "../../state"; import { parseRateLimiter } from "./utils"; export async function fetchPools( @@ -113,6 +113,26 @@ export function formatReserve( .div(priceData.lstAdjustmentRatio) .toString() ) / 100, + maxLiquidationThreshold: + Number( + new BigNumber(reserve.info.config.maxLiquidationThreshold) + .div(priceData.lstAdjustmentRatio) + .toString() + ) / 100, + liquidationBonus: Number( + new BigNumber(reserve.info.config.liquidationBonus) + .plus(new BigNumber(1)) + .times(priceData.lstAdjustmentRatio) + .minus(new BigNumber(1)) + .toString() + ), + maxLiquidationBonus: Number( + new BigNumber(reserve.info.config.maxLiquidationBonus) + .plus(new BigNumber(1)) + .times(priceData.lstAdjustmentRatio) + .minus(new BigNumber(1)) + .toString() + ), } : {}; @@ -163,11 +183,19 @@ export function formatReserve( totalSupplyUsd: totalSupply.times(priceResolved), totalBorrowUsd: totalBorrow.times(priceResolved), availableAmountUsd: availableAmount.times(priceResolved), - loanToValueRatio: reserve.info.config.loanToValueRatio / 100, - liquidationThreshold: reserve.info.config.liquidationThreshold / 100, - maxLiquidationThreshold: reserve.info.config.maxLiquidationThreshold / 100, - liquidationPenalty: reserve.info.config.liquidationBonus / 100, - maxLiquidationPenalty: reserve.info.config.maxLiquidationBonus / 100, + loanToValueRatio: + lstPatch.loanToValueRatio ?? reserve.info.config.loanToValueRatio / 100, + liquidationThreshold: + lstPatch.liquidationThreshold ?? + reserve.info.config.liquidationThreshold / 100, + maxLiquidationThreshold: + lstPatch.maxLiquidationThreshold ?? + reserve.info.config.maxLiquidationThreshold / 100, + liquidationBonus: + lstPatch.liquidationBonus ?? reserve.info.config.liquidationBonus / 100, + maxLiquidationBonus: + lstPatch.maxLiquidationBonus ?? + reserve.info.config.maxLiquidationBonus / 100, liquidityAddress: reserve.info.liquidity.supplyPubkey.toBase58(), cTokenLiquidityAddress: reserve.info.collateral.supplyPubkey.toBase58(), liquidityFeeReceiverAddress: reserve.info.config.feeReceiver.toBase58(), @@ -201,7 +229,6 @@ export function formatReserve( attributedBorrowValue: reserve.info.config.attributedBorrowValue, attributedBorrowLimitOpen: reserve.info.config.attributedBorrowLimitOpen, attributedBorrowLimitClose: reserve.info.config.attributedBorrowLimitClose, - ...lstPatch, }; } diff --git a/solend-sdk/src/core/utils/wallet.ts b/solend-sdk/src/core/utils/wallet.ts index a42d4bc5..5bb8b103 100644 --- a/solend-sdk/src/core/utils/wallet.ts +++ b/solend-sdk/src/core/utils/wallet.ts @@ -11,7 +11,8 @@ import { TokenMetadata, WalletType } from "../types"; export function formatWalletAssets( rawWalletData: Awaited>, - metadata: TokenMetadata + metadata: TokenMetadata, + nativeTokenSymbol: string = "SOL" ) { const { userAssociatedTokenAccounts, wSolAddress, nativeSolBalance } = rawWalletData; @@ -25,25 +26,33 @@ export function formatWalletAssets( return { decimals, symbol: - tokenMetadata?.symbol === "SOL" ? "wSOL" : tokenMetadata?.symbol, + tokenMetadata?.symbol === nativeTokenSymbol + ? `w${nativeTokenSymbol}` + : tokenMetadata?.symbol, address: parsedAccount.address.toBase58(), amount: new BigNumber(parsedAccount.amount.toString()).shiftedBy( -decimals ), - mintAddress: tokenMetadata?.symbol === "SOL" ? "wSOL" : mintAddress, + mintAddress: + tokenMetadata?.symbol === nativeTokenSymbol + ? `w${nativeTokenSymbol}` + : mintAddress, logoUri: tokenMetadata?.logoUri, }; }) .filter(Boolean) as WalletType; + const nativeMetadata = metadata[NATIVE_MINT.toBase58()]; return assets.concat([ { decimals: Math.log10(LAMPORTS_PER_SOL), - symbol: "SOL", + symbol: nativeTokenSymbol, address: wSolAddress, amount: nativeSolBalance, mintAddress: NATIVE_MINT.toBase58(), - logo: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png", + logo: + nativeMetadata?.logoUri ?? + "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png", }, ]); } diff --git a/solend-sdk/src/instructions/initReserve.ts b/solend-sdk/src/instructions/initReserve.ts index cded4c16..055c49b2 100644 --- a/solend-sdk/src/instructions/initReserve.ts +++ b/solend-sdk/src/instructions/initReserve.ts @@ -7,7 +7,7 @@ import { import BN from "bn.js"; import * as Layout from "../layout"; import { LendingInstruction } from "./instruction"; -import { InputReserveConfigParams, NULL_ORACLE } from "../core"; +import { InputReserveConfigParams } from "../core"; const BufferLayout = require("buffer-layout"); diff --git a/solend-sdk/src/transaction.ts b/solend-sdk/src/transaction.ts index 9c04c54a..64631b1c 100644 --- a/solend-sdk/src/transaction.ts +++ b/solend-sdk/src/transaction.ts @@ -1,5 +1,4 @@ import { - AddressLookupTableAccount, PACKET_DATA_SIZE, PublicKey, Signer, diff --git a/yarn.lock b/yarn.lock index 9a119710..d986c8c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4318,7 +4318,18 @@ "@pythnetwork/solana-utils" "*" "@solana/web3.js" "^1.90.0" -"@pythnetwork/solana-utils@*": +"@pythnetwork/pyth-solana-receiver@^0.8.2": + version "0.8.2" + resolved "https://registry.yarnpkg.com/@pythnetwork/pyth-solana-receiver/-/pyth-solana-receiver-0.8.2.tgz#e1c54de017bad6c321c22245fe240e020e9c853d" + integrity sha512-WrrdwwhSYvvB5vJEL+SfPnfuxgkRKMeKdZvGFFwe6ENrMhrQCM05oDkvNNYfXATLcpQGRAyBu9l1xIxUxixpqw== + dependencies: + "@coral-xyz/anchor" "^0.29.0" + "@noble/hashes" "^1.4.0" + "@pythnetwork/price-service-sdk" ">=1.6.0" + "@pythnetwork/solana-utils" "0.4.2" + "@solana/web3.js" "^1.90.0" + +"@pythnetwork/solana-utils@*", "@pythnetwork/solana-utils@0.4.2": version "0.4.2" resolved "https://registry.yarnpkg.com/@pythnetwork/solana-utils/-/solana-utils-0.4.2.tgz#3e220eed518c02ad702ebb023488afd7c5649a87" integrity sha512-hKo7Bcs/kDWA5Fnqhg9zJSB94NMoUDIDjHjSi/uvZOzwizISUQI6oY3LWd2CXzNh4f8djjY2BS5iNHaM4cm8Bw== From 276c6c5562a520245efebe019a66758ad4e8f5c7 Mon Sep 17 00:00:00 2001 From: 0xodia <0xodia@solend.fi> Date: Thu, 7 Nov 2024 10:37:03 -0500 Subject: [PATCH 2/2] bump version --- solend-sdk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solend-sdk/package.json b/solend-sdk/package.json index 8cbff3af..9c304094 100644 --- a/solend-sdk/package.json +++ b/solend-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@solendprotocol/solend-sdk", - "version": "0.13.11", + "version": "0.13.23", "private": true, "main": "src/index.ts", "module": "src/index.ts",