File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed 
packages/@magic-ext/evm/src Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 11import  {  Extension  }  from  '@magic-sdk/provider' ; 
2- import  {  EVMNetworkConfig ,  EVMPayloadMethod  }  from  './types' ; 
2+ import  {  EVMNetworkConfig ,  EVMPayloadMethod ,   SwitchEVMChainResult  }  from  './types' ; 
33
44export  class  EVMExtension  extends  Extension . Internal < 'evm' ,  any >  { 
55  name  =  'evm'  as  const ; 
@@ -14,13 +14,8 @@ export class EVMExtension extends Extension.Internal<'evm', any> {
1414  } 
1515
1616  public  switchEVMChain  =  ( chainId : number )  =>  { 
17-     return  this . request ( { 
18-       id : 42 , 
19-       jsonrpc : '2.0' , 
20-       method : EVMPayloadMethod . SwitchEVMChain , 
21-       params : { 
22-         chainId, 
23-       } , 
24-     } ) ; 
17+     return  this . request < string  |  SwitchEVMChainResult > ( 
18+       this . utils . createJsonRpcRequestPayload ( EVMPayloadMethod . SwitchEVMChain ,  [ chainId ] ) , 
19+     ) ; 
2520  } ; 
2621} 
Original file line number Diff line number Diff line change @@ -7,3 +7,9 @@ export enum EVMPayloadMethod {
77export  interface  EVMNetworkConfig  extends  CustomNodeConfiguration  { 
88  default ?: boolean ; 
99} 
10+ 
11+ export  interface  SwitchEVMChainResult  { 
12+   rpcUrl : string ; 
13+   chainId ?: number ; 
14+   chainType ?: string ; 
15+ } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments