Closed ioanSL closed 8 months ago
CheckpointWriter type does not allow access to block status, only block number, parent hash timestamp and a list of TXs. Also, those TXs are type TXN, which only contains hash and version.
We use same type as starknet.js does and it's union of two types from one of which has status
and other doesn't:
https://github.com/starknet-io/starknet.js/blob/66b04f1dab070b05a6b3e4688a28ffe0f074382d/src/types/api/openrpc.ts#L431C23-L431C23
So you can't access it right away, because TypeScript doesn't know which of two we have, it's not Checkpoint specific, same issue will be encountered when using RPC provider in starknet
directly. You can do this to narrow it down before accessing:
if (block && 'status' in block) {
console.log('block', block.status);
}
This is similar to this issue: https://github.com/checkpoint-labs/checkpoint/issues/176
Often, off-chain infrastructure interacts with the L1 ETH blockchain, and for that it is necessary to identify which blocks have been verified only on L1. Currently, one can include PENDING state by using optimistic indexing. Unfortunately, there is no way to differentiate between accepted on L1/L2 tx. CheckpointWriter type does not allow access to block status, only block number, parent hash timestamp and a list of TXs. Also, those TXs are type TXN, which only contains hash and version.
Starknet.JS offers the block finality information, but CheckpointWriter is not including it into its interface. It would be very helpful to be able to filter blocks by block finality to enhance the capabilities of Checkpoint.