Skip to content

Commit 8abd189

Browse files
committed
update sdk and lite
1 parent a1cb3d9 commit 8abd189

23 files changed

+644
-444
lines changed

solend-lite/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@chakra-ui/react": "^2.4.9",
1616
"@chakra-ui/styled-system": "^2.5.1",
1717
"@chakra-ui/theme-tools": "^2.0.16",
18+
"@coral-xyz/anchor": "^0.30.1",
1819
"@emotion/react": "^11.10.5",
1920
"@emotion/styled": "^11.10.5",
2021
"@next/font": "13.0.7",

solend-lite/public/og_image.png

8.55 KB
Loading

solend-lite/src/components/AccountMetrics/AccountMetrics.tsx

+3-9
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,21 @@ function AccountMetrics(): ReactElement {
2424
<Metric
2525
label='Net value'
2626
value={
27-
obligation
28-
? formatUsd(obligation.netAccountValue.toString())
29-
: '-'
27+
obligation ? formatUsd(obligation.netAccountValue.toString()) : '-'
3028
}
3129
tooltip='The value of your account calculated as (supply balance - borrow balance).'
3230
/>
3331
<Metric
3432
label='Supply balance'
3533
value={
36-
obligation
37-
? formatUsd(obligation.totalSupplyValue.toString())
38-
: '-'
34+
obligation ? formatUsd(obligation.totalSupplyValue.toString()) : '-'
3935
}
4036
tooltip='Supply balance is the sum of all assets supplied. Increasing this value increases your borrow limit and liquidation threshold.'
4137
/>
4238
<Metric
4339
label='Borrow balance'
4440
value={
45-
obligation
46-
? formatUsd(obligation.totalBorrowValue.toString())
47-
: '-'
41+
obligation ? formatUsd(obligation.totalBorrowValue.toString()) : '-'
4842
}
4943
tooltip='Borrow balance is the sum of all assets borrowed.'
5044
/>

solend-lite/src/components/TransactionTakeover/TransactionTakeover.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ import Result, { ResultConfigType } from 'components/Result/Result';
2828
import BigNumber from 'bignumber.js';
2929
import { connectionAtom, refreshPageAtom } from 'stores/settings';
3030
import { rateLimiterAtom, selectedPoolAtom } from 'stores/pools';
31-
import { useWallet } from '@solana/wallet-adapter-react';
31+
import { useAnchorWallet, useWallet } from '@solana/wallet-adapter-react';
3232
import { U64_MAX } from '@solendprotocol/solend-sdk';
3333
import { SKIP_PREFLIGHT } from 'common/config';
3434
import { selectedModalTabAtom, selectedReserveAtom } from 'stores/modal';
35+
import { Wallet } from '@coral-xyz/anchor';
3536

3637
export default function TransactionTakeover() {
3738
const { sendTransaction, signAllTransactions } = useWallet();
39+
const anchorWallet = useAnchorWallet();
3840
const [publicKey] = useAtom(publicKeyAtom);
3941
const [connection] = useAtom(connectionAtom);
4042
const [rateLimiter] = useAtom(rateLimiterAtom);
@@ -143,7 +145,7 @@ export default function TransactionTakeover() {
143145
new BigNumber(value)
144146
.shiftedBy(selectedReserve.decimals)
145147
.toFixed(0),
146-
publicKey,
148+
anchorWallet as Wallet,
147149
selectedPool,
148150
selectedReserve,
149151
connection,
@@ -185,7 +187,7 @@ export default function TransactionTakeover() {
185187
: new BigNumber(value)
186188
.shiftedBy(selectedReserve.decimals)
187189
.toFixed(0),
188-
publicKey,
190+
anchorWallet as Wallet,
189191
selectedPool,
190192
selectedReserve,
191193
connection,
@@ -229,7 +231,7 @@ export default function TransactionTakeover() {
229231
: new BigNumber(value)
230232
.shiftedBy(selectedReserve.decimals)
231233
.toFixed(0),
232-
publicKey,
234+
anchorWallet as Wallet,
233235
selectedPool,
234236
selectedReserve,
235237
connection,
@@ -273,7 +275,7 @@ export default function TransactionTakeover() {
273275
: new BigNumber(value)
274276
.shiftedBy(selectedReserve.decimals)
275277
.toFixed(0),
276-
publicKey,
278+
anchorWallet as Wallet,
277279
selectedPool,
278280
selectedReserve,
279281
connection,

solend-lite/src/components/TransactionTakeover/configs.tsx

+22-14
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { getAssociatedTokenAddress, NATIVE_MINT } from '@solana/spl-token';
1414
import { ENVIRONMENT, HOST_ATA } from 'common/config';
1515
import { sendAndConfirmStrategy } from 'components/TransactionTakeover/util';
1616
import { WalletContextState } from '@solana/wallet-adapter-react';
17+
import { Wallet } from '@coral-xyz/anchor';
1718

1819
const SOL_PADDING_FOR_RENT_AND_FEE = 0.02;
1920

@@ -28,7 +29,7 @@ export function sufficientSOLForTransaction(wallet: WalletType) {
2829
export const supplyConfigs = {
2930
action: async (
3031
value: string,
31-
publicKey: string,
32+
wallet: Wallet,
3233
pool: PoolType,
3334
selectedReserve: SelectedReserveType,
3435
connection: Connection,
@@ -45,8 +46,10 @@ export const supplyConfigs = {
4546
selectedReserve,
4647
connection,
4748
value,
48-
new PublicKey(publicKey),
49-
ENVIRONMENT,
49+
wallet,
50+
{
51+
environment: ENVIRONMENT,
52+
}
5053
);
5154

5255
return sendAndConfirmStrategy(
@@ -158,7 +161,7 @@ export const supplyConfigs = {
158161
export const borrowConfigs = {
159162
action: async (
160163
value: string,
161-
publicKey: string,
164+
wallet: Wallet,
162165
pool: PoolType,
163166
selectedReserve: SelectedReserveType,
164167
connection: Connection,
@@ -191,10 +194,11 @@ export const borrowConfigs = {
191194
selectedReserve,
192195
connection,
193196
value,
194-
new PublicKey(publicKey),
195-
ENVIRONMENT,
196-
undefined,
197-
hostAta,
197+
wallet,
198+
{
199+
environment: ENVIRONMENT,
200+
hostAta,
201+
}
198202
);
199203

200204
return sendAndConfirmStrategy(
@@ -359,7 +363,7 @@ export const borrowConfigs = {
359363
export const withdrawConfigs = {
360364
action: async (
361365
value: string,
362-
publicKey: string,
366+
wallet: Wallet,
363367
pool: PoolType,
364368
selectedReserve: SelectedReserveType,
365369
connection: Connection,
@@ -376,8 +380,10 @@ export const withdrawConfigs = {
376380
selectedReserve,
377381
connection,
378382
value,
379-
new PublicKey(publicKey),
380-
ENVIRONMENT,
383+
wallet,
384+
{
385+
environment: ENVIRONMENT,
386+
}
381387
);
382388

383389
return sendAndConfirmStrategy(
@@ -552,7 +558,7 @@ export const withdrawConfigs = {
552558
export const repayConfigs = {
553559
action: async (
554560
value: string,
555-
publicKey: string,
561+
wallet: Wallet,
556562
pool: PoolType,
557563
selectedReserve: SelectedReserveType,
558564
connection: Connection,
@@ -569,8 +575,10 @@ export const repayConfigs = {
569575
selectedReserve,
570576
connection,
571577
value,
572-
new PublicKey(publicKey),
573-
ENVIRONMENT,
578+
wallet,
579+
{
580+
environment: ENVIRONMENT,
581+
},
574582
);
575583

576584
return sendAndConfirmStrategy(

solend-lite/src/pages/index.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ export default function Index() {
2525
property='og:title'
2626
content='Solend | Lend and borrow on Solana'
2727
/>
28-
<meta
29-
property='og:image'
30-
content='https://solend-image-assets.s3.us-east-2.amazonaws.com/og.jpg'
31-
/>
28+
<meta property='og:image' content='/og_image.png' />
3229
<meta name='twitter:card' content='summary' />
3330
<meta name='twitter:site' content='@solendprotocol' />
3431
<meta name='viewport' content='width=device-width, initial-scale=1' />

solend-lite/src/stores/pools.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ import { atomWithRefresh } from './shared';
2626

2727
export type ReserveWithMetadataType = ReserveType & {
2828
symbol: string;
29-
logo: string | null;
29+
logo: string | undefined;
3030
};
3131

3232
export type SelectedReserveType = ReserveType & {
3333
symbol: string;
34-
logo: string | null;
34+
logo: string | undefined;
3535
};
3636

3737
export type SelectedPoolType = {

solend-sdk/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
__tests__/scripts.test.ts
12
dist/
23
node_modules/

solend-sdk/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solendprotocol/solend-sdk",
3-
"version": "0.12.11",
3+
"version": "0.13.5",
44
"private": true,
55
"main": "src/index.ts",
66
"module": "src/index.ts",
@@ -27,8 +27,9 @@
2727
"@solana/buffer-layout": "=4.0.1",
2828
"@solana/spl-token": "^0.3.7",
2929
"@solana/web3.js": "=1.92.3",
30+
"@solendprotocol/token2022-wrapper-sdk": "^1.0.1",
3031
"@solflare-wallet/utl-sdk": "^1.4.0",
31-
"@switchboard-xyz/on-demand": "^1.2.20",
32+
"@switchboard-xyz/on-demand": "1.2.27",
3233
"@switchboard-xyz/sbv2-lite": "^0.2.4",
3334
"axios": "^0.24.0",
3435
"bignumber.js": "^9.0.2",

0 commit comments

Comments
 (0)