Skip to content

Commit

Permalink
Merge pull request #389 from multiversx/duplicate-local-tests
Browse files Browse the repository at this point in the history
Extended localnet tests to use the transaction factories, as well
  • Loading branch information
popenta authored Apr 5, 2024
2 parents 6da6721 + db7d81d commit 86c06a4
Show file tree
Hide file tree
Showing 7 changed files with 834 additions and 118 deletions.
14 changes: 6 additions & 8 deletions src/adapters/queryRunnerAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@ export class QueryRunnerAdapter {
}

async runQuery(query: SmartContractQuery): Promise<SmartContractQueryResponse> {
const legacyQuery: IQuery = {
const adaptedQuery: IQuery = {
address: Address.fromBech32(query.contract),
caller: query.caller ? Address.fromBech32(query.caller) : undefined,
func: query.function,
value: query.value,
getEncodedArguments: () => query.arguments.map((arg) => Buffer.from(arg).toString("hex")),
};

const legacyQueryResponse = await this.networkProvider.queryContract(legacyQuery);
const queryResponse = new SmartContractQueryResponse({
const adaptedQueryResponse = await this.networkProvider.queryContract(adaptedQuery);
return new SmartContractQueryResponse({
function: query.function,
returnCode: legacyQueryResponse.returnCode.toString(),
returnMessage: legacyQueryResponse.returnMessage,
returnDataParts: legacyQueryResponse.getReturnDataParts(),
returnCode: adaptedQueryResponse.returnCode.toString(),
returnMessage: adaptedQueryResponse.returnMessage,
returnDataParts: adaptedQueryResponse.getReturnDataParts(),
});

return queryResponse;
}
}
Loading

0 comments on commit 86c06a4

Please sign in to comment.