@@ -90,8 +90,23 @@ public class ThirdwebManager : MonoBehaviour
90
90
[ Tooltip ( "WalletConnect Project ID (https://cloud.walletconnect.com/app)" ) ]
91
91
public string walletConnectProjectId = null ;
92
92
93
- [ Tooltip ( "Wallets to show in the WalletConnect Modal (https://walletconnect.com/explorer)" ) ]
94
- public string [ ] walletConnectExplorerRecommendedWalletIds = new string [ ] { } ;
93
+ [ Tooltip ( "WalletConnect WebGL QR Modal: enable recommended explorer wallet buttons" ) ]
94
+ public bool walletConnectEnableExplorer = false ;
95
+
96
+ [ Tooltip ( "WalletConnect WebGL QR Modal: wallets to display in the WC modal (https://walletconnect.com/explorer)" ) ]
97
+ public string [ ] walletConnectExplorerRecommendedWalletIds = null ;
98
+
99
+ [ Tooltip ( "WalletConnect WebGL QR Modal: mapping of wallet id to wallet image" ) ]
100
+ public List < StringPair > walletConnectWalletImages = null ;
101
+
102
+ [ Tooltip ( "WalletConnect WebGL QR Modal: custom desktop wallets to display." ) ]
103
+ public ThirdwebSDK . WalletConnectWalletOptions [ ] walletConnectDesktopWallets ;
104
+
105
+ [ Tooltip ( "WalletConnect WebGL QR Modal: custom mobile wallets to display." ) ]
106
+ public ThirdwebSDK . WalletConnectWalletOptions [ ] walletConnectMobileWallets ;
107
+
108
+ [ Tooltip ( "WalletConnect Theme Mode (light or dark)" ) ]
109
+ public string walletConnectThemeMode = null ;
95
110
96
111
[ Tooltip ( "Factory Contract Address" ) ]
97
112
public string factoryAddress ;
@@ -224,60 +239,65 @@ public void Initialize(string chainIdentifier)
224
239
225
240
thirdwebConfig = Resources . Load < ThirdwebConfig > ( "ThirdwebConfig" ) ;
226
241
242
+ // Setup WalletConnect options
243
+
244
+ var wcImages = new Dictionary < string , string > ( ) ;
245
+ if ( walletConnectWalletImages != null && walletConnectWalletImages . Count > 0 )
246
+ foreach ( var pair in walletConnectWalletImages )
247
+ wcImages . Add ( pair . key , pair . value ) ;
248
+
249
+ if ( walletConnectDesktopWallets != null && walletConnectDesktopWallets . Length > 0 )
250
+ {
251
+ for ( int i = 0 ; i < walletConnectDesktopWallets . Length ; i ++ )
252
+ {
253
+ if ( walletConnectDesktopWallets [ i ] . links == null )
254
+ continue ;
255
+
256
+ if ( string . IsNullOrEmpty ( walletConnectDesktopWallets [ i ] . links . native ) && string . IsNullOrEmpty ( walletConnectDesktopWallets [ i ] . links . universal ) )
257
+ {
258
+ walletConnectDesktopWallets [ i ] . links = null ;
259
+ continue ;
260
+ }
261
+
262
+ walletConnectDesktopWallets [ i ] . links . native = string . IsNullOrEmpty ( walletConnectDesktopWallets [ i ] . links . native ) ? null : walletConnectDesktopWallets [ i ] . links . native ;
263
+ walletConnectDesktopWallets [ i ] . links . universal = string . IsNullOrEmpty ( walletConnectDesktopWallets [ i ] . links . universal ) ? null : walletConnectDesktopWallets [ i ] . links . universal ;
264
+ }
265
+ }
266
+
267
+ if ( walletConnectMobileWallets != null && walletConnectMobileWallets . Length > 0 )
268
+ {
269
+ for ( int i = 0 ; i < walletConnectMobileWallets . Length ; i ++ )
270
+ {
271
+ if ( walletConnectMobileWallets [ i ] . links == null )
272
+ continue ;
273
+
274
+ if ( string . IsNullOrEmpty ( walletConnectMobileWallets [ i ] . links . native ) && string . IsNullOrEmpty ( walletConnectMobileWallets [ i ] . links . universal ) )
275
+ {
276
+ walletConnectMobileWallets [ i ] . links = null ;
277
+ continue ;
278
+ }
279
+
280
+ walletConnectMobileWallets [ i ] . links . native = string . IsNullOrEmpty ( walletConnectMobileWallets [ i ] . links . native ) ? null : walletConnectMobileWallets [ i ] . links . native ;
281
+ walletConnectMobileWallets [ i ] . links . universal = string . IsNullOrEmpty ( walletConnectMobileWallets [ i ] . links . universal ) ? null : walletConnectMobileWallets [ i ] . links . universal ;
282
+ }
283
+ }
284
+
227
285
options . wallet = new ThirdwebSDK . WalletOptions ( )
228
286
{
229
287
appName = string . IsNullOrEmpty ( appName ) ? "thirdweb powered dApp" : appName ,
230
288
appDescription = string . IsNullOrEmpty ( appDescription ) ? "thirdweb powered dApp" : appDescription ,
231
289
appIcons = ( appIcons == null || appIcons . Length == 0 || string . IsNullOrEmpty ( appIcons [ 0 ] ) ) ? new string [ ] { "https://thirdweb.com/favicon.ico" } : appIcons ,
232
290
appUrl = string . IsNullOrEmpty ( appUrl ) ? "https://thirdweb.com" : appUrl ,
233
291
walletConnectProjectId = string . IsNullOrEmpty ( walletConnectProjectId ) ? "145769e410f16970a79ff77b2d89a1e0" : walletConnectProjectId ,
292
+ walletConnectEnableExplorer = walletConnectEnableExplorer ,
234
293
walletConnectExplorerRecommendedWalletIds =
235
294
( walletConnectExplorerRecommendedWalletIds == null || walletConnectExplorerRecommendedWalletIds . Length == 0 || string . IsNullOrEmpty ( walletConnectExplorerRecommendedWalletIds [ 0 ] ) )
236
- ? new string [ ]
237
- {
238
- "c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96" , // metamask
239
- "4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0" , // trustwallet
240
- "225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f" , // safe
241
- "1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369" , // rainbow
242
- "a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393" , // phantom
243
- "c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a" , // uniswap
244
- "ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18" , // zerion
245
- "ef333840daf915aafdc4a004525502d6d49d77bd9c65e0642dbaefb3c2893bef" , // imtoken
246
- "bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6" , // argent
247
- "74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d" , // spot
248
- "afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7" , // omni
249
- "f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d" , // crypto.com
250
- "20459438007b75f4f4acb98bf29aa3b800550309646d375da5fd4aac6c2a2c66" , // tokenpocket
251
- "8837dd9413b1d9b585ee937d27a816590248386d9dbf59f5cd3422dbbb65683e" , // robinhood wallet
252
- "85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041" , // frontier
253
- "84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04" , // blockchain.com
254
- "0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150" , // safepal
255
- "38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662" , // bitkeep
256
- "9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0" , // zengo
257
- "c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576" , // 1inch
258
- "8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4" , // binance defi wallet
259
- "e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4" , // exodus
260
- "19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927" , // ledger live
261
- "f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2" , // mew wallet
262
- "138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98" , // alpha wallet
263
- "47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83" , // keyring pro
264
- "76a3d548a08cf402f5c7d021f24fd2881d767084b387a5325df88bc3d4b6f21b" , // lobstr wallet
265
- "dceb063851b1833cbb209e3717a0a0b06bf3fb500fe9db8cd3a553e4b1d02137" , // onto
266
- "7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26" , // math wallet
267
- "8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3" , // unstoppable domains
268
- "031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa" , // obvious
269
- "5864e2ced7c293ed18ac35e0db085c09ed567d67346ccb6f58a0327a75137489" , // fireblocks
270
- "2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568" , // ambire wallet
271
- "802a2041afdaf4c7e41a2903e98df333c8835897532699ad370f829390c6900f" , // infinity wallet
272
- "7424d97904535b14fe34f09f63d8ca66935546f798758dabd5b26c2309f2b1f9" , // bridge wallet
273
- "dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd" , // internet money wallet
274
- "c482dfe368d4f004479977fd88e80dc9e81107f3245d706811581a6dfe69c534" , // now wallet
275
- "107bb20463699c4e614d3a2fb7b961e66f48774cb8f6d6c1aee789853280972c" , // bitcoin.com wallet
276
- "053ac0ac602e0969736941cf5aa07a3af57396d4601cb521a173a626e1015fb1" , // au wallet
277
- "2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01" , // coin98 super app
278
- "b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f" , // abc wallet
279
- }
295
+ ? null
280
296
: walletConnectExplorerRecommendedWalletIds ,
297
+ walletConnectWalletImages = wcImages == null || wcImages . Count == 0 ? null : wcImages ,
298
+ walletConnectDesktopWallets = ( walletConnectDesktopWallets == null || walletConnectDesktopWallets . Length == 0 ) ? null : walletConnectDesktopWallets ,
299
+ walletConnectMobileWallets = ( walletConnectMobileWallets == null || walletConnectMobileWallets . Length == 0 ) ? null : walletConnectMobileWallets ,
300
+ walletConnectThemeMode = ( string . IsNullOrEmpty ( walletConnectThemeMode ) || ( walletConnectThemeMode != "light" && walletConnectThemeMode != "dark" ) ) ? null : walletConnectThemeMode ,
281
301
customScheme = string . IsNullOrEmpty ( thirdwebConfig . customScheme ) ? null : thirdwebConfig . customScheme ,
282
302
} ;
283
303
@@ -303,5 +323,12 @@ public void Initialize(string activeChainRpc, BigInteger activeChainId, Thirdweb
303
323
{
304
324
SDK = new ThirdwebSDK ( activeChainRpc , activeChainId , options ) ;
305
325
}
326
+
327
+ [ System . Serializable ]
328
+ public struct StringPair
329
+ {
330
+ public string key ;
331
+ public string value ;
332
+ }
306
333
}
307
334
}
0 commit comments