You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first, we need to modify the below function inside MBCSBuilder:
pubfnresponse<R>(self,result:R) -> SelfwhereR:Serialize,{let result = serde_json::to_string(&result).unwrap();let body = format!(r#"{{"jsonrpc": "2.0", "result": {}, "id": null}}"#,
result
);self.store_response_string(body)}
This function accepts the response as the first argument.
The second argument is only useful in the websocket connections. Since we are not using any and probably won't be using them for a very long period of time, it's advisable to get rid of it.
Now, once you do that, make sure you introduce another argument, expected_request, which should accept a type of web3 call. For example, "eth_getLogs". (Refer to the Quicknode documentation) This argument could be a string as well as an Enum. It's better to create an enum because it'll make it easier to use, as the developer won't need to provide the accurate string everywhere, and adding a new call to the enum will be quick too.
This request should be stored the same way responses are stored and should be validated before sending a response. This validation should exist inside the function thread_guts() of MockBlockchainClientServer.
The text was updated successfully, but these errors were encountered:
At first, we need to modify the below function inside
MBCSBuilder
:This function accepts the response as the first argument.
The second argument is only useful in the websocket connections. Since we are not using any and probably won't be using them for a very long period of time, it's advisable to get rid of it.
Now, once you do that, make sure you introduce another argument,
expected_request
, which should accept a type of web3 call. For example, "eth_getLogs". (Refer to the Quicknode documentation) This argument could be a string as well as an Enum. It's better to create an enum because it'll make it easier to use, as the developer won't need to provide the accurate string everywhere, and adding a new call to the enum will be quick too.This request should be stored the same way responses are stored and should be validated before sending a response. This validation should exist inside the function
thread_guts()
ofMockBlockchainClientServer
.The text was updated successfully, but these errors were encountered: