lint
This commit is contained in:
parent
404770aea1
commit
e3df946feb
|
@ -126,8 +126,6 @@ export const borrow = async (
|
|||
)
|
||||
: undefined;
|
||||
|
||||
|
||||
|
||||
let amountLamports: number = 0;
|
||||
let fromLamports: number = 0;
|
||||
if (amountType === BorrowAmountType.LiquidityBorrowAmount) {
|
||||
|
@ -154,7 +152,6 @@ export const borrow = async (
|
|||
fromLamports = amountLamports;
|
||||
}
|
||||
|
||||
|
||||
const fromAccount = ensureSplAccount(
|
||||
instructions,
|
||||
finalCleanupInstructions,
|
||||
|
@ -197,7 +194,6 @@ export const borrow = async (
|
|||
instructions = [];
|
||||
cleanupInstructions = [...finalCleanupInstructions];
|
||||
|
||||
|
||||
// create approval for transfer transactions
|
||||
const transferAuthority = approve(
|
||||
instructions,
|
||||
|
@ -205,7 +201,7 @@ export const borrow = async (
|
|||
fromAccount,
|
||||
wallet.publicKey,
|
||||
fromLamports,
|
||||
false,
|
||||
false
|
||||
);
|
||||
signers.push(transferAuthority);
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ export const BorrowInput = (props: {
|
|||
flexDirection: "row",
|
||||
justifyContent: "space-evenly",
|
||||
alignItems: "center",
|
||||
marginBottom: 20
|
||||
marginBottom: 20,
|
||||
}}
|
||||
>
|
||||
<CollateralInput
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
import { cache, ParsedAccount } from "../../contexts/accounts";
|
||||
import { useConnectionConfig } from "../../contexts/connection";
|
||||
import {useLendingReserves, useUserBalance, useUserDeposits} from "../../hooks";
|
||||
import {
|
||||
useLendingReserves,
|
||||
useUserBalance,
|
||||
useUserDeposits,
|
||||
} from "../../hooks";
|
||||
import {
|
||||
LendingReserve,
|
||||
LendingMarket,
|
||||
|
@ -42,7 +46,7 @@ export default function CollateralInput(props: {
|
|||
|
||||
useEffect(() => {
|
||||
if (props.useWalletBalance) {
|
||||
setBalance(tokenBalance)
|
||||
setBalance(tokenBalance);
|
||||
} else {
|
||||
const id: string =
|
||||
cache
|
||||
|
@ -77,26 +81,29 @@ export default function CollateralInput(props: {
|
|||
(reserve) =>
|
||||
!onlyQuoteAllowed ||
|
||||
reserve.info.liquidityMint.equals(market.info.quoteMint)
|
||||
)
|
||||
);
|
||||
|
||||
if(!collateralReserve && props.useFirstReserve && filteredReserveAccounts.length) {
|
||||
if (
|
||||
!collateralReserve &&
|
||||
props.useFirstReserve &&
|
||||
filteredReserveAccounts.length
|
||||
) {
|
||||
const address = filteredReserveAccounts[0].pubkey.toBase58();
|
||||
setCollateralReserve(address);
|
||||
}
|
||||
const renderReserveAccounts = filteredReserveAccounts
|
||||
.map((reserve) => {
|
||||
const mint = reserve.info.liquidityMint.toBase58();
|
||||
const address = reserve.pubkey.toBase58();
|
||||
const name = getTokenName(tokenMap, mint);
|
||||
return (
|
||||
<Option key={address} value={address} name={name} title={address}>
|
||||
<div key={address} style={{ display: "flex", alignItems: "center" }}>
|
||||
<TokenIcon mintAddress={mint} />
|
||||
{name}
|
||||
</div>
|
||||
</Option>
|
||||
);
|
||||
});
|
||||
const renderReserveAccounts = filteredReserveAccounts.map((reserve) => {
|
||||
const mint = reserve.info.liquidityMint.toBase58();
|
||||
const address = reserve.pubkey.toBase58();
|
||||
const name = getTokenName(tokenMap, mint);
|
||||
return (
|
||||
<Option key={address} value={address} name={name} title={address}>
|
||||
<div key={address} style={{ display: "flex", alignItems: "center" }}>
|
||||
<TokenIcon mintAddress={mint} />
|
||||
{name}
|
||||
</div>
|
||||
</Option>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<Card
|
||||
|
|
|
@ -148,7 +148,7 @@ export const cache = {
|
|||
obj: AccountInfo<Buffer>,
|
||||
parser?: AccountParser
|
||||
) => {
|
||||
if(obj.data.length === 0) {
|
||||
if (obj.data.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ export function approve(
|
|||
)
|
||||
);
|
||||
|
||||
if(autoRevoke) {
|
||||
if (autoRevoke) {
|
||||
cleanupInstructions.push(
|
||||
Token.createRevokeInstruction(tokenProgram, account, owner, [])
|
||||
);
|
||||
|
|
|
@ -18,7 +18,11 @@ export const BorrowView = () => {
|
|||
<div></div>
|
||||
</div>
|
||||
{reserveAccounts.map((account) => (
|
||||
<BorrowItem key={account.pubkey.toBase58()} reserve={account.info} address={account.pubkey} />
|
||||
<BorrowItem
|
||||
key={account.pubkey.toBase58()}
|
||||
reserve={account.info}
|
||||
address={account.pubkey}
|
||||
/>
|
||||
))}
|
||||
</Card>
|
||||
</div>
|
||||
|
|
|
@ -33,7 +33,10 @@ export const DashboardDeposits = () => {
|
|||
<div></div>
|
||||
</div>
|
||||
{userDeposits.map((deposit) => (
|
||||
<DepositItem key={deposit.account.pubkey.toBase58()} userDeposit={deposit} />
|
||||
<DepositItem
|
||||
key={deposit.account.pubkey.toBase58()}
|
||||
userDeposit={deposit}
|
||||
/>
|
||||
))}
|
||||
</Card>
|
||||
);
|
||||
|
|
|
@ -23,9 +23,7 @@ export const DashboardView = () => {
|
|||
/>
|
||||
{LABELS.DASHBOARD_INFO}
|
||||
</div>
|
||||
):
|
||||
userDeposits.length === 0 && userObligations.length === 0 ?
|
||||
(
|
||||
) : userDeposits.length === 0 && userObligations.length === 0 ? (
|
||||
<div className="dashboard-info">
|
||||
<img
|
||||
src="splash.svg"
|
||||
|
@ -34,17 +32,21 @@ export const DashboardView = () => {
|
|||
/>
|
||||
{LABELS.NO_LOANS_NO_DEPOSITS}
|
||||
</div>
|
||||
): (
|
||||
) : (
|
||||
<Row gutter={GUTTER}>
|
||||
<Col md={24} xl={12} span={24}>
|
||||
{userDeposits.length > 0 ?
|
||||
<DashboardDeposits /> :
|
||||
<Card>{LABELS.NO_DEPOSITS}</Card> }
|
||||
{userDeposits.length > 0 ? (
|
||||
<DashboardDeposits />
|
||||
) : (
|
||||
<Card>{LABELS.NO_DEPOSITS}</Card>
|
||||
)}
|
||||
</Col>
|
||||
<Col md={24} xl={12} span={24}>
|
||||
{userObligations.length > 0 ?
|
||||
<DashboardObligations /> :
|
||||
<Card>{LABELS.NO_LOANS}</Card> }
|
||||
{userObligations.length > 0 ? (
|
||||
<DashboardObligations />
|
||||
) : (
|
||||
<Card>{LABELS.NO_LOANS}</Card>
|
||||
)}
|
||||
</Col>
|
||||
</Row>
|
||||
)}
|
||||
|
|
|
@ -35,9 +35,12 @@ export const DashboardObligations = () => {
|
|||
<div></div>
|
||||
</div>
|
||||
{userObligations.map((item) => {
|
||||
return <ObligationItem
|
||||
key={item.obligation.account.pubkey.toBase58()}
|
||||
obligation={item.obligation} />;
|
||||
return (
|
||||
<ObligationItem
|
||||
key={item.obligation.account.pubkey.toBase58()}
|
||||
obligation={item.obligation}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Card>
|
||||
);
|
||||
|
|
|
@ -17,7 +17,11 @@ export const DepositView = () => {
|
|||
<div></div>
|
||||
</div>
|
||||
{reserveAccounts.map((account) => (
|
||||
<ReserveItem key={account.pubkey.toBase58()} reserve={account.info} address={account.pubkey} />
|
||||
<ReserveItem
|
||||
key={account.pubkey.toBase58()}
|
||||
reserve={account.info}
|
||||
address={account.pubkey}
|
||||
/>
|
||||
))}
|
||||
</Card>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue