Update anchor dependency to use @coral-xyz/anchor 0.26.0. (#1380)

* Update anchor dependency to use @coral-xyz/anchor 0.26.0.

* Fix link to Anchor

* Update anchor dependency to use @coral-xyz/anchor 0.26.0.

* Update borsh dependency to use @coral-xyz/borsh 0.26.0.

---------

Co-authored-by: Artyom Nesterenko <code+github@nesterenko.dev>
This commit is contained in:
Daniel Kelleher 2023-02-07 20:29:32 +01:00 committed by GitHub
parent 4d12a954c3
commit bac124ac32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
101 changed files with 529 additions and 224 deletions

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { MaxVoterWeightRecord, ProgramAccount } from '@solana/spl-governance'
import { VotingClient } from '@utils/uiTypes/VotePlugin'
import create, { State } from 'zustand'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { MaxVoterWeightRecord, ProgramAccount } from '@solana/spl-governance'
import { NFTWithMeta, VotingClient } from '@utils/uiTypes/VotePlugin'
import create, { State } from 'zustand'

View File

@ -2,7 +2,7 @@
## To set this up for development with Switchboard, the first step is to get [this](https://github.com/switchboard-xyz/switchboard-core/blob/main/switchboard_v2/tests/addin-tests.ts) to work.
- [install anchor](https://project-serum.github.io/anchor/getting-started/installation.html#installing-dependencies)[install anchor](https://project-serum.github.io/anchor/getting-started/installation.html#installing-dependencies) if you don't currently have it installed
- [Install Anchor](https://www.anchor-lang.com/docs/installation) if you don't currently have it installed.
- navigate to the `switchboard_v2` directory within `switchboard-core` and run `anchor test`. This will build switchboardv2 and run the addin-tests.ts script, which will set up a realm, governance, queue, oracles, permissions, and proposal.
- you will need to make sure the pubkeys of the governance program and switchboard program throughout the codebase are pointed to your local pubkeys of those programs:
- you can determine the pubkeys of the localnet switchboardv2 and governance programs by navigating to `switchboard-core/switchboard_v2/target/deploy` and running `solana-keygen pubkey switchboard_v2-keypair.json` and `solana-keygen pubkey spl_governance-keypair.json` respectively

View File

@ -9,7 +9,7 @@ import useGovernanceAssets from '@hooks/useGovernanceAssets'
import useQueryContext from '@hooks/useQueryContext'
import useRealm from '@hooks/useRealm'
import { getProgramVersionForRealm } from '@models/registry/api'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { RpcContext } from '@solana/spl-governance'
import { PublicKey } from '@solana/web3.js'
import {

View File

@ -1,4 +1,4 @@
import { AnchorProvider, Program } from '@project-serum/anchor'
import { AnchorProvider, Program } from '@coral-xyz/anchor'
import { PsyFiEuros, PsyFiIdl } from 'psyfi-euros-test'
import { useMemo } from 'react'
import useWalletStore from 'stores/useWalletStore'

View File

@ -7,7 +7,7 @@ import useGovernanceAssets from '@hooks/useGovernanceAssets'
import useQueryContext from '@hooks/useQueryContext'
import useRealm from '@hooks/useRealm'
import { getProgramVersionForRealm } from '@models/registry/api'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { RpcContext } from '@solana/spl-governance'
import {
getMintDecimalAmount,

View File

@ -7,7 +7,7 @@ import useGovernanceAssets from '@hooks/useGovernanceAssets'
import useQueryContext from '@hooks/useQueryContext'
import useRealm from '@hooks/useRealm'
import { getProgramVersionForRealm } from '@models/registry/api'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { RpcContext } from '@solana/spl-governance'
import {
getMintMinAmountAsDecimal,

View File

@ -5,7 +5,7 @@ import {
RpcContext,
TokenOwnerRecord,
} from '@solana/spl-governance'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { AssetAccount } from '@utils/uiTypes/assets'
import { ConnectionContext } from '@utils/connection'
import { VotingClient } from '@utils/uiTypes/VotePlugin'

View File

@ -1,4 +1,4 @@
import { Program } from '@project-serum/anchor'
import { Program } from '@coral-xyz/anchor'
import {
RpcContext,
serializeInstructionToBase64,

View File

@ -18,7 +18,7 @@ import {
RpcContext,
TokenOwnerRecord,
} from '@solana/spl-governance'
import { Program } from '@project-serum/anchor'
import { Program } from '@coral-xyz/anchor'
import { AssetAccount } from '@utils/uiTypes/assets'
import { PublicKey } from '@solana/web3.js'
import { VotingClient } from '@utils/uiTypes/VotePlugin'

View File

@ -1,4 +1,4 @@
import { BN, Program } from '@project-serum/anchor'
import { BN, Program } from '@coral-xyz/anchor'
import {
ProgramAccount,
Realm,

View File

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

View File

@ -1,4 +1,4 @@
import { Program, Provider } from '@project-serum/anchor'
import { Program, Provider } from '@coral-xyz/anchor'
import { PublicKey, Transaction } from '@solana/web3.js'
import { Switchboard, IDL } from './SwitchboardIdl'
//import { NftVoter, IDL } from './nft_voter';

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import create, { State } from 'zustand'
import { PublicKey, TransactionInstruction } from '@solana/web3.js'
import { VotingClient } from '@utils/uiTypes/VotePlugin'

View File

@ -1,6 +1,6 @@
import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY } from '@solana/web3.js'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
getRegistrarPDA,
getVoterPDA,

View File

@ -7,7 +7,7 @@ import {
import { RpcContext } from '@solana/spl-governance'
import { sendTransaction } from 'utils/send'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { withVoteRegistryDeposit } from '../sdk/withVoteRegistryDeposit'
import { VsrClient } from 'VoteStakeRegistry/sdk/client'

View File

@ -7,7 +7,7 @@ import {
import { RpcContext, TOKEN_PROGRAM_ID } from '@solana/spl-governance'
import { sendTransaction } from 'utils/send'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { LockupType } from 'VoteStakeRegistry/sdk/accounts'
import { withCreateNewDeposit } from '../sdk/withCreateNewDeposit'
import { getPeriod } from 'VoteStakeRegistry/tools/deposits'

View File

@ -7,7 +7,7 @@ import {
import { RpcContext } from '@solana/spl-governance'
import { sendTransaction } from 'utils/send'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { withCreateNewDeposit } from '../sdk/withCreateNewDeposit'
import { VsrClient } from 'VoteStakeRegistry/sdk/client'

View File

@ -1,5 +1,5 @@
import { PublicKey, TransactionInstruction } from '@solana/web3.js'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { withVoteRegistryWithdraw } from '../sdk/withVoteRegistryWithdraw'
import { RpcContext } from '@solana/spl-governance'
import { VsrClient } from 'VoteStakeRegistry/sdk/client'

View File

@ -24,7 +24,7 @@ import { abbreviateAddress } from '@utils/formatting'
import { notify } from '@utils/notifications'
import useVotePluginsClientStore from 'stores/useVotePluginsClientStore'
import dayjs from 'dayjs'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
const DepositCard = ({ deposit }: { deposit: DepositWithMintAccount }) => {
const { getOwnedDeposits } = useDepositStore()

View File

@ -13,7 +13,7 @@ import PreviousRouteBtn from '@components/PreviousRouteBtn'
import VotingPowerBox from '../TokenBalance/VotingPowerBox'
import { PublicKey } from '@solana/web3.js'
import { MintInfo } from '@solana/spl-token'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import tokenPriceService from '@utils/services/tokenPrice'
import useWalletStore from 'stores/useWalletStore'
import { getDeposits } from 'VoteStakeRegistry/tools/deposits'

View File

@ -6,7 +6,7 @@ import Modal from '@components/Modal'
import { QuestionMarkCircleIcon } from '@heroicons/react/outline'
import useRealm from '@hooks/useRealm'
import { getProgramVersionForRealm } from '@models/registry/api'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { RpcContext } from '@solana/spl-governance'
import {
fmtMintAmount,

View File

@ -1,5 +1,5 @@
import { BN } from '@project-serum/anchor'
import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes'
import { BN } from '@coral-xyz/anchor'
import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes'
import {
ProposalTransaction,
getGovernanceSchemaForAccount,

View File

@ -3,7 +3,7 @@ import { SecondaryButton } from '@components/Button'
import Loading from '@components/Loading'
import useRealm from '@hooks/useRealm'
import { getProgramVersionForRealm } from '@models/registry/api'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { RpcContext } from '@solana/spl-governance'
import { notify } from '@utils/notifications'
import { useState } from 'react'

View File

@ -1,5 +1,5 @@
import BigNumber from 'bignumber.js'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { MintInfo } from '@solana/spl-token'
import { getMintDecimalAmount } from '@tools/sdk/units'
import { LightningBoltIcon } from '@heroicons/react/solid'

View File

@ -1,7 +1,7 @@
import { SecondaryButton } from '@components/Button'
import useRealm from '@hooks/useRealm'
import { getUnrelinquishedVoteRecords } from '@models/api'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
getProposal,
ProposalState,

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { MintInfo } from '@solana/spl-token'
import { PublicKey } from '@solana/web3.js'
import { TokenProgramAccount } from '@utils/tokens'

View File

@ -1,4 +1,4 @@
import { Program, Provider, web3 } from '@project-serum/anchor'
import { Program, Provider, web3 } from '@coral-xyz/anchor'
import { IDL, VoterStakeRegistry } from './voter_stake_registry'
export const DEFAULT_VSR_ID = new web3.PublicKey(

View File

@ -1,6 +1,6 @@
import { PublicKey, TransactionInstruction } from '@solana/web3.js'
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { LockupType } from 'VoteStakeRegistry/sdk/accounts'
import { withCreateNewDeposit } from './withCreateNewDeposit'
import { VsrClient } from './client'

View File

@ -4,7 +4,7 @@ import {
Token,
TOKEN_PROGRAM_ID,
} from '@solana/spl-token'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
getRegistrarPDA,
getVoterPDA,

View File

@ -1,7 +1,7 @@
import create, { State } from 'zustand'
import { DepositWithMintAccount } from 'VoteStakeRegistry/sdk/accounts'
import { Connection, PublicKey } from '@solana/web3.js'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { getDeposits } from 'VoteStakeRegistry/tools/deposits'
import { VsrClient } from 'VoteStakeRegistry/sdk/client'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { DepositWithMintAccount } from 'VoteStakeRegistry/sdk/accounts'
export const DAYS_PER_YEAR = 365

View File

@ -1,4 +1,4 @@
import { BN, EventParser } from '@project-serum/anchor'
import { BN, EventParser, Idl, Program } from '@coral-xyz/anchor'
import { ProgramAccount, Realm } from '@solana/spl-governance'
import { MintInfo } from '@solana/spl-token'
import { PublicKey, Transaction, Connection } from '@solana/web3.js'
@ -27,6 +27,15 @@ const DEPOSIT_EVENT_NAME = 'DepositEntryInfo'
// Note: when running a local validator ensure the account is copied from devnet: --clone ENmcpFCpxN1CqyUjuog9yyUVfdXBKF3LVCwLr7grJZpk -ud
const simulationWallet = new PublicKey(SIMULATION_WALLET)
const logsToEvents = <T extends Idl>(program: Program<T>, logs: string[], walletPk: string):{
walletPk: string
event: any
}[] => {
const parser = new EventParser(program.programId, program.coder)
const errors = parser.parseLogs(logs);
return [...errors].map((event) =>({ event, walletPk }));
}
export const getDeposits = async ({
isUsed = true,
realmPk,
@ -152,8 +161,6 @@ export const getVotingPowersForWallets = async ({
walletPk: string
event: any
}[] = []
const parser = new EventParser(client.program.programId, client.program.coder)
for (const walletPk of walletPks) {
const { voter } = await getVoterPDA(registrarPk, walletPk, clientProgramId)
voterPks.push(voter)
@ -249,12 +256,7 @@ export const getVotingPowersForWallets = async ({
const logsJsons = await Promise.all(simulations.map((x) => x.json()))
for (const logJson of logsJsons) {
for (const result of logJson) {
parser.parseLogs(result.result.value.logs!, (event) => {
events.push({
event: event,
walletPk: result.id,
})
})
events.push(...logsToEvents(client.program, result.result.value.logs!, result.id))
}
}
@ -385,9 +387,8 @@ const getDepositsAdditionalInfoEvents = async (
.instruction()
transaction.add(logVoterInfoIx)
const batchOfDeposits = await connection.simulateTransaction(transaction)
parser.parseLogs(batchOfDeposits.value.logs!, (event) => {
events.push(event)
})
const logEvents = parser.parseLogs(batchOfDeposits.value.logs!)
events.push(...[...logEvents]);
}
return events
}

View File

@ -5,7 +5,7 @@ import {
withSetRealmAuthority,
} from '@solana/spl-governance'
import { Keypair, PublicKey, TransactionInstruction } from '@solana/web3.js'
import { AnchorProvider, Wallet } from '@project-serum/anchor'
import { AnchorProvider, Wallet } from '@coral-xyz/anchor'
import {
SequenceType,
sendTransactionsV3,

View File

@ -15,7 +15,7 @@ import { SignerWalletAdapter } from '@solana/wallet-adapter-base'
import { useTheme } from 'next-themes'
import { useEffect, useMemo, useState } from 'react'
import useWalletStore from 'stores/useWalletStore'
import { web3 } from '@project-serum/anchor'
import { web3 } from '@coral-xyz/anchor'
const REALMS_PUBLIC_KEY = new web3.PublicKey(
'BUxZD6aECR5B5MopyvvYqJxwSKDBhx2jSSo1U32en6mj'

View File

@ -1,5 +1,5 @@
import * as yup from 'yup'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import { yupResolver } from '@hookform/resolvers/yup'
import useTokenAccountBalance from '@hooks/useTokenAccountBalance'
import useWallet from '@hooks/useWallet'

View File

@ -1,5 +1,5 @@
import * as yup from 'yup'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import { yupResolver } from '@hookform/resolvers/yup'
import {
fmtBnMintDecimals,

View File

@ -1,5 +1,5 @@
import * as yup from 'yup'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import { yupResolver } from '@hookform/resolvers/yup'
import useWallet from '@hooks/useWallet'
import {

View File

@ -1,5 +1,5 @@
import useTotalTokenValue from '@hooks/useTotalTokenValue'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { getMintDecimalAmountFromNatural } from '@tools/sdk/units'
import BigNumber from 'bignumber.js'
import useTreasuryAccountStore from 'stores/useTreasuryAccountStore'

View File

@ -5,7 +5,7 @@ import Button from '@components/Button'
import Tooltip from '@components/Tooltip'
import { NFTWithMint } from '@utils/uiTypes/nfts'
import { notify } from '@utils/notifications'
import { web3 } from '@project-serum/anchor'
import { web3 } from '@coral-xyz/anchor'
import {
ASSOCIATED_TOKEN_PROGRAM_ID,
Token,

View File

@ -34,7 +34,7 @@ import useRealm from '@hooks/useRealm'
import Button from '@components/Button'
import Tooltip from '@components/Tooltip'
import useGovernanceAssets from '@hooks/useGovernanceAssets'
import { BN, Program, web3 } from '@project-serum/anchor'
import { BN, Program, web3 } from '@coral-xyz/anchor'
import { getValidatedPublickKey } from '@utils/validations'
import { validateInstruction } from '@utils/instructionTools'
import {

View File

@ -28,7 +28,7 @@ import {
} from 'VoteStakeRegistry/tools/dateTools'
import {
getCastleReconcileInstruction,
getCastleRefreshInstruction,
getCastleRefreshInstructions,
} from '@utils/instructions/Castle'
import Wallet from '@project-serum/sol-wallet-adapter'
@ -99,11 +99,11 @@ export function ExecuteInstructionButton({
switch (instructionOption) {
case InstructionOptions.castleRefresh:
adjacentTransaction = new Transaction().add(
await getCastleRefreshInstruction(
rpcContext.connection,
(wallet as unknown) as Wallet,
proposalInstruction
)
...await getCastleRefreshInstructions(
rpcContext.connection,
(wallet as unknown) as Wallet,
proposalInstruction
)
)
break
case InstructionOptions.castleReconcileRefresh: {
@ -113,11 +113,11 @@ export function ExecuteInstructionButton({
proposalInstruction
)
adjacentTransaction = new Transaction().add(
await getCastleRefreshInstruction(
rpcContext.connection,
(wallet as unknown) as Wallet,
proposalInstruction
)
...await getCastleRefreshInstructions(
rpcContext.connection,
(wallet as unknown) as Wallet,
proposalInstruction
)
)
break
}

View File

@ -1,5 +1,5 @@
import { Connection, PublicKey } from '@solana/web3.js'
import { utils } from '@project-serum/anchor'
import { utils } from '@coral-xyz/anchor'
import {
consts,
generatedTypes,

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Connection, PublicKey } from '@solana/web3.js'
import { getMintDecimalAmountFromNatural } from '@tools/sdk/units'
import { tryGetMint } from '@utils/tokens'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Connection, PublicKey } from '@solana/web3.js'
import { getMintDecimalAmountFromNatural } from '@tools/sdk/units'
import { tryGetMint } from '@utils/tokens'

View File

@ -1,5 +1,5 @@
import { Wallet } from '@marinade.finance/marinade-ts-sdk'
import { AnchorProvider, BorshInstructionCoder } from '@project-serum/anchor'
import { AnchorProvider, BorshInstructionCoder } from '@coral-xyz/anchor'
import { NftVoterClient } from '@solana/governance-program-library'
import { AccountMetaData, getRealm } from '@solana/spl-governance'
import { Connection, Keypair } from '@solana/web3.js'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Connection, PublicKey } from '@solana/web3.js'
import { getMintDecimalAmountFromNatural } from '@tools/sdk/units'
import { tryGetMint } from '@utils/tokens'

View File

@ -3,7 +3,7 @@ import {
AnchorProvider,
BN,
BorshInstructionCoder,
} from '@project-serum/anchor'
} from '@coral-xyz/anchor'
import { AccountMetaData } from '@solana/spl-governance'
import { Connection, Keypair, PublicKey } from '@solana/web3.js'
import { fmtMintAmount } from '@tools/sdk/units'

View File

@ -2,7 +2,7 @@ import cx from 'classnames'
import { TokenOwnerRecordAsset } from '@models/treasury/Asset'
import { UserGroupIcon } from '@heroicons/react/solid'
import { fmtMintAmount } from '@tools/sdk/units'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import Button from '@components/Button'
import { useState } from 'react'
import { notify } from '@utils/notifications'

View File

@ -1,4 +1,4 @@
import { AnchorProvider } from '@project-serum/anchor'
import { AnchorProvider } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
import { ConnectionContext } from '@utils/connection'
import { WalletSigner } from '@solana/spl-governance'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Proposal, ProposalState } from '@solana/spl-governance'
import useNftPluginStore from 'NftVotePlugin/store/nftPluginStore'
import { getProposalMaxVoteWeight } from '../models/voteWeights'

View File

@ -2,7 +2,7 @@ import useWallet from './useWallet'
import useSWR from 'swr'
import { Connection, PublicKey } from '@solana/web3.js'
import useSerumGovUser from './useSerumGovUser'
import { AnchorProvider, Idl, Program } from '@project-serum/anchor'
import { AnchorProvider, Idl, Program } from '@coral-xyz/anchor'
import IDL from '../idls/serum_gov.json'
import useSerumGovStore, {
ClaimTicketType,

View File

@ -1,4 +1,4 @@
import { AnchorProvider, BN, Idl, Program } from '@project-serum/anchor'
import { AnchorProvider, BN, Idl, Program } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
import useSerumGovStore, { UserAccountType } from 'stores/useSerumGovStore'
import useSWR from 'swr'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { getMintDecimalAmountFromNatural } from '@tools/sdk/units'
import tokenPriceService from '@utils/services/tokenPrice'
import BigNumber from 'bignumber.js'

View File

@ -16,7 +16,7 @@ import useRealm from '@hooks/useRealm'
import { buildTopVoters, VoteType } from '@models/proposal'
import useVotePluginsClientStore from 'stores/useVotePluginsClientStore'
import { getLockTokensVotingPowerPerWallet } from 'VoteStakeRegistry/tools/deposits'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { PublicKey } from '@blockworks-foundation/mango-client'
import useWalletStore from 'stores/useWalletStore'
import useGovernanceAssetsStore from 'stores/useGovernanceAssetsStore'

View File

@ -18,7 +18,7 @@ import {
} from '@solana/spl-governance'
import { getMaxVoterWeightRecord as getPluginMaxVoterWeightRecord } from '@utils/plugin/accounts'
import { notify } from '@utils/notifications'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import * as sbv2 from '@switchboard-xyz/switchboard-v2'
import sbIdl from 'SwitchboardVotePlugin/switchboard_v2.json'
import gonIdl from 'SwitchboardVotePlugin/gameofnodes.json'

View File

@ -1,4 +1,4 @@
import { AnchorProvider, Wallet } from '@project-serum/anchor'
import { AnchorProvider, Wallet } from '@coral-xyz/anchor'
import { useMemo } from 'react'
import useWalletStore from '../stores/useWalletStore'

View File

@ -35,7 +35,7 @@
"@carbon/icons-react": "11.7.0",
"@cardinal/namespaces-components": "2.5.5",
"@castlefinance/vault-core": "0.1.3",
"@castlefinance/vault-sdk": "2.1.2",
"@castlefinance/vault-sdk": "3.6.2",
"@civic/profile": "0.1.2",
"@civic/solana-gateway-react": "0.11.0",
"@dialectlabs/react-sdk-blockchain-solana": "1.0.0-beta.3",
@ -59,8 +59,8 @@
"@nivo/bar": "0.79.1",
"@nivo/core": "0.79.0",
"@notifi-network/notifi-react-hooks": "0.18.2",
"@project-serum/anchor": "0.24.2",
"@project-serum/borsh": "0.2.5",
"@coral-xyz/anchor": "0.26.0",
"@coral-xyz/borsh": "0.26.0",
"@project-serum/common": "0.0.1-beta.3",
"@project-serum/serum": "0.13.65",
"@project-serum/sol-wallet-adapter": "0.2.6",
@ -100,7 +100,7 @@
"@solana/web3.js": "1.66.2",
"@solendprotocol/solend-sdk": "0.5.5",
"@streamflow/stream": "3.0.16",
"@switchboard-xyz/switchboard-v2": "0.0.110",
"@switchboard-xyz/switchboard-v2": "0.0.174",
"@tailwindcss/line-clamp": "0.4.2",
"@tanstack/react-query": "4.14.3",
"@tippyjs/react": "4.2.6",
@ -213,7 +213,7 @@
"@types/bn.js": "5.1.0",
"@project-serum/sol-wallet-adapter": "0.2.6",
"@project-serum/serum": "0.13.65",
"@project-serum/borsh": "0.2.5",
"@coral-xyz/borsh": "0.26.0",
"bignumber.js": "9.0.2",
"lodash": "4.17.21",
"@switchboard-xyz/switchboard-v2/mocha": "10.1.0",
@ -226,6 +226,9 @@
"dset": "3.1.2",
"**/@solana/spl-token-registry/cross-fetch/node-fetch": "2.6.7"
},
"browser":{
"child_process": false
},
"browserslist": [
"chrome >= 67",
"edge >= 79",

View File

@ -2,7 +2,7 @@ import Select from '@components/inputs/Select'
import { Governance } from '@solana/spl-governance'
import { ProgramAccount } from '@solana/spl-governance'
import React, { useEffect } from 'react'
import { web3 } from '@project-serum/anchor'
import { web3 } from '@coral-xyz/anchor'
import { StakeAccount, StakeState } from '@utils/uiTypes/assets'
export function getStakeAccountLabelInfo(acc: StakeAccount | undefined) {

View File

@ -16,7 +16,7 @@ import useWalletStore from 'stores/useWalletStore'
import { Config } from '@blockworks-foundation/mango-client'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import { MangoV3ReimbursementClient } from '@blockworks-foundation/mango-v3-reimbursement-lib/dist'
import { AnchorProvider, BN } from '@project-serum/anchor'
import { AnchorProvider, BN } from '@coral-xyz/anchor'
import { NodeWallet } from '@project-serum/common'
import { notify } from '@utils/notifications'
import ClaimMangoTokensTableRow, {

View File

@ -18,7 +18,7 @@ import Input from '@components/inputs/Input'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import { tryGetMint } from '@utils/tokens'
import { makeChangeReferralFeeParamsInstruction } from '@blockworks-foundation/mango-client'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { MANGO_MINT } from 'Strategies/protocols/mango/tools'
import { parseMintNaturalAmountFromDecimal } from '@tools/sdk/units'
import { AccountType } from '@utils/uiTypes/assets'

View File

@ -18,7 +18,7 @@ import Input from '@components/inputs/Input'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import { tryGetMint } from '@utils/tokens'
import { makeChangeReferralFeeParams2Instruction } from '@blockworks-foundation/mango-client'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { MANGO_MINT, MANGO_MINT_DEVNET } from 'Strategies/protocols/mango/tools'
import { parseMintNaturalAmountFromDecimal } from '@tools/sdk/units'
import { AccountType } from '@utils/uiTypes/assets'

View File

@ -16,7 +16,7 @@ import InstructionForm, {
InstructionInputType,
} from '../../FormCreator'
import UseMangoV4 from '../../../../../../../../hooks/useMangoV4'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { getChangedValues, getNullOrTransform } from '@utils/mangoV4Tools'
type GroupEditForm = {

View File

@ -1,5 +1,5 @@
import { Treasury } from '@mean-dao/msp'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Governance, ProgramAccount } from '@solana/spl-governance'
import { useEffect, useState } from 'react'
import useWalletStore from 'stores/useWalletStore'

View File

@ -11,7 +11,7 @@ import { AssetAccount } from '@utils/uiTypes/assets'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import Input from '@components/inputs/Input'
import Tooltip from '@components/Tooltip'
import { Program } from '@project-serum/anchor'
import { Program } from '@coral-xyz/anchor'
import {
PsyAmericanIdl,
PSY_AMERICAN_PROGRAM_ID,

View File

@ -11,7 +11,7 @@ import { AssetAccount } from '@utils/uiTypes/assets'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import Input from '@components/inputs/Input'
import Tooltip from '@components/Tooltip'
import { Program } from '@project-serum/anchor'
import { Program } from '@coral-xyz/anchor'
import {
PsyAmericanIdl,
PSY_AMERICAN_PROGRAM_ID,

View File

@ -10,7 +10,7 @@ import { NewProposalContext } from '../../../new'
import { AssetAccount } from '@utils/uiTypes/assets'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import Input from '@components/inputs/Input'
import { Program } from '@project-serum/anchor'
import { Program } from '@coral-xyz/anchor'
import {
PsyAmericanIdl,
PSY_AMERICAN_PROGRAM_ID,

View File

@ -34,7 +34,7 @@ import {
import useWallet from '@hooks/useWallet'
import { getATA } from '@utils/ataTools'
import { getMintNaturalAmountFromDecimalAsBN } from '@tools/sdk/units'
import { Program } from '@project-serum/anchor'
import { Program } from '@coral-xyz/anchor'
const formReducer = (
state: PsyFinanceMintAmericanOptionsForm,

View File

@ -19,7 +19,7 @@ import useWalletStore from 'stores/useWalletStore'
import useSerumGovStore from 'stores/useSerumGovStore'
import useWallet from '@hooks/useWallet'
import { NewProposalContext } from '../../../new'
import { findProgramAddressSync } from '@project-serum/anchor/dist/cjs/utils/pubkey'
import { findProgramAddressSync } from '@coral-xyz/anchor/dist/cjs/utils/pubkey'
const InitUser = ({
index,

View File

@ -11,7 +11,7 @@ import { useContext, useEffect, useState } from 'react'
import useSerumGovStore, { ConfigAccountType } from 'stores/useSerumGovStore'
import useWalletStore from 'stores/useWalletStore'
import { NewProposalContext } from '../../../new'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
const UpdateConfigParams = ({
index,

View File

@ -3,7 +3,7 @@ import React, { useContext, useEffect, useState } from 'react'
import BigNumber from 'bignumber.js'
import * as yup from 'yup'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
Governance,
ProgramAccount,

View File

@ -3,7 +3,7 @@ import React, { useContext, useEffect, useState } from 'react'
import Input from '@components/inputs/Input'
import BigNumber from 'bignumber.js'
import * as yup from 'yup'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
Governance,
ProgramAccount,

View File

@ -10,7 +10,7 @@ import { PublicKey } from '@solana/web3.js'
import Input from '@components/inputs/Input'
import * as sbv2 from '@switchboard-xyz/switchboard-v2'
import useWalletStore from 'stores/useWalletStore'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import sbIdl from 'SwitchboardVotePlugin/switchboard_v2.json'
import gonIdl from 'SwitchboardVotePlugin/gameofnodes.json'
import {

View File

@ -17,7 +17,7 @@ import { PublicKey } from '@solana/web3.js'
import Input from '@components/inputs/Input'
import * as sbv2 from '@switchboard-xyz/switchboard-v2'
import useWalletStore from 'stores/useWalletStore'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import sbIdl from 'SwitchboardVotePlugin/switchboard_v2.json'
import gonIdl from 'SwitchboardVotePlugin/gameofnodes.json'
import {

View File

@ -14,11 +14,11 @@ import {
} from '@utils/uiTypes/proposalCreationTypes'
import { NewProposalContext } from '../../../new'
import useWalletStore from 'stores/useWalletStore'
import { web3 } from '@project-serum/anchor'
import { web3 } from '@coral-xyz/anchor'
import useGovernanceAssets from '@hooks/useGovernanceAssets'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import { getFilteredProgramAccounts } from '@blockworks-foundation/mango-client'
import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes'
import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes'
import { StakeAccount, StakeState } from '@utils/uiTypes/assets'
import StakeAccountSelect from '../../StakeAccountSelect'

View File

@ -17,10 +17,10 @@ import {
import { NewProposalContext } from '../../../new'
import { isFormValid } from '@utils/formValidation'
import useWalletStore from 'stores/useWalletStore'
import { web3 } from '@project-serum/anchor'
import { web3 } from '@coral-xyz/anchor'
import useGovernanceAssets from '@hooks/useGovernanceAssets'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import { parseMintNaturalAmountFromDecimal } from '@tools/sdk/units'
import useRealm from '@hooks/useRealm'
import { SOLANA_VALIDATOR_DAO_PROGRAM_ID } from '@components/instructions/programs/validatordao'

View File

@ -16,13 +16,13 @@ import {
import { NewProposalContext } from '../../../new'
import { isFormValid } from '@utils/formValidation'
import useWalletStore from 'stores/useWalletStore'
import { web3 } from '@project-serum/anchor'
import { web3 } from '@coral-xyz/anchor'
import useGovernanceAssets from '@hooks/useGovernanceAssets'
import GovernedAccountSelect from '../../GovernedAccountSelect'
import { getFilteredProgramAccounts } from '@blockworks-foundation/mango-client'
import StakeAccountSelect from '../../StakeAccountSelect'
import Input from '@components/inputs/Input'
import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes'
import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes'
import { StakeAccount, StakeState } from '@utils/uiTypes/assets'
import { parseMintNaturalAmountFromDecimal } from '@tools/sdk/units'

View File

@ -17,7 +17,7 @@ import useGovernanceAssets from '@hooks/useGovernanceAssets'
import { SYSVAR_RENT_PUBKEY } from '@solana/web3.js'
import { getRegistrarPDA } from 'VoteStakeRegistry/sdk/accounts'
import { DEFAULT_VSR_ID, VsrClient } from 'VoteStakeRegistry/sdk/client'
import { web3 } from '@project-serum/anchor'
import { web3 } from '@coral-xyz/anchor'
import useWallet from '@hooks/useWallet'
interface CreateVsrRegistrarForm {

View File

@ -20,7 +20,7 @@ import { AssetAccount } from '@utils/uiTypes/assets'
import useGovernanceAssets from '@hooks/useGovernanceAssets'
import { getScaledFactor } from '@utils/tokens'
import { yearsToSecs } from 'VoteStakeRegistry/tools/dateTools'
import { BN, web3 } from '@project-serum/anchor'
import { BN, web3 } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
import {
emptyPk,

View File

@ -5,7 +5,7 @@ import { MANGO_DAO_TREASURY } from '@components/instructions/tools'
import PreviousRouteBtn from '@components/PreviousRouteBtn'
import { SearchIcon, UserCircleIcon } from '@heroicons/react/outline'
import useRealm from '@hooks/useRealm'
import { BN, BorshInstructionCoder } from '@project-serum/anchor'
import { BN, BorshInstructionCoder } from '@coral-xyz/anchor'
import {
GovernanceAccountType,
InstructionExecutionStatus,

View File

@ -1,6 +1,6 @@
import { getAssociatedTokenAddress } from '@blockworks-foundation/mango-v4'
import * as anchor from '@project-serum/anchor'
import { findProgramAddressSync } from '@project-serum/anchor/dist/cjs/utils/pubkey'
import * as anchor from '@coral-xyz/anchor'
import { findProgramAddressSync } from '@coral-xyz/anchor/dist/cjs/utils/pubkey'
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
import {
Connection,

View File

@ -6,7 +6,7 @@ import {
import { SwitchboardQueueVoterClient } from '../SwitchboardVotePlugin/SwitchboardQueueVoterClient'
import { getRegistrarPDA, Registrar } from 'VoteStakeRegistry/sdk/accounts'
import { getRegistrarPDA as getPluginRegistrarPDA } from '@utils/plugin/accounts'
import { AnchorProvider, Wallet } from '@project-serum/anchor'
import { AnchorProvider, Wallet } from '@coral-xyz/anchor'
import { tryGetNftRegistrar, tryGetRegistrar } from 'VoteStakeRegistry/sdk/api'
import { SignerWalletAdapter } from '@solana/wallet-adapter-base'
import { ConnectionContext } from '@utils/connection'
@ -191,11 +191,10 @@ const useVotePluginsClientStore = create<UseVotePluginsClientStore>(
connection.cluster
)
const maxVoterWeight = (
await pythClient.stakeConnection.program.methods
const updateMaxVoterWeightKeys = await pythClient.stakeConnection.program.methods
.updateMaxVoterWeight()
.pubkeys()
).maxVoterRecord
.pubkeys();
const maxVoterWeight = updateMaxVoterWeightKeys.maxVoterRecord as PublicKey;
set((s) => {
s.state.pythClient = pythClient

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
import { depositReserveLiquidityAndObligationCollateralInstruction } from '@solendprotocol/solend-sdk'
import { SupportedMintName } from './configuration'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
import { withdrawObligationCollateralAndRedeemReserveLiquidity as originalWithdrawFunction } from '@solendprotocol/solend-sdk'
import { findATAAddrSync } from '@utils/ataTools'

View File

@ -1,4 +1,4 @@
import { BN, ProgramAccount } from '@project-serum/anchor'
import { BN, ProgramAccount } from '@coral-xyz/anchor'
import { MintInfo } from '@solana/spl-token'
import { TokenInfoWithoutDecimals } from '@utils/services/tokenPrice'
import { BigNumber } from 'bignumber.js'

View File

@ -7,7 +7,7 @@ import {
Proposal,
VoteTipping,
} from '@solana/spl-governance'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
getMintNaturalAmountFromDecimal,
getTimestampFromDays,
@ -18,7 +18,7 @@ import { createGovernanceThresholds } from '@tools/governance/configs'
import { PublicKey } from '@blockworks-foundation/mango-client'
import { ConnectionContext } from './connection'
import axios from 'axios'
import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes'
import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes'
export interface GovernanceConfigValues {
minTokensToCreateProposal: number | string

View File

@ -1,4 +1,4 @@
import { utils } from '@project-serum/anchor'
import { utils } from '@coral-xyz/anchor'
import {
ASSOCIATED_TOKEN_PROGRAM_ID,
Token,

View File

@ -17,7 +17,7 @@ import {
SystemProgram,
TransactionInstruction,
} from '@solana/web3.js'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Marinade, MarinadeConfig } from '@marinade.finance/marinade-ts-sdk'
import {
getMintNaturalAmountFromDecimal,

View File

@ -5,7 +5,7 @@ import {
Clusters,
} from '@castlefinance/vault-core'
import { VaultClient } from '@castlefinance/vault-sdk'
import { Provider } from '@castlefinance/vault-sdk/node_modules/@project-serum/anchor'
import { AnchorProvider } from '@coral-xyz/anchor'
import { AnchorWallet } from '@friktion-labs/friktion-sdk/dist/cjs/src/miscUtils'
import {
serializeInstructionToBase64,
@ -105,7 +105,7 @@ export async function getCastleDepositInstruction({
// Get the deposit instruction
const { decimals } = governedTokenAccount.extensions.mint.account
const depositIx = vaultClient.getDepositIx(
const depositIx = await vaultClient.getDepositIx(
new BN(amount * Math.pow(10, decimals)),
reserveTokenOwner,
userLpTokenAccount,
@ -207,7 +207,7 @@ export async function getCastleWithdrawInstruction({
// into the vault in exchange for the reserve token
const { decimals } = governedTokenAccount.extensions.mint.account
const withdrawIx = vaultClient.getWithdrawIx(
const withdrawIx = await vaultClient.getWithdrawIx(
new BN(amount * Math.pow(10, decimals)),
lpTokenAccountOwner,
governedTokenAccount.pubkey,
@ -274,7 +274,7 @@ export async function getCastleReconcileInstruction(
* @param instructionOption
* @returns Refresh transaction for the specified mint vault
*/
export async function getCastleRefreshInstruction(
export async function getCastleRefreshInstructions(
connection: Connection,
wallet: any,
instruction: ProgramAccount<ProposalTransaction>
@ -285,9 +285,9 @@ export async function getCastleRefreshInstruction(
instruction
)
const refreshIx = vaultClient.getRefreshIx()
const refreshIxs = vaultClient.getRefreshIxs()
return refreshIx
return refreshIxs
}
/**
@ -303,7 +303,7 @@ const getCastleVaultClientFromForm = async (
form: CastleDepositForm | CastleWithdrawForm
) => {
// Create a new provider
const provider = new Provider(
const provider = new AnchorProvider(
connection.current,
(wallet as unknown) as AnchorWallet,
{
@ -350,7 +350,7 @@ const getCastleVaultClientFromProposal = async (
instruction: ProgramAccount<ProposalTransaction>
) => {
// Create a new provider
const provider = new Provider(
const provider = new AnchorProvider(
connection,
(wallet as unknown) as AnchorWallet,
{

View File

@ -28,7 +28,7 @@ import {
closeAccount,
initializeAccount,
} from '@project-serum/serum/lib/token-instructions'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Token } from '@solana/spl-token'
interface StakingOptionArgs {

View File

@ -1,7 +1,7 @@
import { UiInstruction } from '../../uiTypes/proposalCreationTypes'
import { WSOL_MINT_PK } from '@components/instructions/tools'
import { Wallet, BN } from '@project-serum/anchor'
import { publicKey, struct, u32, u64, u8 } from '@project-serum/borsh'
import { Wallet, BN } from '@coral-xyz/anchor'
import { publicKey, struct, u32, u64, u8 } from '@coral-xyz/borsh'
import { serializeInstructionToBase64 } from '@solana/spl-governance'
import {
ASSOCIATED_TOKEN_PROGRAM_ID,

View File

@ -1,7 +1,7 @@
import {
Program,
ProgramAccount as AnchorProgramAccount,
} from '@project-serum/anchor'
} from '@coral-xyz/anchor'
import { useEffect, useMemo, useState } from 'react'
import useWallet from '@hooks/useWallet'
import { OptionMarket, PSY_AMERICAN_PROGRAM_ID } from './index'

View File

@ -1,4 +1,4 @@
import { BN, Program, Provider, web3 } from '@project-serum/anchor'
import { BN, Program, Provider, web3 } from '@coral-xyz/anchor'
import {
ASSOCIATED_TOKEN_PROGRAM_ID,
Token,

View File

@ -1,4 +1,4 @@
import * as anchor from '@project-serum/anchor'
import * as anchor from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
export type OptionMarket = {

View File

@ -1,7 +1,7 @@
import { Filters } from '@components/ProposalFilter'
import { Sorting, SORTING_OPTIONS } from '@components/ProposalSorting'
import { hasInstructions } from '@components/ProposalStateBadge'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
Governance,
ProgramAccount,

View File

@ -22,7 +22,7 @@ import { getAccountName, WSOL_MINT } from '@components/instructions/tools'
import { formatMintNaturalAmountAsDecimal } from '@tools/sdk/units'
import tokenPriceService from './services/tokenPrice'
import { notify } from './notifications'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { abbreviateAddress } from './formatting'
import BigNumber from 'bignumber.js'
import { AssetAccount } from '@utils/uiTypes/assets'

View File

@ -1,5 +1,5 @@
import { getAccountName, WSOL_MINT } from '@components/instructions/tools'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
import { getMintDecimalAmountFromNatural } from '@tools/sdk/units'
import BigNumber from 'bignumber.js'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { Governance, ProgramAccount } from '@solana/spl-governance'
import { AccountInfo, MintInfo, u64 } from '@solana/spl-token'
import { ParsedAccountData, PublicKey } from '@solana/web3.js'

View File

@ -1,4 +1,4 @@
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import { PublicKey } from '@solana/web3.js'
export interface Member {

View File

@ -18,7 +18,7 @@ import {
MintInfo,
} from '@solana/spl-token'
import { Connection } from '@solana/web3.js'
import { BN } from '@project-serum/anchor'
import { BN } from '@coral-xyz/anchor'
import {
nftPluginsPks,
vsrPluginsPks,

Some files were not shown because too many files have changed in this diff Show More