diff --git a/components/trade/OraclePrice.tsx b/components/trade/OraclePrice.tsx index 35b3d58d..80acaebd 100644 --- a/components/trade/OraclePrice.tsx +++ b/components/trade/OraclePrice.tsx @@ -4,7 +4,7 @@ import Tooltip from '@components/shared/Tooltip' import { useTranslation } from 'next-i18next' import mangoStore from '@store/mangoStore' import { useEffect, useState } from 'react' -import { PerpMarket, Bank } from '@blockworks-foundation/mango-v4' +import { PerpMarket, Bank, Group } from '@blockworks-foundation/mango-v4' import { BorshAccountsCoder } from '@coral-xyz/anchor' import { floorToDecimal, @@ -62,7 +62,8 @@ const OraclePrice = () => { marketOrBank.oracle, async (info, context) => { const { price, uiPrice, lastUpdatedSlot } = - await group.decodePriceFromOracleAi( + await Group.decodePriceFromOracleAi( + group, coder, marketOrBank.oracle, info, diff --git a/hooks/useStablePrice.ts b/hooks/useStablePrice.ts index 53ee449d..672c1349 100644 --- a/hooks/useStablePrice.ts +++ b/hooks/useStablePrice.ts @@ -1,4 +1,4 @@ -import { I80F48, PerpMarket } from '@blockworks-foundation/mango-v4' +import { Group, I80F48, PerpMarket } from '@blockworks-foundation/mango-v4' import { useMemo } from 'react' import useMangoGroup from './useMangoGroup' import useSelectedMarket from './useSelectedMarket' @@ -22,11 +22,13 @@ const useStablePrice = () => { (b) => b.tokenIndex === selectedMarket.quoteTokenIndex, ) - const baseStablePrice = group.toUiPrice( + const baseStablePrice = Group.toUiPrice( + group, I80F48.fromNumber(baseBank!.stablePriceModel.stablePrice), baseBank!.mintDecimals, ) - const quoteStablePrice = group.toUiPrice( + const quoteStablePrice = Group.toUiPrice( + group, I80F48.fromNumber(quoteBank!.stablePriceModel.stablePrice), quoteBank!.mintDecimals, ) diff --git a/package.json b/package.json index a08f21e6..bfb13180 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "dependencies": { "@blockworks-foundation/mango-feeds": "0.1.7", "@blockworks-foundation/mango-mints-redemption": "^0.0.10", - "@blockworks-foundation/mango-v4": "0.33.4", + "@blockworks-foundation/mango-v4": "0.33.5", "@blockworks-foundation/mango-v4-settings": "0.14.24", "@blockworks-foundation/mangolana": "0.1.1", "@headlessui/react": "1.6.6", diff --git a/pages/dashboard/index.tsx b/pages/dashboard/index.tsx index 04697b8c..892e47c4 100644 --- a/pages/dashboard/index.tsx +++ b/pages/dashboard/index.tsx @@ -5,6 +5,7 @@ import { PriceImpact, OracleProvider, toUiDecimalsForQuote, + Group, } from '@blockworks-foundation/mango-v4' import ExplorerLink from '@components/shared/ExplorerLink' import { BorshAccountsCoder } from '@coral-xyz/anchor' @@ -387,7 +388,8 @@ const Dashboard: NextPage = () => { /> { /> } /> + { - const { lastUpdatedSlot } = await group.decodePriceFromOracleAi( + const { lastUpdatedSlot } = await Group.decodePriceFromOracleAi( + group, coder, bank.oracle, info, diff --git a/utils/governance/listingTools.ts b/utils/governance/listingTools.ts index 50f94924..135c406d 100644 --- a/utils/governance/listingTools.ts +++ b/utils/governance/listingTools.ts @@ -353,7 +353,8 @@ export const getFormattedBankValues = (group: Group, bank: Bank) => { publicKey: bank.publicKey.toBase58(), vault: bank.vault.toBase58(), oracle: bank.oracle.toBase58(), - stablePrice: group.toUiPrice( + stablePrice: Group.toUiPrice( + group, I80F48.fromNumber(bank.stablePriceModel.stablePrice), bank.mintDecimals, ), diff --git a/yarn.lock b/yarn.lock index 6617821c..cd31ccb2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -401,10 +401,10 @@ bn.js "^5.2.1" eslint-config-prettier "^9.0.0" -"@blockworks-foundation/mango-v4@0.33.4": - version "0.33.4" - resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.33.4.tgz#11f17eb066e1e3456f93b67e67b2920ee9a2872c" - integrity sha512-ASsxGYoXTFIYx2ougn9OseUi/y8Vd+KZJ4tFknhB8VtfV8RQ8iTcDVaaVhyZ6zfLJ2D0JBcwFS/DIfY7kzQKug== +"@blockworks-foundation/mango-v4@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.33.5.tgz#56ff1c3d6120acfb1abc6af937017b2517ee2348" + integrity sha512-MNACUyUpWlLRDh4EAYdXaPlioQYaN2wBsn2gLfvJllTsmyWq4CDCUZv6gtvcTe9XFxxLQpzMBrgm7nADmzCEHQ== dependencies: "@blockworks-foundation/mango-v4-settings" "0.14.24" "@blockworks-foundation/mangolana" "0.1.0" @@ -491,7 +491,7 @@ resolved "https://registry.yarnpkg.com/@contentful/rich-text-types/-/rich-text-types-16.3.4.tgz#c5fc9c834dde03d4c4ee189900d304ce1888a74b" integrity sha512-PyVSrQa5j1hO4grgA0Ivo/taiOvW0uFN79JB5JkTG8U7DnWGI7Ap2As6zN6/E6YvDqb7w2cYRMSGSQ3qfxu8HQ== -"@coral-xyz/anchor-30@npm:@coral-xyz/anchor@0.30.1", "switchboard-anchor@npm:@coral-xyz/anchor@0.30.1": +"@coral-xyz/anchor-30@npm:@coral-xyz/anchor@0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== @@ -12763,8 +12763,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -12782,6 +12781,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^3.0.0, string-width@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" @@ -12884,8 +12892,7 @@ stringify-entities@^4.0.0: character-entities-html4 "^2.0.0" character-entities-legacy "^3.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: - name strip-ansi-cjs +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -12906,6 +12913,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -13027,6 +13041,27 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +"switchboard-anchor@npm:@coral-xyz/anchor@0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" + integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== + dependencies: + "@coral-xyz/anchor-errors" "^0.30.1" + "@coral-xyz/borsh" "^0.30.1" + "@noble/hashes" "^1.3.1" + "@solana/web3.js" "^1.68.0" + bn.js "^5.1.2" + bs58 "^4.0.1" + buffer-layout "^1.2.2" + camelcase "^6.3.0" + cross-fetch "^3.1.5" + crypto-hash "^1.3.0" + eventemitter3 "^4.0.7" + pako "^2.0.3" + snake-case "^3.0.4" + superstruct "^0.15.4" + toml "^3.0.0" + symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -14341,8 +14376,7 @@ word-wrap@^1.2.5: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - name wrap-ansi-cjs +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -14369,6 +14403,15 @@ wrap-ansi@^6.0.1: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"