Skip to content

Commit

Permalink
Merge pull request #103 from alephium/fix-wait-tx-confirmations
Browse files Browse the repository at this point in the history
Fix wait tx confirmations
  • Loading branch information
h0ngcha0 authored Nov 8, 2023
2 parents 95b3d9b + 32995f0 commit fdb2e3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 0 additions & 2 deletions bridge_ui/src/components/TokenSelectors/TokenPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
DialogTitle,
Divider,
IconButton,
Link,
List,
ListItem,
makeStyles,
Expand All @@ -27,7 +26,6 @@ import { NFTParsedTokenAccount } from "../../store/nftSlice";
import { selectTransferTargetChain } from "../../store/selectors";
import { balancePretty } from "../../utils/balancePretty";
import {
AVAILABLE_MARKETS_URL,
CHAINS_BY_ID,
getIsTokenTransferDisabled,
} from "../../utils/consts";
Expand Down
10 changes: 7 additions & 3 deletions bridge_ui/src/utils/alephium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ export class AlphTxInfo {
}

export async function waitALPHTxConfirmed(provider: NodeProvider, txId: string, confirmations: number): Promise<node.Confirmed> {
const txStatus = await provider.transactions.getTransactionsStatus({txId: txId})
if (isAlphTxConfirmed(txStatus) && txStatus.chainConfirmations >= confirmations) {
return txStatus as node.Confirmed
try {
const txStatus = await provider.transactions.getTransactionsStatus({txId: txId})
if (isAlphTxConfirmed(txStatus) && txStatus.chainConfirmations >= confirmations) {
return txStatus as node.Confirmed
}
} catch (error) {
console.error(`failed to get tx status, tx id: ${txId}`)
}
await sleep(ALEPHIUM_POLLING_INTERVAL)
return waitALPHTxConfirmed(provider, txId, confirmations)
Expand Down

0 comments on commit fdb2e3c

Please sign in to comment.