How to get Layer 1 block.number on Layer 2

These data can be fetched from GwScan Public Service

query ($hash: String!) {
	block(input: { hash: $hash }) {
		layer1_tx_hash
		layer1_block_number
	}
	
	blocks {
		layer1_tx_hash
		layer1_block_number
	}
}

variables {
	"hash": "0xd6e95eab94eb485925d9bc4e4aa034a8bec0c46a1164fd2ff54025564037dd01"
}

An endpoint for public usage is active at https://api.v1-betanet.gwscan.com/graphql though, a self-hosted service is strongly recommended for your own dapps.

Ref: Build a discord bot with GwScan Public API Service