connect_settle/
connect-settle.rs1use walletconnect_sdk::{
2 connection::Connection, pairing::Topic, types::Metadata,
3};
4
5#[tokio::main]
8async fn main() {
9 env_logger::init();
10
11 let project_id = "35d44d49c2dee217a3eb24bb4410acc7";
14
15 let client_seed = [123u8; 32];
18
19 let conn = Connection::new(
20 "https://relay.walletconnect.org/rpc",
21 "https://relay.walletconnect.org",
22 project_id,
23 client_seed, Metadata {
24 name: "WalletConnect Rust SDK".to_string(),
25 description: "WalletConnect Rust SDK enables to connect to relay and interact with dapp".to_string(),
26 url: "https://github.com/zemse/walletconnect-sdk".to_string(),
27 icons: vec![],
28 },
29 );
30
31 let uri_from_dapp = "wc:e4b9eb7a1372bf88abc46c37acac3687301afdfd0d2a4c2355945d66a1164464@2?relay-protocol=irn&symKey=d7430284e1b70853829a010518a088cde0e163bcad5f24425e3b17578b2b402d&expiryTimestamp=1749783095&methods=wc_sessionAuthenticate";
34
35 let (mut pairing, _) = conn
36 .init_pairing(uri_from_dapp)
37 .await
38 .expect("pairing failed");
39
40 pairing
41 .approve_with_session_settle(
42 "0x0000000000000000000000000000000000000123"
43 .parse()
44 .unwrap(),
45 )
46 .await
47 .expect("approve failed");
48
49 loop {
50 let result =
51 pairing.watch_messages(Topic::Derived, None).await.unwrap();
52
53 println!("result: {result:?}");
54 }
55}