Skip to content

Commit 17dd4d9

Browse files
docs: Update documentation for controller PR #1899 (#63)
Updates documentation to reflect changes made in: feat: enable switch chain for external wallets Related controller PR: cartridge-gg/controller#1899 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 6110497 commit 17dd4d9

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/pages/controller/configuration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ When you provide custom chains via the `chains` option, they take precedence ove
3939
- Use custom RPC endpoints for mainnet or sepolia
4040
- Add support for additional networks (like Slot katana instances)
4141
- Override default chain configurations
42+
- Programmatically switch chains for connected external wallets (MetaMask, Rabby, WalletConnect)
43+
44+
### External Wallet Chain Switching
45+
46+
Controller supports programmatic chain switching for external wallets through the `externalSwitchChain` method. This allows applications to request connected external wallets to switch to different blockchain networks seamlessly.
4247

4348
**Example:**
4449
```typescript

src/pages/controller/signer-management.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,38 @@ When connecting to your Controller:
127127
- Select any of your registered signers to authenticate
128128
- Your account and assets remain the same regardless of which signer you use
129129

130+
### Chain Switching for External Wallets
131+
132+
External wallets (MetaMask, Rabby, WalletConnect) support programmatic chain switching through the Controller interface. This allows applications to request that connected external wallets switch to a specific blockchain network.
133+
134+
**Supported Functionality:**
135+
- **Automatic Chain Switching**: Applications can programmatically request external wallets to switch chains
136+
- **Cross-Chain Compatibility**: Works with Ethereum, Starknet, and other supported networks
137+
- **Seamless Integration**: No additional user interaction required beyond the wallet's own confirmation
138+
139+
**How It Works:**
140+
1. Your application calls the chain switch method through the Controller
141+
2. The request is forwarded to the connected external wallet
142+
3. The wallet handles the chain switching process (may show user confirmation)
143+
4. The application receives confirmation of the successful chain switch
144+
145+
**Example Usage:**
146+
```typescript
147+
// Switch connected external wallet to a different chain
148+
const success = await controller.externalSwitchChain(
149+
walletType, // e.g., "metamask", "rabby"
150+
chainId // Target chain identifier
151+
);
152+
153+
if (success) {
154+
console.log("Chain switched successfully");
155+
} else {
156+
console.log("Chain switch failed or was cancelled");
157+
}
158+
```
159+
160+
**Note:** Chain switching availability depends on the specific external wallet's capabilities and the target chain support.
161+
130162
## Security Considerations
131163

132164
### Best Practices

0 commit comments

Comments
 (0)