diff --git a/components/governance/ListMarket/ListMarket.tsx b/components/governance/ListMarket/ListMarket.tsx index 5f8c1be2..fad46e86 100644 --- a/components/governance/ListMarket/ListMarket.tsx +++ b/components/governance/ListMarket/ListMarket.tsx @@ -78,6 +78,7 @@ const ListMarket = ({ goBack }: { goBack: () => void }) => { const [quoteToken, setQuoteToken] = useState(null) const [loadingMarketProps, setLoadingMarketProps] = useState(false) const [proposing, setProposing] = useState(false) + const fee = mangoStore((s) => s.priorityFee) const [marketPk, setMarketPk] = useState('') const [currentView, setCurrentView] = useState(VIEWS.BASE_TOKEN) const [createOpenbookMarketModal, setCreateOpenbookMarket] = useState(false) @@ -199,6 +200,7 @@ const ListMarket = ({ goBack }: { goBack: () => void }) => { index, proposalTx, vsrClient!, + fee, ) setProposalPk(proposalAddress.toBase58()) setCurrentView(VIEWS.SUCCESS) @@ -442,7 +444,9 @@ const ListMarket = ({ goBack }: { goBack: () => void }) => {

{t('price-tick')}

- {tradingParams.priceIncrement} + {tradingParams.priceIncrement <= 1e-9 + ? '1e-8' + : tradingParams.priceIncrement.toString()}

) : null} diff --git a/components/governance/ListToken/ListToken.tsx b/components/governance/ListToken/ListToken.tsx index c4a2707c..c33b0f67 100644 --- a/components/governance/ListToken/ListToken.tsx +++ b/components/governance/ListToken/ListToken.tsx @@ -101,6 +101,7 @@ const ListToken = ({ goBack }: { goBack: () => void }) => { const vsrClient = GovernanceStore((s) => s.vsrClient) const governances = GovernanceStore((s) => s.governances) const loadingRealm = GovernanceStore((s) => s.loadingRealm) + const fee = mangoStore((s) => s.priorityFee) const loadingVoter = GovernanceStore((s) => s.loadingVoter) const proposals = GovernanceStore((s) => s.proposals) const getCurrentVotingPower = GovernanceStore((s) => s.getCurrentVotingPower) @@ -590,6 +591,7 @@ const ListToken = ({ goBack }: { goBack: () => void }) => { advForm.tokenIndex, proposalTx, vsrClient, + fee, ) setProposalPk(proposalAddress.toBase58()) } catch (e) { diff --git a/components/modals/CreateOpenbookMarketModal.tsx b/components/modals/CreateOpenbookMarketModal.tsx index 4941f8ae..8c11b6ec 100644 --- a/components/modals/CreateOpenbookMarketModal.tsx +++ b/components/modals/CreateOpenbookMarketModal.tsx @@ -1,7 +1,10 @@ import mangoStore, { CLUSTER } from '@store/mangoStore' import { ModalProps } from '../../types/modal' import Modal from '../shared/Modal' -import { OPENBOOK_PROGRAM_ID } from '@blockworks-foundation/mango-v4' +import { + OPENBOOK_PROGRAM_ID, + createComputeBudgetIx, +} from '@blockworks-foundation/mango-v4' import { ChangeEvent, useEffect, useState } from 'react' import Label from '@components/forms/Label' import Input from '@components/forms/Input' @@ -65,6 +68,7 @@ const CreateOpenbookMarketModal = ({ }: ModalProps & CreateOpenbookMarketModalProps) => { const { t } = useTranslation(['governance']) const connection = mangoStore((s) => s.connection) + const fee = mangoStore((s) => s.priorityFee) const { connect, signAllTransactions, connected, publicKey } = useWallet() const [form, setForm] = useState({ ...defaultFormValues }) @@ -105,6 +109,7 @@ const CreateOpenbookMarketModal = ({ const latestBlockhash = await connection.getLatestBlockhash('confirmed') for (const chunk of txChunks) { const tx = new Transaction() + tx.add(createComputeBudgetIx(fee)) tx.add(...chunk.instructions) tx.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight tx.recentBlockhash = latestBlockhash.blockhash diff --git a/components/modals/CreateSwitchboardOracleModal.tsx b/components/modals/CreateSwitchboardOracleModal.tsx index 309bb3a0..8138f463 100644 --- a/components/modals/CreateSwitchboardOracleModal.tsx +++ b/components/modals/CreateSwitchboardOracleModal.tsx @@ -20,6 +20,7 @@ import { useCallback, useState } from 'react' import Loading from '@components/shared/Loading' import { WhirlpoolContext, buildWhirlpoolClient } from '@orca-so/whirlpools-sdk' import { LIQUIDITY_STATE_LAYOUT_V4 } from '@raydium-io/raydium-sdk' +import { createComputeBudgetIx } from '@blockworks-foundation/mango-v4' const poolAddressError = 'no-pool-address-found' @@ -56,6 +57,7 @@ const CreateSwitchboardOracleModal = ({ }: RaydiumProps | OrcaProps) => { const { t } = useTranslation(['governance']) const connection = mangoStore((s) => s.connection) + const fee = mangoStore((s) => s.priorityFee) const wallet = useWallet() const quoteTokenName = 'USD' const pythUsdOracle = 'Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD' @@ -330,6 +332,7 @@ const CreateSwitchboardOracleModal = ({ for (const chunk of txChunks) { const tx = new Transaction() const singers = [...chunk.flatMap((x) => x.signers)] + tx.add(createComputeBudgetIx(fee)) tx.add(...chunk.flatMap((x) => x.ixns)) tx.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight tx.recentBlockhash = latestBlockhash.blockhash diff --git a/components/modals/DashboardSuggestedValuesModal.tsx b/components/modals/DashboardSuggestedValuesModal.tsx index 8d5c6a41..0022e0fc 100644 --- a/components/modals/DashboardSuggestedValuesModal.tsx +++ b/components/modals/DashboardSuggestedValuesModal.tsx @@ -52,6 +52,7 @@ const DashboardSuggestedValues = ({ //do not deconstruct wallet is used for anchor to sign const wallet = useWallet() const connection = mangoStore((s) => s.connection) + const fee = mangoStore((s) => s.priorityFee) const voter = GovernanceStore((s) => s.voter) const vsrClient = GovernanceStore((s) => s.vsrClient) const proposals = GovernanceStore((s) => s.proposals) @@ -259,6 +260,7 @@ const DashboardSuggestedValues = ({ index, proposalTx, vsrClient!, + fee, ) window.open( `https://dao.mango.markets/dao/MNGO/proposal/${proposalAddress.toBase58()}`, diff --git a/components/rewards/Claim.tsx b/components/rewards/Claim.tsx index 4ebcc7e7..657a2af8 100644 --- a/components/rewards/Claim.tsx +++ b/components/rewards/Claim.tsx @@ -36,6 +36,7 @@ import { TelemetryEvents } from 'utils/telemetry' import { Prize, getClaimsAsPrizes } from './RewardsComponents' import { notify } from 'utils/notifications' import { sleep } from 'utils' +import { createComputeBudgetIx } from '@blockworks-foundation/mango-v4' const CLAIM_BUTTON_CLASSES = 'raised-button group mx-auto block h-12 px-6 pt-1 font-rewards text-xl after:rounded-lg focus:outline-none lg:h-14' @@ -84,6 +85,7 @@ const ClaimPage = () => { const { client } = mangoStore() const { publicKey } = useWallet() + const fee = mangoStore((s) => s.priorityFee) const { data: seasonData } = useCurrentSeason() const currentSeason = seasonData?.season_id const previousSeason = currentSeason ? currentSeason - 1 : null @@ -227,7 +229,10 @@ const ClaimPage = () => { } chunk(claimIxes, 2).map((x) => transactionInstructions.push({ - instructionsSet: x, + instructionsSet: [ + new TransactionInstructionWithSigners(createComputeBudgetIx(fee)), + ...x, + ], sequenceType: SequenceType.Parallel, }), ) diff --git a/store/mangoStore.ts b/store/mangoStore.ts index fed7c8cf..02ac52d5 100644 --- a/store/mangoStore.ts +++ b/store/mangoStore.ts @@ -1178,10 +1178,11 @@ const mangoStore = create()( if (!altKeys) return const addresses = sampleSize(altKeys, MAX_PRIORITY_FEE_KEYS) + console.log(addresses) const fees = await connection.getRecentPrioritizationFees({ lockedWritableAccounts: addresses, }) - + console.log(fees) if (fees.length < 1) return // get max priority fee per slot (and sort by slot from old to new) diff --git a/utils/governance/instructions/createProposal.ts b/utils/governance/instructions/createProposal.ts index bf26e99f..613d48c7 100644 --- a/utils/governance/instructions/createProposal.ts +++ b/utils/governance/instructions/createProposal.ts @@ -23,6 +23,7 @@ import { MANGO_MINT } from 'utils/constants' import { MANGO_GOVERNANCE_PROGRAM, MANGO_REALM_PK } from '../constants' import { VsrClient } from '../voteStakeRegistryClient' import { updateVoterWeightRecord } from './updateVoteWeightRecord' +import { createComputeBudgetIx } from '@blockworks-foundation/mango-v4' export const createProposal = async ( connection: Connection, @@ -34,6 +35,7 @@ export const createProposal = async ( proposalIndex: number, proposalInstructions: TransactionInstruction[], client: VsrClient, + fee: number, ) => { const instructions: TransactionInstruction[] = [] const walletPk = wallet.publicKey! @@ -132,6 +134,7 @@ export const createProposal = async ( const latestBlockhash = await connection.getLatestBlockhash('confirmed') for (const chunk of txChunks) { const tx = new Transaction() + tx.add(createComputeBudgetIx(fee)) tx.add(...chunk) tx.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight tx.recentBlockhash = latestBlockhash.blockhash