Fix pending transaction error due to missing timestamp
This commit is contained in:
parent
3f12bf6f52
commit
9b602edc7a
|
@ -239,18 +239,7 @@ export async function fetchTransactionStatus(
|
||||||
|
|
||||||
if (value !== null) {
|
if (value !== null) {
|
||||||
let blockTime = await connection.getBlockTime(value.slot);
|
let blockTime = await connection.getBlockTime(value.slot);
|
||||||
|
let timestamp: Timestamp = blockTime !== null ? blockTime : "unavailable";
|
||||||
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 confirmations: Confirmations;
|
let confirmations: Confirmations;
|
||||||
if (typeof value.confirmations === "number") {
|
if (typeof value.confirmations === "number") {
|
||||||
|
|
Loading…
Reference in New Issue