use TxCallbackOptions type
This commit is contained in:
parent
8d856c0cdf
commit
d5242335a5
|
@ -92,7 +92,7 @@ const CreateAccountForm = ({
|
|||
}
|
||||
const pk = walletContext.wallet.adapter.publicKey
|
||||
|
||||
await waitForSlot(connection, slot)
|
||||
await waitForSlot(connection, slot!)
|
||||
const mangoAccounts = await client.getMangoAccountsForOwner(group, pk!)
|
||||
const reloadedMangoAccounts = await Promise.all(
|
||||
mangoAccounts.map((ma) => ma.reloadSerum3OpenOrders(client)),
|
||||
|
@ -108,7 +108,7 @@ const CreateAccountForm = ({
|
|||
if (newAccount) {
|
||||
set((s) => {
|
||||
s.mangoAccount.current = newAccount
|
||||
s.mangoAccount.lastSlot = slot
|
||||
s.mangoAccount.lastSlot = slot!
|
||||
s.mangoAccounts = filteredMangoAccounts
|
||||
})
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ const UserSetupModal = ({
|
|||
if (signToNotifications) {
|
||||
createSolanaMessage(walletContext, setCookie)
|
||||
}
|
||||
await waitForSlot(connection, slot)
|
||||
await waitForSlot(connection, slot!)
|
||||
await actions.fetchMangoAccounts(publicKey)
|
||||
await actions.fetchWalletTokens(publicKey) // need to update sol balance after account rent
|
||||
telemetry('accountCreate', {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"dependencies": {
|
||||
"@blockworks-foundation/mango-feeds": "0.1.7",
|
||||
"@blockworks-foundation/mango-mints-redemption": "^0.0.10",
|
||||
"@blockworks-foundation/mango-v4": "0.21.11",
|
||||
"@blockworks-foundation/mango-v4": "0.21.13",
|
||||
"@blockworks-foundation/mango-v4-settings": "0.4.6",
|
||||
"@blockworks-foundation/mangolana": "0.0.1-beta.15",
|
||||
"@headlessui/react": "1.6.6",
|
||||
|
|
|
@ -91,6 +91,7 @@ import { fetchTokenStatsData, processTokenStatsData } from 'apis/mngo'
|
|||
import { OrderTypes } from 'utils/tradeForm'
|
||||
import { usePlausible } from 'next-plausible'
|
||||
import { collectTxConfirmationData } from 'utils/transactionConfirmationData'
|
||||
import { TxCallbackOptions } from '@blockworks-foundation/mango-v4/dist/types/src/client'
|
||||
|
||||
const ENDPOINTS = [
|
||||
{
|
||||
|
@ -135,13 +136,7 @@ const initMangoClient = (
|
|||
multipleConnections: opts.multipleConnections,
|
||||
prependedGlobalAdditionalInstructions:
|
||||
opts.prependedGlobalAdditionalInstructions,
|
||||
postSendTxCallback: ({
|
||||
txid,
|
||||
txSignatureBlockHash,
|
||||
}: {
|
||||
txid: string
|
||||
txSignatureBlockHash: LatestBlockhash
|
||||
}) => {
|
||||
postSendTxCallback: (txCallbackOptions: TxCallbackOptions) => {
|
||||
if (telemetry) {
|
||||
telemetry('postSendTx', {
|
||||
props: { fee: opts.prioritizationFee },
|
||||
|
@ -152,14 +147,13 @@ const initMangoClient = (
|
|||
title: 'Transaction sent',
|
||||
description: 'Waiting for confirmation',
|
||||
type: 'confirm',
|
||||
txid: txid,
|
||||
txid: txCallbackOptions.txid,
|
||||
})
|
||||
|
||||
collectTxConfirmationData(
|
||||
provider.connection.rpcEndpoint,
|
||||
txid,
|
||||
txSignatureBlockHash,
|
||||
opts.prioritizationFee,
|
||||
txCallbackOptions,
|
||||
)
|
||||
},
|
||||
})
|
||||
|
|
|
@ -1,36 +1,26 @@
|
|||
import { IDL } from '@blockworks-foundation/mango-v4'
|
||||
import { IDL, LatestBlockhash } from '@blockworks-foundation/mango-v4'
|
||||
import { BorshInstructionCoder } from '@project-serum/anchor'
|
||||
import {
|
||||
Connection,
|
||||
RpcResponseAndContext,
|
||||
SignatureResult,
|
||||
TransactionInstruction,
|
||||
} from '@solana/web3.js'
|
||||
import { Connection } from '@solana/web3.js'
|
||||
import { MANGO_DATA_API_URL } from './constants'
|
||||
import { TxCallbackOptions } from '@blockworks-foundation/mango-v4/dist/types/src/client'
|
||||
|
||||
const coder = new BorshInstructionCoder(IDL)
|
||||
|
||||
export function collectTxConfirmationData(
|
||||
rpcEndpoint: string,
|
||||
signature: string,
|
||||
txSignatureBlockHash: LatestBlockhash,
|
||||
prioritizationFee: number,
|
||||
txCallbackOptions: TxCallbackOptions,
|
||||
) {
|
||||
txConfirmationInner(
|
||||
rpcEndpoint,
|
||||
signature,
|
||||
txSignatureBlockHash,
|
||||
prioritizationFee,
|
||||
)
|
||||
txConfirmationInner(rpcEndpoint, prioritizationFee, txCallbackOptions)
|
||||
}
|
||||
|
||||
async function txConfirmationInner(
|
||||
rpcEndpoint: string,
|
||||
signature: string,
|
||||
txSignatureBlockHash: LatestBlockhash,
|
||||
prioritization_fee: number,
|
||||
txCallbackOptions: TxCallbackOptions,
|
||||
) {
|
||||
const connection = new Connection(rpcEndpoint, 'processed')
|
||||
const { txid: signature, txSignatureBlockHash } = txCallbackOptions
|
||||
await connection.confirmTransaction(
|
||||
{
|
||||
signature,
|
||||
|
|
|
@ -358,10 +358,10 @@
|
|||
bn.js "^5.2.1"
|
||||
eslint-config-prettier "^9.0.0"
|
||||
|
||||
"@blockworks-foundation/mango-v4@0.21.11":
|
||||
version "0.21.11"
|
||||
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.21.11.tgz#d943c0d65f3bc658d831d7100a9db692e62c1344"
|
||||
integrity sha512-hSN3kLQS8Cu8vXLIpLpKFO3EQkTElK/P2myG1yQ+FdiCh8kBcbHAnkc0B1HuBxwpn4ngthsMgjNiRG0ARAu75A==
|
||||
"@blockworks-foundation/mango-v4@0.21.13":
|
||||
version "0.21.13"
|
||||
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.21.13.tgz#297b21f26810f59b29b3a05e0609fe6f493ac98c"
|
||||
integrity sha512-mpU6CnhJHOuIkXQj2VOqznDBETmg8GSV5K6UBII61K9skh3g8avwvtOMSxJ7V6bZaTf1IMlh0t5Fe7WnWtoTlQ==
|
||||
dependencies:
|
||||
"@blockworks-foundation/mango-v4-settings" "^0.2.16"
|
||||
"@coral-xyz/anchor" "^0.28.1-beta.2"
|
||||
|
|
Loading…
Reference in New Issue