I want to check my past event emitted by smart contract during function call so that I can verify that the function is actually called. ``program.addEventListner()``` is used only for real-time I need to verify my past events.
You can fetch the transaction history of your program (address) and then parse the transactions using Anchor event parser.
fetching the transactions
connection.getSignaturesForAddress is limited to 1000 transactions only. You can find here how to bypass the limit and fetch > 1000 transactions
You can use Anchor EventParser to parse your transactions. This has been already asked here.
To verify past events emitted by a smart contract, you can use a blockchain explorer or a client library that provides access to the blockchain data. A blockchain explorer is a website that allows you to search for and view details about blocks, transactions, and contract events. You can use the contract's address, the block number or range, and the event signature to search for past events.
Client libraries, such as web3.js for Ethereum, also provide a way to programmatically access the blockchain data and retrieve past events. You can use the "getPastEvents" method of the contract instance to retrieve the events that have been emitted by the contract, and then filter the events based on the event signature and other criteria.