File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/thirdweb/src/adapters/eip1193 Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import type { Account, Wallet } from "../../wallets/interfaces/wallet.js";
99import { createWalletEmitter } from "../../wallets/wallet-emitter.js" ;
1010import type { WalletId } from "../../wallets/wallet-types.js" ;
1111import type { EIP1193Provider } from "./types.js" ;
12+ import * as ox__Hex from "ox/Hex" ;
1213
1314export type FromEip1193AdapterOptions = {
1415 provider : EIP1193Provider | ( ( ) => Promise < EIP1193Provider > ) ;
@@ -54,7 +55,7 @@ export function fromProvider(options: FromEip1193AdapterOptions): Wallet {
5455 chain = undefined ;
5556 }
5657
57- let handleDisconnect = async ( ) => { } ;
58+ let handleDisconnect = async ( ) => { } ;
5859
5960 const unsubscribeDisconnect = emitter . subscribe ( "disconnect" , ( ) => {
6061 reset ( ) ;
@@ -66,8 +67,11 @@ export function fromProvider(options: FromEip1193AdapterOptions): Wallet {
6667 account = _account ;
6768 } ) ;
6869
69- let handleSwitchChain : ( chain : Chain ) => Promise < void > = async ( ) => {
70- throw new Error ( "Not implemented" ) ;
70+ let handleSwitchChain : ( c : Chain ) => Promise < void > = async ( c ) => {
71+ await provider ?. request ( {
72+ method : "wallet_switchEthereumChain" ,
73+ params : [ { chainId : ox__Hex . fromNumber ( c . id ) } ] ,
74+ } ) ;
7175 } ;
7276
7377 return {
You can’t perform that action at this time.
0 commit comments