From 27b2dfb0d75672ba777c9f8f894a632698270f41 Mon Sep 17 00:00:00 2001 From: Riordan Panayides Date: Sun, 14 Nov 2021 21:43:23 +0000 Subject: [PATCH 1/3] Add simple liq price to accountinfo, add some height --- components/AccountInfo.tsx | 19 +++++++++++++++++++ components/TradePageGrid.tsx | 12 ++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/components/AccountInfo.tsx b/components/AccountInfo.tsx index eaf3edf8..b4e903da 100644 --- a/components/AccountInfo.tsx +++ b/components/AccountInfo.tsx @@ -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 ( <>
@@ -207,6 +216,16 @@ export default function AccountInfo() { : '0.00'}
+ {liquidationPrice ? ( +
+
+ Est. Liq. Price +
+
+ {usdFormatter(liquidationPrice)} +
+
+ ) : null}
{ From 17db321b6c037ea35ac6ef9c8b274fcbabe2d522 Mon Sep 17 00:00:00 2001 From: Riordan Panayides Date: Sun, 14 Nov 2021 21:50:54 +0000 Subject: [PATCH 2/3] Upgrade client --- yarn.lock | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6e482f2e..b0d4b29d 100644 --- a/yarn.lock +++ b/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" From b5c7f88c66df6e741a73912598d59a5a285d42da Mon Sep 17 00:00:00 2001 From: Riordan Panayides Date: Sun, 14 Nov 2021 22:02:30 +0000 Subject: [PATCH 3/3] Don't display liq price of zero --- components/AccountInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/AccountInfo.tsx b/components/AccountInfo.tsx index b4e903da..92159251 100644 --- a/components/AccountInfo.tsx +++ b/components/AccountInfo.tsx @@ -216,7 +216,7 @@ export default function AccountInfo() { : '0.00'}
- {liquidationPrice ? ( + {liquidationPrice && liquidationPrice.gt(ZERO_I80F48) ? (
Est. Liq. Price