Skip to content

Commit 9a84ae5

Browse files
authored
fix: avoid failure in item price retrieval (#9687)
1 parent e723163 commit 9a84ae5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappWeb3EthereumApi.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ private async UniTask ConnectToRpcAsync(string network, CancellationToken ct)
298298

299299
private async UniTask<EthApiResponse> RequestEthMethodWithoutSignatureAsync(EthApiRequest request, CancellationToken ct)
300300
{
301-
string reqJson = JsonConvert.SerializeObject(request);
301+
long callerId = request.id;
302+
request.id &= int.MaxValue;
303+
304+
string reqJson = JsonConvert.SerializeObject(new { jsonrpc = "2.0", request.id, request.method, request.@params });
302305
byte[] bytes = Encoding.UTF8.GetBytes(reqJson);
303306
await rpcWebSocket!.SendAsync(bytes, WebSocketMessageType.Text, true, ct);
304307

@@ -317,7 +320,10 @@ private async UniTask<EthApiResponse> RequestEthMethodWithoutSignatureAsync(EthA
317320
throw new Web3Exception($"RPC {request.method} failed: code {response.error.code} {response.error.message}");
318321

319322
if (response.id == request.id)
323+
{
324+
response.id = callerId;
320325
return response;
326+
}
321327
}
322328
else if (result.MessageType == WebSocketMessageType.Close)
323329
{

0 commit comments

Comments
 (0)