Skip to content

Commit

Permalink
Merge pull request #430 from multiversx/adjust-output-query
Browse files Browse the repository at this point in the history
Adjust output of queries controller (unwrap native values)
  • Loading branch information
andreibancioiu authored Apr 2, 2024
2 parents 1eaa100 + 5820ce4 commit d9697c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/smartContractQueriesController.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,9 @@ describe("test smart contract queries controller", () => {
],
});

const parsed = controller.parseQueryResponse(response);
const plainData = parsed[0].valueOf();
const [parsed] = controller.parseQueryResponse(response);

assert.deepEqual(plainData, {
assert.deepEqual(parsed, {
token_identifier: "lucky-token",
ticket_price: new BigNumber("1"),
tickets_left: new BigNumber(0),
Expand Down
3 changes: 2 additions & 1 deletion src/smartContractQueriesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class SmartContractQueriesController {
const functionName = response.function;
const endpoint = this.abi.getEndpoint(functionName);
const legacyBundle = this.legacyResultsParser.parseQueryResponse(legacyQueryResponse, endpoint);
return legacyBundle.values;
const nativeValues = legacyBundle.values.map((value) => value.valueOf());
return nativeValues;
}
}

0 comments on commit d9697c6

Please sign in to comment.