upgrade to latest mango-v4 client

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2023-06-21 15:30:45 +02:00
parent 64ea624972
commit dd7716d99a
18 changed files with 47 additions and 58 deletions

View File

@ -49,7 +49,7 @@ import CreateOpenbookMarketModal from '@components/modals/CreateOpenbookMarketMo
import { calculateTradingParameters } from 'utils/governance/listingTools'
import useJupiterMints from 'hooks/useJupiterMints'
import CreateSwitchboardOracleModal from '@components/modals/CreateSwitchboardOracleModal'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
type FormErrors = Partial<Record<keyof TokenListForm, string>>

View File

@ -1,5 +1,5 @@
import InlineNotification from '@components/shared/InlineNotification'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { useWallet } from '@solana/wallet-adapter-react'
import GovernanceStore from '@store/governanceStore'
import { useTranslation } from 'next-i18next'

View File

@ -17,7 +17,7 @@ import {
HandThumbDownIcon,
HandThumbUpIcon,
} from '@heroicons/react/20/solid'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { useEffect, useState } from 'react'
import { MANGO_GOVERNANCE_PROGRAM } from 'utils/governance/constants'
import mangoStore from '@store/mangoStore'

View File

@ -8,7 +8,7 @@ import { MANGO_MINT } from 'utils/constants'
import { PublicKey } from '@solana/web3.js'
import dynamic from 'next/dynamic'
import { tryGetMint } from 'utils/governance/tools'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { useTranslation } from 'next-i18next'
import SheenLoader from '@components/shared/SheenLoader'
import { NoSymbolIcon } from '@heroicons/react/20/solid'

View File

@ -1,6 +1,6 @@
import Tooltip from '@components/shared/Tooltip'
import { CheckCircleIcon } from '@heroicons/react/20/solid'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Governance, ProgramAccount, Proposal } from '@solana/spl-governance'
import { RawMint } from '@solana/spl-token'
import GovernanceStore from '@store/governanceStore'

View File

