@tomo-inc/wallet-connect-protocol 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  var SignClient = require('@walletconnect/sign-client');
4
4
  var QRCode = require('qrcode');
5
- var react = require('react');
6
- var jsxRuntime = require('react/jsx-runtime');
7
5
 
8
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
7
 
@@ -287,156 +285,6 @@ var WalletConnectClient = class {
287
285
  return { ...this.config };
288
286
  }
289
287
  };
290
- var WalletConnectContext = react.createContext(void 0);
291
- function WalletConnectProvider({ config, children, autoInit = true }) {
292
- const [client, setClient] = react.useState(null);
293
- const [initialized, setInitialized] = react.useState(false);
294
- const [connecting, setConnecting] = react.useState(false);
295
- const [uri, setUri] = react.useState(null);
296
- const [sessions, setSessions] = react.useState([]);
297
- const refreshSessions = react.useCallback(() => {
298
- if (client) {
299
- const activeSessions = client.getActiveSessions();
300
- setSessions(activeSessions);
301
- }
302
- }, [client]);
303
- const initialize = react.useCallback(async () => {
304
- if (initialized) {
305
- return;
306
- }
307
- try {
308
- const newClient = new WalletConnectClient(config);
309
- newClient.on("display_uri", ({ uri: uri2 }) => {
310
- setUri(uri2);
311
- });
312
- const handleSessionUpdate = () => {
313
- const activeSessions2 = newClient.getActiveSessions();
314
- setSessions(activeSessions2);
315
- };
316
- newClient.on("session_proposal", handleSessionUpdate);
317
- newClient.on("session_update", handleSessionUpdate);
318
- newClient.on("session_delete", handleSessionUpdate);
319
- await newClient.initialize();
320
- setClient(newClient);
321
- setInitialized(true);
322
- const activeSessions = newClient.getActiveSessions();
323
- setSessions(activeSessions);
324
- } catch (error) {
325
- throw error;
326
- }
327
- }, [config, initialized]);
328
- const connect = react.useCallback(async () => {
329
- if (!client) {
330
- throw new Error("WalletConnect client not initialized");
331
- }
332
- setConnecting(true);
333
- try {
334
- const connectionUri = await client.connect();
335
- setUri(connectionUri);
336
- return connectionUri;
337
- } catch (error) {
338
- throw error;
339
- } finally {
340
- setConnecting(false);
341
- }
342
- }, [client]);
343
- const generateQRCode = react.useCallback(
344
- async (uri2, options) => {
345
- if (!client) {
346
- throw new Error("WalletConnect client not initialized");
347
- }
348
- return client.generateQRCode(uri2, options);
349
- },
350
- [client]
351
- );
352
- const disconnect = react.useCallback(
353
- async (topic) => {
354
- if (!client) {
355
- throw new Error("WalletConnect client not initialized");
356
- }
357
- await client.disconnectSession(topic);
358
- refreshSessions();
359
- },
360
- [client]
361
- );
362
- react.useEffect(() => {
363
- if (!client || !initialized) return;
364
- const interval = setInterval(() => {
365
- refreshSessions();
366
- }, 2e3);
367
- return () => clearInterval(interval);
368
- }, [client, initialized, refreshSessions]);
369
- react.useEffect(() => {
370
- if (autoInit && !initialized) {
371
- initialize().catch(console.error);
372
- }
373
- }, [autoInit, initialized, initialize]);
374
- react.useEffect(() => {
375
- return () => {
376
- if (client) {
377
- client.destroy().catch(console.error);
378
- }
379
- };
380
- }, [client]);
381
- const value = {
382
- client,
383
- initialized,
384
- connecting,
385
- uri,
386
- sessions,
387
- initialize,
388
- connect,
389
- generateQRCode,
390
- disconnect,
391
- refreshSessions
392
- };
393
- return /* @__PURE__ */ jsxRuntime.jsx(WalletConnectContext.Provider, { value, children });
394
- }
395
- function useWalletConnect() {
396
- const context = react.useContext(WalletConnectContext);
397
- if (!context) {
398
- throw new Error("useWalletConnect must be used within WalletConnectProvider");
399
- }
400
- return context;
401
- }
402
- function useQRCode(uri, options) {
403
- const { generateQRCode } = useWalletConnect();
404
- const [qrCode, setQrCode] = react.useState(null);
405
- const [loading, setLoading] = react.useState(false);
406
- const [error, setError] = react.useState(null);
407
- const generate = react.useCallback(
408
- async (targetUri) => {
409
- const uriToUse = targetUri || uri;
410
- if (!uriToUse) {
411
- setError(new Error("No URI provided"));
412
- return;
413
- }
414
- setLoading(true);
415
- setError(null);
416
- try {
417
- const qr = await generateQRCode(uriToUse, options);
418
- setQrCode(qr);
419
- } catch (err) {
420
- setError(err);
421
- setQrCode(null);
422
- } finally {
423
- setLoading(false);
424
- }
425
- },
426
- [uri, options, generateQRCode]
427
- );
428
- react.useEffect(() => {
429
- if (uri) {
430
- generate(uri);
431
- }
432
- }, [uri, generate]);
433
- return {
434
- qrCode,
435
- loading,
436
- error,
437
- generate
438
- };
439
- }
440
288
 
