Skip to content

Commit

Permalink
update sdk and lite
Browse files Browse the repository at this point in the history
  • Loading branch information
0xodia committed Sep 9, 2024
1 parent a1cb3d9 commit a92a5c3
Show file tree
Hide file tree
Showing 24 changed files with 645 additions and 445 deletions.
2 changes: 1 addition & 1 deletion solend-lite/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = withBundleAnalyzer({
reactStrictMode: true,
swcMinify: true,
webpack: (config) => {
config.resolve.fallback = { fs: false, path: false };
config.resolve.fallback = { fs: false, path: false, tls: false, net: false };
return config;
},
images: {
Expand Down
1 change: 1 addition & 0 deletions solend-lite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@chakra-ui/react": "^2.4.9",
"@chakra-ui/styled-system": "^2.5.1",
"@chakra-ui/theme-tools": "^2.0.16",
"@coral-xyz/anchor": "^0.30.1",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@next/font": "13.0.7",
Expand Down
Binary file added solend-lite/public/og_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 3 additions & 9 deletions solend-lite/src/components/AccountMetrics/AccountMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,21 @@ function AccountMetrics(): ReactElement {
<Metric
label='Net value'
value={
obligation
? formatUsd(obligation.netAccountValue.toString())
: '-'
obligation ? formatUsd(obligation.netAccountValue.toString()) : '-'
}
tooltip='The value of your account calculated as (supply balance - borrow balance).'
/>
<Metric
label='Supply balance'
value={
obligation
? formatUsd(obligation.totalSupplyValue.toString())
: '-'
obligation ? formatUsd(obligation.totalSupplyValue.toString()) : '-'
}
tooltip='Supply balance is the sum of all assets supplied. Increasing this value increases your borrow limit and liquidation threshold.'
/>
<Metric
label='Borrow balance'
value={
obligation
? formatUsd(obligation.totalBorrowValue.toString())
: '-'
obligation ? formatUsd(obligation.totalBorrowValue.toString()) : '-'
}
tooltip='Borrow balance is the sum of all assets borrowed.'
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ import Result, { ResultConfigType } from 'components/Result/Result';
import BigNumber from 'bignumber.js';
import { connectionAtom, refreshPageAtom } from 'stores/settings';
import { rateLimiterAtom, selectedPoolAtom } from 'stores/pools';
import { useWallet } from '@solana/wallet-adapter-react';
import { useAnchorWallet, useWallet } from '@solana/wallet-adapter-react';
import { U64_MAX } from '@solendprotocol/solend-sdk';
import { SKIP_PREFLIGHT } from 'common/config';
import { selectedModalTabAtom, selectedReserveAtom } from 'stores/modal';
import { Wallet } from '@coral-xyz/anchor';

export default function TransactionTakeover() {
const { sendTransaction, signAllTransactions } = useWallet();
const anchorWallet = useAnchorWallet();
const [publicKey] = useAtom(publicKeyAtom);
const [connection] = useAtom(connectionAtom);
const [rateLimiter] = useAtom(rateLimiterAtom);
Expand Down Expand Up @@ -143,7 +145,7 @@ export default function TransactionTakeover() {
new BigNumber(value)
.shiftedBy(selectedReserve.decimals)
.toFixed(0),
publicKey,
anchorWallet as Wallet,
selectedPool,
selectedReserve,
connection,
Expand Down Expand Up @@ -185,7 +187,7 @@ export default function TransactionTakeover() {
: new BigNumber(value)
.shiftedBy(selectedReserve.decimals)
.toFixed(0),
publicKey,
anchorWallet as Wallet,
selectedPool,
selectedReserve,
connection,
Expand Down Expand Up @@ -229,7 +231,7 @@ export default function TransactionTakeover() {
: new BigNumber(value)
.shiftedBy(selectedReserve.decimals)
.toFixed(0),
publicKey,
anchorWallet as Wallet,
selectedPool,
selectedReserve,
connection,
Expand Down Expand Up @@ -273,7 +275,7 @@ export default function TransactionTakeover() {
: new BigNumber(value)
.shiftedBy(selectedReserve.decimals)
.toFixed(0),
publicKey,
anchorWallet as Wallet,
selectedPool,
selectedReserve,
connection,
Expand Down
36 changes: 22 additions & 14 deletions solend-lite/src/components/TransactionTakeover/configs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getAssociatedTokenAddress, NATIVE_MINT } from '@solana/spl-token';
import { ENVIRONMENT, HOST_ATA } from 'common/config';
import { sendAndConfirmStrategy } from 'components/TransactionTakeover/util';
import { WalletContextState } from '@solana/wallet-adapter-react';
import { Wallet } from '@coral-xyz/anchor';

const SOL_PADDING_FOR_RENT_AND_FEE = 0.02;

Expand All @@ -28,7 +29,7 @@ export function sufficientSOLForTransaction(wallet: WalletType) {
export const supplyConfigs = {
action: async (
value: string,
publicKey: string,
wallet: Wallet,
pool: PoolType,
selectedReserve: SelectedReserveType,
connection: Connection,
Expand All @@ -45,8 +46,10 @@ export const supplyConfigs = {
selectedReserve,
connection,
value,
new PublicKey(publicKey),
ENVIRONMENT,
wallet,
{
environment: ENVIRONMENT,
}
);

return sendAndConfirmStrategy(
Expand Down Expand Up @@ -158,7 +161,7 @@ export const supplyConfigs = {
export const borrowConfigs = {
action: async (
value: string,
publicKey: string,
wallet: Wallet,
pool: PoolType,
selectedReserve: SelectedReserveType,
connection: Connection,
Expand Down Expand Up @@ -191,10 +194,11 @@ export const borrowConfigs = {
selectedReserve,
connection,
value,
new PublicKey(publicKey),
ENVIRONMENT,
undefined,
hostAta,
wallet,
{
environment: ENVIRONMENT,
hostAta,
}
);

return sendAndConfirmStrategy(
Expand Down Expand Up @@ -359,7 +363,7 @@ export const borrowConfigs = {
export const withdrawConfigs = {
action: async (
value: string,
publicKey: string,
wallet: Wallet,
pool: PoolType,
selectedReserve: SelectedReserveType,
connection: Connection,
Expand All @@ -376,8 +380,10 @@ export const withdrawConfigs = {
selectedReserve,
connection,
value,
new PublicKey(publicKey),
ENVIRONMENT,
wallet,
{
environment: ENVIRONMENT,
}
);

return sendAndConfirmStrategy(
Expand Down Expand Up @@ -552,7 +558,7 @@ export const withdrawConfigs = {
export const repayConfigs = {
action: async (
value: string,
publicKey: string,
wallet: Wallet,
pool: PoolType,
selectedReserve: SelectedReserveType,
connection: Connection,
Expand All @@ -569,8 +575,10 @@ export const repayConfigs = {
selectedReserve,
connection,
value,
new PublicKey(publicKey),
ENVIRONMENT,
wallet,
{
environment: ENVIRONMENT,
},
);

return sendAndConfirmStrategy(
Expand Down
5 changes: 1 addition & 4 deletions solend-lite/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ export default function Index() {
property='og:title'
content='Solend | Lend and borrow on Solana'
/>
<meta
property='og:image'
content='https://solend-image-assets.s3.us-east-2.amazonaws.com/og.jpg'
/>
<meta property='og:image' content='/og_image.png' />
<meta name='twitter:card' content='summary' />
<meta name='twitter:site' content='@solendprotocol' />
<meta name='viewport' content='width=device-width, initial-scale=1' />
Expand Down
4 changes: 2 additions & 2 deletions solend-lite/src/stores/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import { atomWithRefresh } from './shared';

export type ReserveWithMetadataType = ReserveType & {
symbol: string;
logo: string | null;
logo: string | undefined;
};

export type SelectedReserveType = ReserveType & {
symbol: string;
logo: string | null;
logo: string | undefined;
};

export type SelectedPoolType = {
Expand Down
1 change: 1 addition & 0 deletions solend-sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__tests__/scripts.test.ts
dist/
node_modules/
5 changes: 3 additions & 2 deletions solend-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solendprotocol/solend-sdk",
"version": "0.12.11",
"version": "0.13.5",
"private": true,
"main": "src/index.ts",
"module": "src/index.ts",
Expand All @@ -27,8 +27,9 @@
"@solana/buffer-layout": "=4.0.1",
"@solana/spl-token": "^0.3.7",
"@solana/web3.js": "=1.92.3",
"@solendprotocol/token2022-wrapper-sdk": "^1.0.1",
"@solflare-wallet/utl-sdk": "^1.4.0",
"@switchboard-xyz/on-demand": "^1.2.20",
"@switchboard-xyz/on-demand": "1.2.27",
"@switchboard-xyz/sbv2-lite": "^0.2.4",
"axios": "^0.24.0",
"bignumber.js": "^9.0.2",
Expand Down
Loading

0 comments on commit a92a5c3

Please sign in to comment.