fixed getPnl and settlePnl functions and updated client
This commit is contained in:
parent
40bb8ec7e5
commit
1b5cac89a1
|
@ -38,6 +38,7 @@ const handleSettlePnl = async (
|
|||
try {
|
||||
const txid = await mangoClient.settlePnl(
|
||||
mangoGroup,
|
||||
mangoCache,
|
||||
mangoAccount,
|
||||
perpMarket,
|
||||
mangoGroup.rootBankAccounts[QUOTE_INDEX],
|
||||
|
@ -226,6 +227,7 @@ export default function MarketPosition() {
|
|||
+nativeI80F48ToUi(
|
||||
perpAccount.getPnl(
|
||||
mangoGroup.perpMarkets[marketIndex],
|
||||
mangoGroupCache.perpMarketCache[marketIndex],
|
||||
mangoGroupCache.priceCache[marketIndex].price
|
||||
),
|
||||
marketConfig.quoteDecimals
|
||||
|
@ -242,6 +244,7 @@ export default function MarketPosition() {
|
|||
? perpAccount
|
||||
.getPnl(
|
||||
mangoGroup.perpMarkets[marketIndex],
|
||||
mangoGroupCache.perpMarketCache[marketIndex],
|
||||
mangoGroupCache.priceCache[marketIndex].price
|
||||
)
|
||||
.eq(ZERO_I80F48)
|
||||
|
|
|
@ -105,6 +105,7 @@ const PositionsTable = () => {
|
|||
try {
|
||||
const txid = await mangoClient.settlePnl(
|
||||
mangoGroup,
|
||||
mangoCache,
|
||||
mangoAccount,
|
||||
perpMarket,
|
||||
mangoGroup.rootBankAccounts[QUOTE_INDEX],
|
||||
|
@ -181,6 +182,8 @@ const PositionsTable = () => {
|
|||
groupConfig,
|
||||
perpMarketInfo.perpMarket
|
||||
)
|
||||
const perpMarketCache =
|
||||
mangoCache.perpMarketCache[marketIndex]
|
||||
const price = mangoCache.priceCache[marketIndex].price
|
||||
const perpMarket = allMarkets[
|
||||
marketConfig.publicKey.toString()
|
||||
|
@ -284,7 +287,11 @@ const PositionsTable = () => {
|
|||
<Td className="px-2 py-2 whitespace-nowrap text-sm text-th-fgd-1">
|
||||
{usdFormatter(
|
||||
+nativeI80F48ToUi(
|
||||
perpAccount.getPnl(perpMarketInfo, price),
|
||||
perpAccount.getPnl(
|
||||
perpMarketInfo,
|
||||
perpMarketCache,
|
||||
price
|
||||
),
|
||||
marketConfig.quoteDecimals
|
||||
)
|
||||
)}
|
||||
|
|
|
@ -995,7 +995,7 @@
|
|||
|
||||
"@blockworks-foundation/mango-client@git+https://github.com/blockworks-foundation/mango-client-v3.git":
|
||||
version "3.0.6"
|
||||
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#e0a56e3af9dbdd7a8fb90a859021cfc47ad24a3b"
|
||||
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#06bf59ea10431297b5118977a4ca8944f77451f9"
|
||||
dependencies:
|
||||
"@project-serum/serum" "0.13.55"
|
||||
"@project-serum/sol-wallet-adapter" "^0.2.0"
|
||||
|
@ -1902,9 +1902,9 @@
|
|||
integrity sha512-/BHF5HAx3em7/KkzVKm3LrsD6HZAXuXO1AJZQ3cRRBZj4oHZDviWPYu0aEplAqDFNHZPW6d3G7KN+ONcCCC7pw==
|
||||
|
||||
"@types/node@*":
|
||||
version "16.6.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.2.tgz#331b7b9f8621c638284787c5559423822fdffc50"
|
||||
integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA==
|
||||
version "16.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.0.tgz#f0374c4e89d1fc1ef705caad3021ba34c1a9294c"
|
||||
integrity sha512-e66BrnjWQ3BRBZ2+iA5e85fcH9GLNe4S0n1H0T3OalK2sXg5XWEFTO4xvmGrYQ3edy+q6fdOh5t0/HOY8OAqBg==
|
||||
|
||||
"@types/node@^12.12.54":
|
||||
version "12.20.19"
|
||||
|
|
Loading…
Reference in New Issue