Merge pull request #80 from blockworks-foundation/simple-liq-price
Add simple liquidation price to AccountInfo
This commit is contained in:
commit
3b5813ac08
|
@ -107,6 +107,15 @@ export default function AccountInfo() {
|
|||
? mangoAccount.getHealth(mangoGroup, mangoCache, 'Init')
|
||||
: I80F48_100
|
||||
|
||||
const liquidationPrice =
|
||||
mangoGroup && mangoAccount && marketConfig
|
||||
? mangoAccount.getLiquidationPrice(
|
||||
mangoGroup,
|
||||
mangoCache,
|
||||
marketConfig.marketIndex
|
||||
)
|
||||
: undefined
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={!connected && !isMobile ? 'filter blur-sm' : undefined}>
|
||||
|
@ -207,6 +216,16 @@ export default function AccountInfo() {
|
|||
: '0.00'}
|
||||
</div>
|
||||
</div>
|
||||
{liquidationPrice && liquidationPrice.gt(ZERO_I80F48) ? (
|
||||
<div className={`flex justify-between pb-3`}>
|
||||
<div className="font-normal text-th-fgd-3 leading-4">
|
||||
Est. Liq. Price
|
||||
</div>
|
||||
<div className={`text-th-fgd-1`}>
|
||||
{usdFormatter(liquidationPrice)}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<div className={`flex justify-between pb-3`}>
|
||||
<Tooltip
|
||||
content={
|
||||
|
|
|
@ -28,14 +28,14 @@ export const defaultLayouts = {
|
|||
{ i: 'orderbook', x: 6, y: 0, w: 3, h: 17 },
|
||||
{ i: 'tradeForm', x: 9, y: 1, w: 3, h: 19 },
|
||||
{ i: 'marketTrades', x: 6, y: 1, w: 3, h: 13 },
|
||||
{ i: 'accountInfo', x: 9, y: 3, w: 3, h: 15 },
|
||||
{ i: 'accountInfo', x: 9, y: 3, w: 3, h: 16 },
|
||||
{ i: 'userInfo', x: 0, y: 2, w: 9, h: 19 },
|
||||
{ i: 'marketPosition', x: 9, y: 4, w: 3, h: 13 },
|
||||
],
|
||||
lg: [
|
||||
{ i: 'tvChart', x: 0, y: 0, w: 8, h: 28, minW: 2 },
|
||||
{ i: 'marketPosition', x: 8, y: 0, w: 4, h: 13, minW: 2 },
|
||||
{ i: 'accountInfo', x: 8, y: 1, w: 4, h: 15, minW: 2 },
|
||||
{ i: 'accountInfo', x: 8, y: 1, w: 4, h: 16, minW: 2 },
|
||||
{ i: 'orderbook', x: 0, y: 2, w: 4, h: 17, minW: 2 },
|
||||
{ i: 'tradeForm', x: 4, y: 2, w: 4, h: 17, minW: 3 },
|
||||
{ i: 'marketTrades', x: 8, y: 2, w: 4, h: 17, minW: 2 },
|
||||
|
@ -44,7 +44,7 @@ export const defaultLayouts = {
|
|||
md: [
|
||||
{ i: 'tvChart', x: 0, y: 0, w: 8, h: 28, minW: 2 },
|
||||
{ i: 'marketPosition', x: 8, y: 0, w: 4, h: 13, minW: 2 },
|
||||
{ i: 'accountInfo', x: 8, y: 1, w: 4, h: 15, minW: 2 },
|
||||
{ i: 'accountInfo', x: 8, y: 1, w: 4, h: 16, minW: 2 },
|
||||
{ i: 'orderbook', x: 0, y: 2, w: 4, h: 17, minW: 2 },
|
||||
{ i: 'tradeForm', x: 4, y: 2, w: 4, h: 17, minW: 3 },
|
||||
{ i: 'marketTrades', x: 8, y: 2, w: 4, h: 17, minW: 2 },
|
||||
|
@ -52,8 +52,8 @@ export const defaultLayouts = {
|
|||
],
|
||||
sm: [
|
||||
{ i: 'tvChart', x: 0, y: 0, w: 12, h: 25, minW: 6 },
|
||||
{ i: 'marketPosition', x: 0, y: 1, w: 6, h: 15, minW: 2 },
|
||||
{ i: 'accountInfo', x: 6, y: 1, w: 6, h: 15, minW: 2 },
|
||||
{ i: 'marketPosition', x: 0, y: 1, w: 6, h: 16, minW: 2 },
|
||||
{ i: 'accountInfo', x: 6, y: 1, w: 6, h: 16, minW: 2 },
|
||||
{ i: 'tradeForm', x: 0, y: 2, w: 12, h: 18, minW: 3 },
|
||||
{ i: 'orderbook', x: 0, y: 3, w: 6, h: 17, minW: 3 },
|
||||
{ i: 'marketTrades', x: 6, y: 3, w: 6, h: 17, minW: 2 },
|
||||
|
@ -70,7 +70,7 @@ export const defaultLayouts = {
|
|||
],
|
||||
}
|
||||
|
||||
export const GRID_LAYOUT_KEY = 'mangoSavedLayouts-3.0.9'
|
||||
export const GRID_LAYOUT_KEY = 'mangoSavedLayouts-3.0.10'
|
||||
export const breakpoints = { xl: 1600, lg: 1200, md: 1110, sm: 768, xs: 0 }
|
||||
|
||||
const TradePageGrid = () => {
|
||||
|
|
35
yarn.lock
35
yarn.lock
|
@ -944,9 +944,9 @@
|
|||
regenerator-runtime "^0.13.4"
|
||||
|
||||
"@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5":
|
||||
version "7.16.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.0.tgz#e27b977f2e2088ba24748bf99b5e1dece64e4f0b"
|
||||
integrity sha512-Nht8L0O8YCktmsDV6FqFue7vQLRx3Hb0B37lS5y0jDRqRxlBG4wIJHnf9/bgSE2UyipKFA01YtS+npRdTWBUyw==
|
||||
version "7.16.3"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.3.tgz#b86f0db02a04187a3c17caa77de69840165d42d5"
|
||||
integrity sha512-WBwekcqacdY2e9AF/Q7WLFUWmdJGJTkbjqTjoMDgXkVZ3ZRUvOPsLb5KdwISoQVsbP+DQzVZW4Zhci0DvpbNTQ==
|
||||
dependencies:
|
||||
regenerator-runtime "^0.13.4"
|
||||
|
||||
|
@ -996,8 +996,8 @@
|
|||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@blockworks-foundation/mango-client@git+https://github.com/blockworks-foundation/mango-client-v3.git":
|
||||
version "3.2.4"
|
||||
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#5f82b9e2fc30e4c9a155527eb40491c748f05d4b"
|
||||
version "3.2.5"
|
||||
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#cbd7294148325b0f787a7e8b186b99da05f170fd"
|
||||
dependencies:
|
||||
"@project-serum/anchor" "^0.16.2"
|
||||
"@project-serum/serum" "0.13.55"
|
||||
|
@ -1785,9 +1785,9 @@
|
|||
integrity sha512-qVCiT93utxN0cawScyQuNx8H82vBvZXSClZfgOu3l3dRRlRO6FjKEZlaPgXG9XUFjIAOsA4kAJY101vobHeJLQ==
|
||||
|
||||
"@types/express-serve-static-core@^4.17.9":
|
||||
version "4.17.24"
|
||||
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.24.tgz#ea41f93bf7e0d59cd5a76665068ed6aab6815c07"
|
||||
integrity sha512-3UJuW+Qxhzwjq3xhwXm2onQcFHn76frIYVbTu+kn24LFxI+dEhdfISDFovPB8VpEgW8oQCTpRuCe+0zJxB7NEA==
|
||||
version "4.17.25"
|
||||
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.25.tgz#e42f7046adc65ece2eb6059b77aecfbe9e9f82e0"
|
||||
integrity sha512-OUJIVfRMFijZukGGwTpKNFprqCCXk5WjNGvUgB/CxxBR40QWSjsNK86+yvGKlCOGc7sbwfHLaXhkG+NsytwBaQ==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
"@types/qs" "*"
|
||||
|
@ -1853,14 +1853,14 @@
|
|||
integrity sha512-xZmuPTa3rlZoIbtDUyJKZQimJV3bxCmzMIO2c9Pz9afyDro6kr7R79GwcB6mRhuoPmV2p1Vb66WOJH7F886WKQ==
|
||||
|
||||
"@types/node@*":
|
||||
version "16.11.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
|
||||
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
|
||||
version "16.11.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.7.tgz#36820945061326978c42a01e56b61cd223dfdc42"
|
||||
integrity sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==
|
||||
|
||||
"@types/node@^12.12.54":
|
||||
version "12.20.36"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.36.tgz#5bd54d2383e714fc4d2c258107ee70c5bad86d0c"
|
||||
integrity sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==
|
||||
version "12.20.37"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.37.tgz#abb38afa9d6e8a2f627a8cb52290b3c80fbe61ed"
|
||||
integrity sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==
|
||||
|
||||
"@types/node@^14.14.25":
|
||||
version "14.17.3"
|
||||
|
@ -2481,16 +2481,11 @@ bindings@^1.3.0:
|
|||
dependencies:
|
||||
file-uri-to-path "1.0.0"
|
||||
|
||||
bn.js@5.1.3, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.1, bn.js@^5.1.2:
|
||||
bn.js@5.1.3, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.1, bn.js@^5.1.2, bn.js@^5.2.0:
|
||||
version "5.1.3"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b"
|
||||
integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==
|
||||
|
||||
bn.js@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002"
|
||||
integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==
|
||||
|
||||
boolbase@^1.0.0, boolbase@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
||||
|
|
Loading…
Reference in New Issue