Skip to content

Commit

Permalink
ALL-6089 - Solana transaction not confirmed
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Apr 2, 2024
1 parent 95897b9 commit f136c3a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/blockchain/solana/src/lib/services/solana.kms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SolanaWeb3 } from './solana.web3'
import { abstractBlockchainKms } from '@tatumio/shared-blockchain-abstract'
import { Currency, PendingTransaction } from '@tatumio/api-client'
import { SdkError, SdkErrorCode } from '@tatumio/shared-abstract-sdk'
import { solanaUtils } from '@tatumio/solana'

export const solanaKmsService = (args: { web3: SolanaWeb3; blockchain: Blockchain }) => {
return {
Expand All @@ -20,13 +21,8 @@ export const solanaKmsService = (args: { web3: SolanaWeb3; blockchain: Blockchai
if (mintPK) {
signers.push(args.web3.generateKeyPair(mintPK))
}
const txId = await connection.sendTransaction(transaction, signers)
await new Promise((r) => setTimeout(r, 10000))
const confirmedTx = await connection.getConfirmedTransaction(txId, 'confirmed')
if (confirmedTx && !confirmedTx.meta?.err) {
return txId
}
throw new Error('Transaction not confirmed.')
const { txId } = await solanaUtils.sendTransactionWithConfirm(connection, transaction, signers)
return txId
},
}
}

0 comments on commit f136c3a

Please sign in to comment.