@tomo-inc/wallet-connect-kit 0.0.13 → 0.0.14
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/README.md +48 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -644,6 +644,53 @@ export function SwitchChainButton() {
|
|
|
644
644
|
}
|
|
645
645
|
```
|
|
646
646
|
|
|
647
|
+
### Get Wallet Providers
|
|
648
|
+
|
|
649
|
+
Use the `useProviders` hook to get all available providers from the currently connected wallet. This is useful for wallets that support multiple chains (e.g., OKX Wallet supports EVM, Solana, and Aptos):
|
|
650
|
+
|
|
651
|
+
```tsx
|
|
652
|
+
import { useProviders } from "@tomo-inc/wallet-connect-kit";
|
|
653
|
+
|
|
654
|
+
export function ProvidersInfo() {
|
|
655
|
+
const { providers, currentProvider } = useProviders();
|
|
656
|
+
|
|
657
|
+
if (!providers) {
|
|
658
|
+
return <div>No wallet connected</div>;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// providers is an object with chain types as keys
|
|
662
|
+
// e.g., { evm: { provider, protocol, standard }, solana: { ... }, aptos: { ... } }
|
|
663
|
+
const supportedChains = Object.keys(providers).filter(
|
|
664
|
+
(chainType) => providers[chainType as keyof typeof providers] !== null
|
|
665
|
+
);
|
|
666
|
+
|
|
667
|
+
return (
|
|
668
|
+
<div>
|
|
669
|
+
<h3>Supported Chains:</h3>
|
|
670
|
+
<ul>
|
|
671
|
+
{supportedChains.map((chainType) => (
|
|
672
|
+
<li key={chainType}>{chainType.toUpperCase()}</li>
|
|
673
|
+
))}
|
|
674
|
+
</ul>
|
|
675
|
+
<p>Current Provider: {currentProvider ? "Connected" : "Not connected"}</p>
|
|
676
|
+
</div>
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
**Returns:**
|
|
682
|
+
|
|
683
|
+
```tsx
|
|
684
|
+
interface UseProviders {
|
|
685
|
+
// All available providers from the current wallet, keyed by chain type
|
|
686
|
+
providers: ConnectorProviders | null;
|
|
687
|
+
// The currently active provider
|
|
688
|
+
currentProvider: WalletProvider | null;
|
|
689
|
+
}
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
**Note:** `providers` contains all connectors supported by the current wallet. For example, if you connect OKX Wallet, `providers` may include `evm`, `solana`, and `aptos` connectors. The `currentProvider` is the provider currently being used for the active chain.
|
|
693
|
+
|
|
647
694
|
### Integration with Wagmi
|
|
648
695
|
|
|
649
696
|
Wallet Connect Kit can seamlessly integrate with Wagmi. If you're already using `WagmiProvider`, Wallet Connect Kit will automatically detect and use Wagmi's configuration:
|
|
@@ -758,6 +805,7 @@ type ChainType = "evm" | "solana" | "aptos" | "dogecoin";
|
|
|
758
805
|
- `WalletConnectProvider` - Main Provider component
|
|
759
806
|
- `useAccount` - Account information Hook
|
|
760
807
|
- `useWalletConnect` - Connect Hook
|
|
808
|
+
- `useProviders` - Providers information Hook (get all available providers from current wallet)
|
|
761
809
|
- `getChains` - Utility function to configure chains (can wrap backend API chains)
|
|
762
810
|
- `getConnectors` - Utility function to configure connectors (from @tomo-inc/wallet-adaptor-base)
|
|
763
811
|
- Types: `WalletConnectKitConfig`, `Chain`, `WalletConfig`, `UseAccount`, `ChainType`, `ModalView`, `ThemeConfig`, `UserLoginConfig`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomo-inc/wallet-connect-kit",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"qrcode": "^1.5.4",
|
|
28
28
|
"viem": "2.38.2",
|
|
29
29
|
"@tomo-inc/embedded-wallet-providers": "0.0.17",
|
|
30
|
-
"@tomo-inc/
|
|
31
|
-
"@tomo-inc/
|
|
30
|
+
"@tomo-inc/wallet-adaptor-base": "0.0.19",
|
|
31
|
+
"@tomo-inc/tomo-ui": "0.0.11"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=18",
|