@@ -6,54 +6,59 @@ namespace com {
6
6
namespace crypto {
7
7
namespace game_sdk {
8
8
9
- class WalletConnectSessionInfo {
10
- public:
11
- // / if the wallet approved the connection
12
- bool connected;
13
- // / hex-string(0x...), the accounts returned by the wallet
14
- rust::Vec<rust::String> accounts;
15
- // / u64, the chain id returned by the wallet
16
- rust::String chain_id;
17
- // / the bridge server URL
18
- rust::String bridge;
19
- // / the secret key used in encrypting wallet requests
20
- // / and decrypting wallet responses as per WalletConnect 1.0
21
- // / hex-string(0x...), 32 bytes
22
- rust::String key;
23
- // / this is the client's randomly generated ID
24
- rust::String client_id;
25
- // / json, the client metadata (that will be presented to the wallet in the initial request)
26
- rust::String client_meta;
27
- // / uuid, the wallet's ID
28
- rust::String peer_id;
29
- // / json, the wallet's metadata
30
- rust::String peer_meta;
31
- // / uuid, the one-time request ID
32
- rust::String handshake_topic;
9
+ class WalletConnectSessionInfo {
10
+ public:
11
+ // / if the wallet approved the connection
12
+ bool connected;
13
+ // / hex-string(0x...), the accounts returned by the wallet
14
+ rust::Vec<rust::String> accounts;
15
+ // / u64, the chain id returned by the wallet
16
+ rust::String chain_id;
17
+ // / the bridge server URL
18
+ rust::String bridge;
19
+ // / the secret key used in encrypting wallet requests
20
+ // / and decrypting wallet responses as per WalletConnect 1.0
21
+ // / hex-string(0x...), 32 bytes
22
+ rust::String key;
23
+ // / this is the client's randomly generated ID
24
+ rust::String client_id;
25
+ // / json, the client metadata (that will be presented to the wallet in the
26
+ // / initial request)
27
+ rust::String client_meta;
28
+ // / uuid, the wallet's ID
29
+ rust::String peer_id;
30
+ // / json, the wallet's metadata
31
+ rust::String peer_meta;
32
+ // / uuid, the one-time request ID
33
+ rust::String handshake_topic;
33
34
34
- void set_connected (bool connected) ;
35
- void set_accounts (rust::Vec<rust::String> accounts) ;
36
- void set_chainid (rust::String chainid) ;
37
- void set_bridge (rust::String bridge) ;
38
- void set_key (rust::String key) ;
39
- void set_clientid (rust::String client_id) ;
40
- void set_clientmeta (rust::String client_meta) ;
41
- void set_peerid (rust::String client_id) ;
42
- void set_peermeta (rust::String client_meta) ;
43
- void set_handshaketopic (rust::String handshake_topic) ;
35
+ void set_connected (bool connected);
36
+ void set_accounts (rust::Vec<rust::String> accounts);
37
+ void set_chainid (rust::String chainid);
38
+ void set_bridge (rust::String bridge);
39
+ void set_key (rust::String key);
40
+ void set_clientid (rust::String client_id);
41
+ void set_clientmeta (rust::String client_meta);
42
+ void set_peerid (rust::String client_id);
43
+ void set_peermeta (rust::String client_meta);
44
+ void set_handshaketopic (rust::String handshake_topic);
44
45
};
45
46
std::unique_ptr<WalletConnectSessionInfo> new_walletconnect_sessioninfo ();
46
47
47
-
48
48
class WalletConnectCallback {
49
- public:
50
- WalletConnectCallback ();
51
- virtual ~WalletConnectCallback ();
52
- virtual void onConnected (const WalletConnectSessionInfo& sessioninfo) const ;
53
- virtual void onDisconnected (const WalletConnectSessionInfo& sessioninfo) const ;
54
- virtual void onConnecting (const WalletConnectSessionInfo& sessioninfo) const ;
55
- virtual void onUpdated (const WalletConnectSessionInfo& sessioninfo) const ;
49
+ public:
50
+ virtual ~WalletConnectCallback () {} // need virtual to prevent memory leak
51
+ // need to pure virtual to prevent incorrect callback
52
+ virtual void
53
+ onConnected (const WalletConnectSessionInfo &sessioninfo) const = 0 ;
54
+ virtual void
55
+ onDisconnected (const WalletConnectSessionInfo &sessioninfo) const = 0 ;
56
+ virtual void
57
+ onConnecting (const WalletConnectSessionInfo &sessioninfo) const = 0 ;
58
+ virtual void onUpdated (const WalletConnectSessionInfo &sessioninfo) const = 0;
56
59
};
57
60
58
61
std::unique_ptr<WalletConnectCallback> new_walletconnect_callback ();
59
- }}}
62
+ } // namespace game_sdk
63
+ } // namespace crypto
64
+ } // namespace com
0 commit comments