@exodus/web3-ethereum 1.4.2 → 1.4.3
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.
|
@@ -4,7 +4,7 @@ import type { Transport } from '@exodus/web3-types';
|
|
|
4
4
|
interface RpcConstructor {
|
|
5
5
|
new (...options: unknown[]): typeof RPC;
|
|
6
6
|
}
|
|
7
|
-
export declare function parseAndValidateRequestWithEVMPrefix(stringifiedValue: string):
|
|
7
|
+
export declare function parseAndValidateRequestWithEVMPrefix(stringifiedValue: string): unknown;
|
|
8
8
|
export declare const registerRPCHandlers: ({ deps, RPC, transport, }: {
|
|
9
9
|
deps: Dependencies;
|
|
10
10
|
RPC: RpcConstructor;
|
|
@@ -31,13 +31,15 @@ export function parseAndValidateRequestWithEVMPrefix(stringifiedValue) {
|
|
|
31
31
|
return validateRequest(value);
|
|
32
32
|
}
|
|
33
33
|
const underscorePosition = originalMethod.indexOf('_');
|
|
34
|
-
if (underscorePosition === -1) {
|
|
34
|
+
if (underscorePosition === -1 || typeof originalMethod !== 'string') {
|
|
35
35
|
return validateRequest(value);
|
|
36
36
|
}
|
|
37
37
|
// 0x1_eth_getAccounts -> eth_getAccounts
|
|
38
38
|
const methodWithoutPrefix = originalMethod.slice(underscorePosition + 1);
|
|
39
|
-
validateRequest
|
|
40
|
-
|
|
39
|
+
// NOTE: validateRequest can deeply mutate the argument, e.g. removing additional properties.
|
|
40
|
+
// We should always use the result of validateRequest() call, and never use the original argument again.
|
|
41
|
+
const validated = validateRequest({ ...value, method: methodWithoutPrefix });
|
|
42
|
+
return { ...validated, method: originalMethod };
|
|
41
43
|
}
|
|
42
44
|
export const registerRPCHandlers = ({ deps, RPC, transport, }) => {
|
|
43
45
|
validateCommonDeps(deps, ['evms']);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/web3-ethereum",
|
|
3
3
|
"description": "Apps connectivity library for EVM-compatible chains.",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@exodus/assets": "^8.0.72"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c414d2c359ecbd25fe1b4d244f6fb51f633a4284"
|
|
53
53
|
}
|