From d3eb967665f855958fadb76f1bdd4b8d6dbf74a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Brzezin=CC=81ski?= Date: Sat, 6 Jan 2024 21:44:22 +0100 Subject: [PATCH] push to crank ix --- components/modals/CreateOpenbookMarketModal.tsx | 2 +- components/modals/CreateSwitchboardOracleModal.tsx | 11 +++++++++-- utils/governance/instructions/createProposal.ts | 2 +- utils/notifications.ts | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/components/modals/CreateOpenbookMarketModal.tsx b/components/modals/CreateOpenbookMarketModal.tsx index 8c11b6ec..04a1c5c3 100644 --- a/components/modals/CreateOpenbookMarketModal.tsx +++ b/components/modals/CreateOpenbookMarketModal.tsx @@ -106,7 +106,7 @@ const CreateOpenbookMarketModal = ({ const txChunks = ixObj.innerTransactions const transactions: Transaction[] = [] - const latestBlockhash = await connection.getLatestBlockhash('confirmed') + const latestBlockhash = await connection.getLatestBlockhash('processed') for (const chunk of txChunks) { const tx = new Transaction() tx.add(createComputeBudgetIx(fee)) diff --git a/components/modals/CreateSwitchboardOracleModal.tsx b/components/modals/CreateSwitchboardOracleModal.tsx index 67f1bd8e..9d7680f6 100644 --- a/components/modals/CreateSwitchboardOracleModal.tsx +++ b/components/modals/CreateSwitchboardOracleModal.tsx @@ -329,8 +329,15 @@ const CreateSwitchboardOracleModal = ({ const transferAuthIx = aggregatorAccount.setAuthorityInstruction(payer, { newAuthority: MANGO_DAO_WALLET, }) - const latestBlockhash = await connection.getLatestBlockhash('confirmed') - const txChunks = chunk([...txArray1, lockTx, transferAuthIx], 1) + const pushToCrankIx = await crankAccount.pushInstruction(payer, { + aggregatorAccount: aggregatorAccount, + }) + + const latestBlockhash = await connection.getLatestBlockhash('processed') + const txChunks = chunk( + [...txArray1, lockTx, transferAuthIx, pushToCrankIx], + 1, + ) const transactions: Transaction[] = [] for (const chunkIndex in txChunks) { diff --git a/utils/governance/instructions/createProposal.ts b/utils/governance/instructions/createProposal.ts index e67516e0..3783d280 100644 --- a/utils/governance/instructions/createProposal.ts +++ b/utils/governance/instructions/createProposal.ts @@ -131,7 +131,7 @@ export const createProposal = async ( const txChunks = chunk([...instructions, ...insertInstructions], 2) const transactions: Transaction[] = [] - const latestBlockhash = await connection.getLatestBlockhash('confirmed') + const latestBlockhash = await connection.getLatestBlockhash('processed') for (const chunk of txChunks) { const tx = new Transaction() tx.add(createComputeBudgetIx(fee)) diff --git a/utils/notifications.ts b/utils/notifications.ts index 1835e682..b3f6d1f1 100644 --- a/utils/notifications.ts +++ b/utils/notifications.ts @@ -167,7 +167,9 @@ export const createLedgerMessage = async ( }), ) tx.feePayer = wallet.publicKey! - tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash + tx.recentBlockhash = ( + await connection.getLatestBlockhash('processed') + ).blockhash const signedTx = await wallet.signTransaction!(tx) const serializedTx = signedTx.serialize()