@ -3,7 +3,7 @@ import VoteResultsBar from './VoteResultBar'
import { fmtTokenAmount } from 'utils/governance/tools'
import { RawMint } from '@solana/spl-token'
import { useTranslation } from 'next-i18next'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
type VoteResultsProps = {
proposal: Proposal

View File

@ -6,7 +6,7 @@ import {
} from '@blockworks-foundation/mango-v4'
import Tooltip from '@components/shared/Tooltip'
import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import mangoStore from '@store/mangoStore'
import { getOracleProvider } from 'hooks/useOracleProvider'
import { useTranslation } from 'next-i18next'

View File

@ -31,7 +31,7 @@ import { Order } from '@project-serum/serum/lib/market'
import { PublicKey } from '@solana/web3.js'
import useLocalStorageState from 'hooks/useLocalStorageState'
import { formatNumericValue, getDecimalCount } from 'utils/numbers'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import Datafeed from 'apis/datafeed'
// import PerpDatafeed from 'apis/mngo/datafeed'
import { CombinedTradeHistory, isMangoError } from 'types'

View File

@ -19,7 +19,7 @@
},
"dependencies": {
"@blockworks-foundation/mango-feeds": "0.1.6",
"@blockworks-foundation/mango-v4": "^0.15.13",
"@blockworks-foundation/mango-v4": "^0.16.4",
"@headlessui/react": "1.6.6",
"@heroicons/react": "2.0.10",
"@metaplex-foundation/js": "0.18.3",
@ -103,6 +103,7 @@
"typescript": "4.9.4"
},
"resolutions": {
"@coral-xyz/anchor": "^0.27.0",
"eslint-config-next/eslint-import-resolver-typescript/tsconfig-paths/json5": "1.0.2"
},
"lavamoat": {

View File

@ -12,7 +12,7 @@ import {
} from '@blockworks-foundation/mango-v4'
import { PublicKey } from '@solana/web3.js'
import { formatNumericValue } from 'utils/numbers'
import { AnchorProvider, web3 } from '@project-serum/anchor'
import { AnchorProvider, web3 } from '@coral-xyz/anchor'
export async function getStaticProps({ locale }: { locale: string }) {
return {

View File

@ -1,4 +1,4 @@
import { AnchorProvider, BN } from '@project-serum/anchor'
import { AnchorProvider, BN } from '@coral-xyz/anchor'
import {
getAllProposals,
getGovernanceAccounts,

View File

@ -2,7 +2,7 @@ import dayjs from 'dayjs'
import produce from 'immer'
import create from 'zustand'
import { subscribeWithSelector } from 'zustand/middleware'
import { AnchorProvider, BN, Wallet, web3 } from '@project-serum/anchor'
import { AnchorProvider, BN, Wallet, web3 } from '@coral-xyz/anchor'
import { Connection, Keypair, PublicKey } from '@solana/web3.js'
import { OpenOrders, Order } from '@project-serum/serum/lib/market'
import { Orderbook } from '@project-serum/serum'

View File

@ -1,4 +1,4 @@
import { AnchorProvider, Program } from '@project-serum/anchor'
import { AnchorProvider, Program } from '@coral-xyz/anchor'
import { PythHttpClient } from '@pythnetwork/client'
import { notify } from 'utils/notifications'
import { MAINNET_PYTH_PROGRAM } from './constants'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
Governance,
MintMaxVoteWeightSource,

View File

@ -8,7 +8,7 @@ import {
import { Connection, PublicKey } from '@solana/web3.js'
import { TokenProgramAccount } from './accounts/vsrAccounts'
import { MintLayout, RawMint } from '@solana/spl-token'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
export async function fetchRealm({
connection,

View File

@ -1,5 +1,5 @@
import { Program, Provider, web3 } from '@coral-xyz/anchor'
import { Idl } from '@project-serum/anchor'
import { Idl } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
export const DEFAULT_VSR_ID = new web3.PublicKey(

View File

@ -1,17 +1,34 @@
import { Wallet } from '@project-serum/anchor'
import { Keypair, PublicKey, Transaction } from '@solana/web3.js'
import { Wallet } from '@coral-xyz/anchor'
import { isVersionedTransaction } from '@solana/wallet-adapter-base'
import {
Keypair,
PublicKey,
Transaction,
VersionedTransaction,
} from '@solana/web3.js'
export default class EmptyWallet implements Wallet {
constructor(readonly payer: Keypair) {}
async signTransaction(tx: Transaction): Promise<Transaction> {
tx.partialSign(this.payer)
async signTransaction<T extends Transaction | VersionedTransaction>(
tx: T
): Promise<T> {
if (isVersionedTransaction(tx)) {
tx.sign([this.payer])
} else {
tx.partialSign(this.payer)
}
return tx
}
async signAllTransactions(txs: Transaction[]): Promise<Transaction[]> {
async signAllTransactions<T extends Transaction | VersionedTransaction>(
txs: T[]
): Promise<T[]> {
return txs.map((t) => {
t.partialSign(this.payer)
if (isVersionedTransaction(t)) {
t.sign([this.payer])
} else {
t.partialSign(this.payer)
}
return t
})
}

View File

@ -21,12 +21,12 @@
dependencies:
ws "^8.13.0"
"@blockworks-foundation/mango-v4@^0.15.13":
version "0.15.13"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.15.13.tgz#adbfb63a69fc94ddaed9a7d65733e881335d092d"
integrity sha512-akqs0LYK7sjD5mqxwGWBaN7AaPIgDhdUswRWjFRCRXJy1B9la2pmJv9iWjXFU9DDWPORrpu5psFZ0NZ8hYKpnA==
"@blockworks-foundation/mango-v4@^0.16.4":
version "0.16.4"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.16.4.tgz#b1783c4c29ec7078ebe0af88bff15824edc7df16"
integrity sha512-WzDPQ2iwAF1O4e9Dk0+DCzrJB8WChmo+xj4PVyNcqTaDFLwZtw4uW5swzFs7afLSfRXsIDzTec7BFK1JSoMB2Q==
dependencies:
"@coral-xyz/anchor" "^0.26.0"
"@coral-xyz/anchor" "^0.27.0"
"@project-serum/serum" "0.13.65"
"@pythnetwork/client" "~2.14.0"
"@solana/spl-token" "0.3.7"
@ -84,28 +84,7 @@
eventemitter3 "^4.0.7"
uuid "^8.3.2"
"@coral-xyz/anchor@^0.26.0":
version "0.26.0"
resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.26.0.tgz#c8e4f7177e93441afd030f22d777d54d0194d7d1"
integrity sha512-PxRl+wu5YyptWiR9F2MBHOLLibm87Z4IMUBPreX+DYBtPM+xggvcPi0KAN7+kIL4IrIhXI8ma5V0MCXxSN1pHg==
dependencies:
"@coral-xyz/borsh" "^0.26.0"
"@solana/web3.js" "^1.68.0"
base64-js "^1.5.1"
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"
js-sha256 "^0.9.0"
pako "^2.0.3"
snake-case "^3.0.4"
superstruct "^0.15.4"
toml "^3.0.0"
"@coral-xyz/anchor@^0.27.0":
"@coral-xyz/anchor@^0.26.0", "@coral-xyz/anchor@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.27.0.tgz#621e5ef123d05811b97e49973b4ed7ede27c705c"
integrity sha512-+P/vPdORawvg3A9Wj02iquxb4T0C5m4P6aZBVYysKl4Amk+r6aMPZkUhilBkD6E4Nuxnoajv3CFykUfkGE0n5g==
@ -126,14 +105,6 @@
superstruct "^0.15.4"
toml "^3.0.0"
"@coral-xyz/borsh@^0.26.0":
version "0.26.0"
resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.26.0.tgz#d054f64536d824634969e74138f9f7c52bbbc0d5"
integrity sha512-uCZ0xus0CszQPHYfWAqKS5swS1UxvePu83oOF+TWpUkedsNlg6p2p4azxZNSSqwXb9uXMFgxhuMBX9r3Xoi0vQ==
dependencies:
bn.js "^5.1.2"
buffer-layout "^1.2.0"
"@coral-xyz/borsh@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.27.0.tgz#700c647ea5262b1488957ac7fb4e8acf72c72b63"