Skip to content

Commit 58d15a9

Browse files
committed
fix payload
1 parent 57deb7b commit 58d15a9

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

packages/@magic-ext/evm/src/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Extension } from '@magic-sdk/provider';
2-
import { EVMNetworkConfig, EVMPayloadMethod, SwitchEVMChainResult } from './types';
2+
import { EVMNetworkConfig, EVMPayloadMethod } from './types';
33

44
export class EVMExtension extends Extension.Internal<'evm', any> {
55
name = 'evm' as const;
@@ -14,8 +14,15 @@ export class EVMExtension extends Extension.Internal<'evm', any> {
1414
}
1515

1616
public switchEVMChain = (chainId: number) => {
17-
return this.request<string | SwitchEVMChainResult>(
18-
this.utils.createJsonRpcRequestPayload(EVMPayloadMethod.SwitchEVMChain, [chainId]),
19-
);
17+
return this.request<{
18+
network:
19+
| string
20+
| {
21+
rpcUrl: string;
22+
chainId?: number;
23+
chainType?: string;
24+
}
25+
| undefined;
26+
}>(this.utils.createJsonRpcRequestPayload(EVMPayloadMethod.SwitchEVMChain, [{ chainId }]));
2027
};
2128
}

packages/@magic-ext/evm/src/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,3 @@ export enum EVMPayloadMethod {
77
export interface EVMNetworkConfig extends CustomNodeConfiguration {
88
default?: boolean;
99
}
10-
11-
export interface SwitchEVMChainResult {
12-
rpcUrl: string;
13-
chainId?: number;
14-
chainType?: string;
15-
}

0 commit comments

Comments
 (0)