@tapforce/pod-bridge-sdk 1.1.16 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -135,9 +135,19 @@ class SourceChainTrackerService {
|
|
|
135
135
|
return claimedMap;
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
* Get current finalized block number
|
|
138
|
+
* Get current finalized block number using RPC's finalized block tag
|
|
139
139
|
*/
|
|
140
140
|
async getFinalizedBlockNumber() {
|
|
141
|
+
try {
|
|
142
|
+
const finalizedBlock = await this.provider.getBlock('finalized');
|
|
143
|
+
if (finalizedBlock) {
|
|
144
|
+
return finalizedBlock.number;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.warn('[SourceChain] Failed to fetch finalized block, falling back to manual calculation:', error);
|
|
149
|
+
}
|
|
150
|
+
// Fallback: Use manual calculation if RPC doesn't support finalized tag
|
|
141
151
|
const currentBlock = await this.provider.getBlockNumber();
|
|
142
152
|
return currentBlock - 64; // 2 epochs (32 x 2 blocks) ~15 minutes on Sepolia
|
|
143
153
|
}
|