@@ -17,6 +17,35 @@ import { JsonRpcRequest, Transaction } from './interfaces';
17
17
import { legacyTransaction , transaction1559 , transaction1559_2930 , transaction2930 } from './transactions' ;
18
18
import { getTransactionCount } from './utils' ;
19
19
20
+ /**
21
+ * Updates request parameters for JSON-RPC requests based on predefined mappings.
22
+ * This function allows overriding specific parameters in JSON-RPC requests for testing purposes
23
+ * by using file-based mappings that correspond to specific test scenarios.
24
+ *
25
+ * @template T - The type of the resolved parameter value
26
+ * @param {string } fileName - The name of the test file (e.g., 'get-block-by-hash.io')
27
+ * @param {JsonRpcRequest } request - The JSON-RPC request object containing method and params
28
+ * @returns {Promise<JsonRpcRequest> } A promise that resolves to the updated JSON-RPC request
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const request = {
33
+ * jsonrpc: '2.0',
34
+ * id: 1,
35
+ * method: 'eth_getTransactionByHash',
36
+ * params: ['0x...']
37
+ * };
38
+ *
39
+ * const updatedRequest = await updateRequestParams('get-legacy-tx.io', request);
40
+ * // The request.params[0] will be updated with the corresponding transaction hash
41
+ * ```
42
+ *
43
+ * @remarks
44
+ * The `buildTransactionOverrides` function provides a comprehensive mapping of test scenarios
45
+ * to their corresponding parameter overrides, including static values (transaction hashes,
46
+ * block hashes, account addresses) and dynamic functions that prepare and sign transactions
47
+ * with current nonces for `eth_sendRawTransaction` test cases.
48
+ */
20
49
export async function updateRequestParams < T = unknown > (
21
50
fileName : string ,
22
51
request : JsonRpcRequest ,
0 commit comments