Skip to content

Commit

Permalink
fix: fix a response data
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss committed Nov 28, 2024
1 parent d3edc3c commit 9e45d2c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
10 changes: 3 additions & 7 deletions src/provider/jsonrpc/jsonrpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ describe('JSON-RPC Provider', () => {
};

const mockABCIResponse: ABCIResponse = mock<ABCIResponse>();
mockABCIResponse.response.ResponseBase = {
Log: '',
Info: '',
Error: null,
Events: null,
Data: stringToBase64(JSON.stringify(mockSimulateResponse)),
};
mockABCIResponse.response.Value = stringToBase64(
JSON.stringify(mockSimulateResponse)
);

mockedAxios.post.mockResolvedValue({
data: newResponse<ABCIResponse>(mockABCIResponse),
Expand Down
2 changes: 1 addition & 1 deletion src/provider/jsonrpc/jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class JSONRPCProvider implements Provider {
);

const simulateResult = extractSimulateFromResponse(
abciResponse.response.ResponseBase.Data
abciResponse.response.Value
);
return simulateResult.GasUsed;
}
Expand Down
4 changes: 2 additions & 2 deletions src/provider/websocket/ws.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ describe('WS Provider', () => {
Height: '',
Key: '',
Proof: null,
Value: null,
Value: stringToBase64(JSON.stringify(mockSimulateResponse)),
ResponseBase: {
Log: '',
Info: '',
Error: null,
Events: null,
Data: stringToBase64(JSON.stringify(mockSimulateResponse)),
Data: '',
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/provider/websocket/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class WSProvider implements Provider {
const abciResponse = this.parseResponse<ABCIResponse>(response);

const simulateResult = extractSimulateFromResponse(
abciResponse.response.ResponseBase.Data
abciResponse.response.Value
);
return simulateResult.GasUsed;
}
Expand Down

0 comments on commit 9e45d2c

Please sign in to comment.