Fix pending transaction error due to missing timestamp

This commit is contained in:
Justin Starry 2020-06-02 14:31:54 +08:00 committed by Michael Vines
parent 3f12bf6f52
commit 9b602edc7a
1 changed files with 1 additions and 12 deletions

View File

@ -239,18 +239,7 @@ export async function fetchTransactionStatus(
if (value !== null) {
let blockTime = await connection.getBlockTime(value.slot);
let timestamp: Timestamp;
if (blockTime !== null) {
timestamp = blockTime;
} else {
const epochInfo = await connection.getEpochInfo();
if (value.slot < epochInfo.absoluteSlot - epochInfo.slotsInEpoch) {
timestamp = "unavailable";
} else {
throw new Error("Unable to fetch timestamp");
}
}
let timestamp: Timestamp = blockTime !== null ? blockTime : "unavailable";
let confirmations: Confirmations;
if (typeof value.confirmations === "number") {