github.com/hungdoo/bot@v0.0.0-20240325145135-dd1f386f7b81/src/packages/command/subscriber/client_test.go (about) 1 package subscriber 2 3 import ( 4 "testing" 5 6 "github.com/ethereum/go-ethereum/common" 7 "github.com/ethereum/go-ethereum/core/types" 8 ) 9 10 func TestSubscriber(t *testing.T) { 11 wss := "wss://ethereum.publicnode.com" 12 contractAddress := common.HexToAddress("0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD") // uniswap universal router 13 // hash := crypto.Keccak256Hash([]byte("transfer(address,uint256)")) 14 methodSelector := common.HexToHash("0x3593564c").Bytes()[:4] // execute(bytes commands,bytes[] inputs,uint256 deadline) 15 16 s, err := GetSubscriber(wss, contractAddress, string(methodSelector)) 17 if err != nil { 18 t.Fatal(err) 19 } 20 go s.Listen() 21 s.Logs <- types.Log{Address: common.MaxAddress} 22 }