441
289
  // src/utils.ts
442
290
  function isValidWalletConnectUri(uri) {
@@ -541,108 +389,117 @@ function parseChainId(chainId) {
541
389
  return { namespace, reference };
542
390
  }
543
391
 
544
- // src/hooks/useSession.ts
545
- function useSession(topic) {
546
- const { sessions, disconnect, refreshSessions, client } = useWalletConnect();
547
- const [currentSession, setCurrentSession] = react.useState(null);
548
- react.useEffect(() => {
549
- if (topic) {
550
- const session = sessions.find((s) => s.topic === topic);
551
- setCurrentSession(session || null);
552
- } else {
553
- setCurrentSession(sessions[0] || null);
554
- }
555
- }, [topic, sessions]);
556
- const disconnectSession = react.useCallback(
557
- async (sessionTopic) => {
558
- const topicToDisconnect = sessionTopic || topic || currentSession?.topic;
559
- if (!topicToDisconnect) {
560
- throw new Error("No session to disconnect");
561
- }
562
- await disconnect(topicToDisconnect);
563
- },
564
- [topic, currentSession, disconnect]
565
- );
566
- const checkExpired = react.useCallback((session) => {
567
- return isSessionExpired(session.expiry);
568
- }, []);
569
- const getAccounts = react.useCallback(
570
- (session) => {
571
- const targetSession = session || currentSession;
572
- if (!targetSession) return [];
573
- const allAccounts = [];
574
- Object.values(targetSession.namespaces).forEach((namespace) => {
575
- if (namespace.accounts) {
576
- allAccounts.push(...namespace.accounts);
577
- }
578
- });
579
- return allAccounts;
580
- },
581
- [currentSession]
582
- );
583
- const getChains = react.useCallback(
584
- (session) => {
585
- const targetSession = session || currentSession;
586
- if (!targetSession) return [];
587
- const allChains = [];
588
- Object.values(targetSession.namespaces).forEach((namespace) => {
589
- if (namespace.chains) {
590
- allChains.push(...namespace.chains);
591
- }
592
- });
593
- return allChains;
594
- },
595
- [currentSession]
596
- );
597
- return {
598
- session: currentSession,
599
- allSessions: sessions,
600
- disconnect: disconnectSession,
601
- refresh: refreshSessions,
602
- isExpired: currentSession ? checkExpired(currentSession) : false,
603
- getAccounts,
604
- getChains,
605
- hasSession: !!currentSession
606
- };
607
- }
608
- function useConnect(options) {
609
- const { connect, generateQRCode, connecting } = useWalletConnect();
610
- const [uri, setUri] = react.useState(null);
611
- const [qrCode, setQrCode] = react.useState(null);
612
- const [error, setError] = react.useState(null);
613
- const handleConnect = react.useCallback(async () => {
614
- setError(null);
615
- try {
616
- const connectionUri = await connect();
617
- setUri(connectionUri);
618
- if (options?.onConnect) {
619
- options.onConnect(connectionUri);
620
- }
621
- if (options?.autoGenerateQRCode !== false) {
622
- const qr = await generateQRCode(connectionUri, options?.qrCodeOptions);
623
- setQrCode(qr);
624
- }
625
- return connectionUri;
626
- } catch (err) {
627
- const error2 = err;
628
- setError(error2);
629
- options?.onError?.(error2);
630
- throw error2;
631
- }
632
- }, [connect, generateQRCode, options]);
633
- const reset = react.useCallback(() => {
634
- setUri(null);
635
- setQrCode(null);
636
- setError(null);
637
- }, []);
638
- return {
639
- connect: handleConnect,
640
- uri,
641
- qrCode,
642
- connecting,
643
- error,
644
- reset
645
- };
392
+ // src/chains.ts
393
+ var EIP155_NAMESPACE = {
394
+ chains: ["eip155:1"],
395
+ // Ethereum Mainnet
396
+ methods: [
397
+ "eth_sendTransaction",
398
+ "eth_signTransaction",
399
+ "eth_sign",
400
+ "personal_sign",
401
+ "eth_signTypedData",
402
+ "eth_signTypedData_v4",
403
+ "wallet_switchEthereumChain",
404
+ "wallet_addEthereumChain"
405
+ ],
406
+ events: ["chainChanged", "accountsChanged"]
407
+ };
408
+ var SOLANA_NAMESPACE = {
409
+ chains: ["solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"],
410
+ // Solana Mainnet
411
+ methods: ["solana_signTransaction", "solana_signMessage", "solana_signAndSendTransaction"],
412
+ events: ["accountsChanged", "chainChanged"]
413
+ };
414
+ var APTOS_NAMESPACE = {
415
+ chains: ["aptos:1"],
416
+ // Aptos Mainnet
417
+ methods: ["aptos_signTransaction", "aptos_signMessage", "aptos_signAndSubmitTransaction"],
418
+ events: ["accountChanged", "networkChanged"]
419
+ };
420
+ var COSMOS_NAMESPACE = {
421
+ chains: ["cosmos:cosmoshub-4"],
422
+ // Cosmos Hub
423
+ methods: ["cosmos_signDirect", "cosmos_signAmino", "cosmos_getAccounts"],
424
+ events: ["chainChanged", "accountsChanged"]
425
+ };
426
+ var POLKADOT_NAMESPACE = {
427
+ chains: ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
428
+ // Polkadot Mainnet
429
+ methods: ["polkadot_signTransaction", "polkadot_signMessage"],
430
+ events: ["accountsChanged"]
431
+ };
432
+ var NEAR_NAMESPACE = {
433
+ chains: ["near:mainnet"],
434
+ methods: ["near_signTransaction", "near_signMessage"],
435
+ events: ["accountsChanged"]
436
+ };
437
+ var EVM_CHAINS = {
438
+ // Ethereum
439
+ ETHEREUM_MAINNET: "eip155:1",
440
+ ETHEREUM_GOERLI: "eip155:5",
441
+ ETHEREUM_SEPOLIA: "eip155:11155111",
442
+ // Layer 2 (L2)
443
+ POLYGON: "eip155:137",
444
+ POLYGON_MUMBAI: "eip155:80001",
445
+ ARBITRUM: "eip155:42161",
446
+ ARBITRUM_GOERLI: "eip155:421613",
447
+ OPTIMISM: "eip155:10",
448
+ OPTIMISM_GOERLI: "eip155:420",
449
+ // other EVM chains
450
+ BSC: "eip155:56",
451
+ BSC_TESTNET: "eip155:97",
452
+ AVALANCHE: "eip155:43114",
453
+ AVALANCHE_FUJI: "eip155:43113",
454
+ FANTOM: "eip155:250",
455
+ CRONOS: "eip155:25",
456
+ GNOSIS: "eip155:100",
457
+ BASE: "eip155:8453",
458
+ ZKSYNC: "eip155:324",
459
+ LINEA: "eip155:59144",
460
+ SCROLL: "eip155:534352"
461
+ };
462
+ var SOLANA_CHAINS = {
463
+ MAINNET: "solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",
464
+ DEVNET: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
465
+ TESTNET: "solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"
466
+ };
467
+ var APTOS_CHAINS = {
468
+ MAINNET: "aptos:1",
469
+ TESTNET: "aptos:2",
470
+ DEVNET: "aptos:3"
471
+ };
472
+ function createMultiChainNamespaces(chains) {
473
+ const namespaces = {};
474
+ const evmChains = chains.filter((chain) => chain.startsWith("eip155:"));
475
+ if (evmChains.length > 0) {
476
+ namespaces.eip155 = {
477
+ ...EIP155_NAMESPACE,
478
+ chains: evmChains
479
+ };
480
+ }
481
+ const solanaChains = chains.filter((chain) => chain.startsWith("solana:"));
482
+ if (solanaChains.length > 0) {
483
+ namespaces.solana = {
484
+ ...SOLANA_NAMESPACE,
485
+ chains: solanaChains
486
+ };
487
+ }
488
+ const aptosChains = chains.filter((chain) => chain.startsWith("aptos:"));
489
+ if (aptosChains.length > 0) {
490
+ namespaces.aptos = {
491
+ ...APTOS_NAMESPACE,
492
+ chains: aptosChains
493
+ };
494
+ }
495
+ const cosmosChains = chains.filter((chain) => chain.startsWith("cosmos:"));
496
+ if (cosmosChains.length > 0) {
497
+ namespaces.cosmos = {
498
+ ...COSMOS_NAMESPACE,
499
+ chains: cosmosChains
500
+ };
501
+ }
502
+ return namespaces;
646
503
  }
647
504
 
648
505
  // src/siwe.ts
@@ -732,13 +589,6 @@ function generateNonce(length = 16) {
732
589
  }
733
590
  return nonce;
734
591
  }
735
- function extractChainIdNumber(account) {
736
- const parts = account.split(":");
737
- if (parts.length > 2) {
738
- return parseInt(parts[1], 10);
739
- }
740
- return 1;
741
- }
742
592
  function createSiweConfigFromSession(params) {
743
593
  return {
744
594
  domain: params.domain,
@@ -794,263 +644,6 @@ var SiweAuth = class {
794
644
  }
795
645
  };
796
646
 
797
- // src/hooks/useSiwe.ts
798
- function useSiwe(config) {
799
- const { client } = useWalletConnect();
800
- const [isAuthenticating, setIsAuthenticating] = react.useState(false);
801
- const [authResult, setAuthResult] = react.useState(null);
802
- const signIn = react.useCallback(
803
- async (sessionTopic) => {
804
- if (!client) {
805
- throw new Error("WalletConnect client not initialized");
806
- }
807
- const sessions = client.getActiveSessions();
808
- if (sessions.length === 0) {
809
- throw new Error("No active sessions. Connect wallet first.");
810
- }
811
- setIsAuthenticating(true);
812
- setAuthResult(null);
813
- try {
814
- const session = sessionTopic ? sessions.find((s) => s.topic === sessionTopic) : sessions[0];
815
- if (!session) {
816
- throw new Error("Session not found");
817
- }
818
- const accounts = Object.values(session.namespaces).flatMap((ns) => ns.accounts || []);
819
- const primaryAccount = accounts[0];
820
- if (!primaryAccount) {
821
- throw new Error("No accounts found in session");
822
- }
823
- const address = extractAddressFromAccount(primaryAccount);
824
- const chainIdStr = extractChainIdFromAccount(primaryAccount);
825
- const chainId = extractChainIdNumber(primaryAccount);
826
- const siweConfig = createSiweConfigFromSession({
827
- domain: config?.domain || window.location.host,
828
- uri: config?.uri || window.location.origin,
829
- chainId,
830
- statement: config?.statement,
831
- resources: config?.resources
832
- });
833
- const siweAuth = new SiweAuth(siweConfig);
834
- const message = await siweAuth.createMessage(address);
835
- if (!client.signClient) {
836
- throw new Error("SignClient not initialized");
837
- }
838
- const signature = await client.signClient.request({
839
- topic: session.topic,
840
- chainId: chainIdStr,
841
- request: {
842
- method: "personal_sign",
843
- params: [message, address]
844
- }
845
- });
846
- const verifyResult = await siweAuth.verify(message, signature);
847
- if (verifyResult.success) {
848
- setAuthResult({
849
- success: true,
850
- address,
851
- message,
852
- signature
853
- });
854
- return {
855
- success: true,
856
- address,
857
- message,
858
- signature,
859
- siweMessage: verifyResult.data
860
- };
861
- } else {
862
- throw new Error(verifyResult.error || "Signature verification failed");
863
- }
864
- } catch (error) {
865
- const errorMsg = error.message || "Authentication failed";
866
- setAuthResult({
867
- success: false,
868
- error: errorMsg
869
- });
870
- throw error;
871
- } finally {
872
- setIsAuthenticating(false);
873
- }
874
- },
875
- [client, config]
876
- );
877
- const signOut = react.useCallback(() => {
878
- setAuthResult(null);
879
- }, []);
880
- return {
881
- signIn,
882
- signOut,
883
- isAuthenticating,
884
- authResult,
885
- isAuthenticated: authResult?.success || false
886
- };
887
- }
888
-
889
- // src/chains.ts
890
- var EIP155_NAMESPACE = {
891
- chains: ["eip155:1"],
892
- // Ethereum Mainnet
893
- methods: [
894
- "eth_sendTransaction",
895
- "eth_signTransaction",
896
- "eth_sign",
897
- "personal_sign",
898
- "eth_signTypedData",
899
- "eth_signTypedData_v4",
900
- "wallet_switchEthereumChain",
901
- "wallet_addEthereumChain"
902
- ],
903
- events: ["chainChanged", "accountsChanged"]
904
- };
905
- var SOLANA_NAMESPACE = {
906
- chains: ["solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"],
907
- // Solana Mainnet
908
- methods: ["solana_signTransaction", "solana_signMessage", "solana_signAndSendTransaction"],
909
- events: ["accountsChanged", "chainChanged"]
910
- };
911
- var APTOS_NAMESPACE = {
912
- chains: ["aptos:1"],
913
- // Aptos Mainnet
914
- methods: ["aptos_signTransaction", "aptos_signMessage", "aptos_signAndSubmitTransaction"],
915
- events: ["accountChanged", "networkChanged"]
916
- };
917
- var COSMOS_NAMESPACE = {
918
- chains: ["cosmos:cosmoshub-4"],
919
- // Cosmos Hub
920
- methods: ["cosmos_signDirect", "cosmos_signAmino", "cosmos_getAccounts"],
921
- events: ["chainChanged", "accountsChanged"]
922
- };
923
- var POLKADOT_NAMESPACE = {
924
- chains: ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
925
- // Polkadot Mainnet
926
- methods: ["polkadot_signTransaction", "polkadot_signMessage"],
927
- events: ["accountsChanged"]
928
- };
929
- var NEAR_NAMESPACE = {
930
- chains: ["near:mainnet"],
931
- methods: ["near_signTransaction", "near_signMessage"],
932
- events: ["accountsChanged"]
933
- };
934
- var EVM_CHAINS = {
935
- // Ethereum
936
- ETHEREUM_MAINNET: "eip155:1",
937
- ETHEREUM_GOERLI: "eip155:5",
938
- ETHEREUM_SEPOLIA: "eip155:11155111",
939
- // Layer 2 (L2)
940
- POLYGON: "eip155:137",
941
- POLYGON_MUMBAI: "eip155:80001",
942
- ARBITRUM: "eip155:42161",
943
- ARBITRUM_GOERLI: "eip155:421613",
944
- OPTIMISM: "eip155:10",
945
- OPTIMISM_GOERLI: "eip155:420",
946
- // other EVM chains
947
- BSC: "eip155:56",
948
- BSC_TESTNET: "eip155:97",
949
- AVALANCHE: "eip155:43114",
950
- AVALANCHE_FUJI: "eip155:43113",
951
- FANTOM: "eip155:250",
952
- CRONOS: "eip155:25",
953
- GNOSIS: "eip155:100",
954
- BASE: "eip155:8453",
955
- ZKSYNC: "eip155:324",
956
- LINEA: "eip155:59144",
957
- SCROLL: "eip155:534352"
958
- };
959
- var SOLANA_CHAINS = {
960
- MAINNET: "solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",
961
- DEVNET: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
962
- TESTNET: "solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"
963
- };
964
- var APTOS_CHAINS = {
965
- MAINNET: "aptos:1",
966
- TESTNET: "aptos:2",
967
- DEVNET: "aptos:3"
968
- };
969
- function getChainName(chainId) {
970
- const chainNames = {
971
- // Ethereum
972
- "eip155:1": "Ethereum Mainnet",
973
- "eip155:5": "Goerli Testnet",
974
- "eip155:11155111": "Sepolia Testnet",
975
- // Layer 2
976
- "eip155:137": "Polygon",
977
- "eip155:80001": "Polygon Mumbai",
978
- "eip155:42161": "Arbitrum One",
979
- "eip155:421613": "Arbitrum Goerli",
980
- "eip155:10": "Optimism",
981
- "eip155:420": "Optimism Goerli",
982
- // other EVM chains
983
- "eip155:56": "BNB Smart Chain",
984
- "eip155:97": "BSC Testnet",
985
- "eip155:43114": "Avalanche C-Chain",
986
- "eip155:43113": "Avalanche Fuji",
987
- "eip155:250": "Fantom Opera",
988
- "eip155:25": "Cronos",
989
- "eip155:100": "Gnosis Chain",
990
- "eip155:8453": "Base",
991
- "eip155:324": "zkSync Era",
992
- "eip155:59144": "Linea",
993
- "eip155:534352": "Scroll",
994
- // Solana
995
- "solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ": "Solana Mainnet",
996
- "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": "Solana Devnet",
997
- "solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K": "Solana Testnet",
998
- // Aptos
999
- "aptos:1": "Aptos Mainnet",
1000
- "aptos:2": "Aptos Testnet",
1001
- "aptos:3": "Aptos Devnet",
1002
- // Cosmos
1003
- "cosmos:cosmoshub-4": "Cosmos Hub",
1004
- "cosmos:osmosis-1": "Osmosis",
1005
- // Polkadot
1006
- "polkadot:91b171bb158e2d3848fa23a9f1c25182": "Polkadot",
1007
- // Near
1008
- "near:mainnet": "Near Mainnet"
1009
- };
1010
- return chainNames[chainId] || chainId;
1011
- }
1012
- function createMultiChainNamespaces(chains) {
1013
- const namespaces = {};
1014
- const evmChains = chains.filter((chain) => chain.startsWith("eip155:"));
1015
- if (evmChains.length > 0) {
1016
- namespaces.eip155 = {
1017
- ...EIP155_NAMESPACE,
1018
- chains: evmChains
1019
- };
1020
- }
1021
- const solanaChains = chains.filter((chain) => chain.startsWith("solana:"));
1022
- if (solanaChains.length > 0) {
1023
- namespaces.solana = {
1024
- ...SOLANA_NAMESPACE,
1025
- chains: solanaChains
1026
- };
1027
- }
1028
- const aptosChains = chains.filter((chain) => chain.startsWith("aptos:"));
1029
- if (aptosChains.length > 0) {
1030
- namespaces.aptos = {
1031
- ...APTOS_NAMESPACE,
1032
- chains: aptosChains
1033
- };
1034
- }
1035
- const cosmosChains = chains.filter((chain) => chain.startsWith("cosmos:"));
1036
- if (cosmosChains.length > 0) {
1037
- namespaces.cosmos = {
1038
- ...COSMOS_NAMESPACE,
1039
- chains: cosmosChains
1040
- };
1041
- }
1042
- return namespaces;
1043
- }
1044
- function getChainType(chainId) {
1045
- if (chainId.startsWith("eip155:")) return "EVM";
1046
- if (chainId.startsWith("solana:")) return "Solana";
1047
- if (chainId.startsWith("aptos:")) return "Aptos";
1048
- if (chainId.startsWith("cosmos:")) return "Cosmos";
1049
- if (chainId.startsWith("polkadot:")) return "Polkadot";
1050
- if (chainId.startsWith("near:")) return "Near";
1051
- return "Unknown";
1052
- }
1053
-
1054
647
  // src/wallets.ts
1055
648
  var EXPLORER_API_URL = "https://explorer-api.walletconnect.com";
1056
649
  async function getWalletConnectWallets(options = {}) {
@@ -1205,23 +798,18 @@ exports.SOLANA_CHAINS = SOLANA_CHAINS;
1205
798
  exports.SOLANA_NAMESPACE = SOLANA_NAMESPACE;
1206
799
  exports.SiweAuth = SiweAuth;
1207
800
  exports.WalletConnectClient = WalletConnectClient;
1208
- exports.WalletConnectProvider = WalletConnectProvider;
1209
801
  exports.copyToClipboard = copyToClipboard;
1210
802
  exports.createMultiChainNamespaces = createMultiChainNamespaces;
1211
803
  exports.createSiweConfigFromSession = createSiweConfigFromSession;
1212
804
  exports.createSiweMessage = createSiweMessage;
1213
805
  exports.extractAddressFromAccount = extractAddressFromAccount;
1214
806
  exports.extractChainIdFromAccount = extractChainIdFromAccount;
1215
- exports.extractChainIdNumber = extractChainIdNumber;
1216
807
  exports.formatAddress = formatAddress;
1217
808
  exports.formatError = formatError;
1218
809
  exports.formatTimestamp = formatTimestamp;
1219
810
  exports.generateDeepLink = generateDeepLink;
1220
- exports.generateNonce = generateNonce;
1221
811
  exports.getAllWallets = getAllWallets;
1222
812
  exports.getBrowserWallets = getBrowserWallets;
1223
- exports.getChainName = getChainName;
1224
- exports.getChainType = getChainType;
1225
813
  exports.getDesktopWallets = getDesktopWallets;
1226
814
  exports.getMobileWallets = getMobileWallets;
1227
815
  exports.getRecommendedWallets = getRecommendedWallets;
@@ -1237,9 +825,4 @@ exports.parseChainId = parseChainId;
1237
825
  exports.parseSiweMessage = parseSiweMessage;
1238
826
  exports.parseWalletConnectUri = parseWalletConnectUri;
1239
827
  exports.searchWallets = searchWallets;
1240
- exports.useConnect = useConnect;
1241
- exports.useQRCode = useQRCode;
1242
- exports.useSession = useSession;
1243
- exports.useSiwe = useSiwe;
1244
- exports.useWalletConnect = useWalletConnect;
1245
828
  exports.verifySiweSignature = verifySiweSignature;