How to use typescript sdk to scan the log corresponding to the contract on the chain

Let me write a simple requirement example

#[payable]
    #[storage(read, write)]
    fn buy(_str: str){
      .....
     log(BuyEvent {
            time: timestamp(),
            price: market.unwrap().price,
            strings: String::from_ascii_str(_str),
            seller: market.unwrap().owner,
            buyer: msg_sender().unwrap(),
        });
    ........
}

If I want to query all BuyEvent events data generated by this contract, how should I do it?

1 Like