Skip to content

Commit

Permalink
Merge pull request #74 from multiversx/get-transaction-simplify
Browse files Browse the repository at this point in the history
Simplify ProxyNetworkProvider.getTransaction(): ignore parameter "withProcessStatus", consider it TRUE always
  • Loading branch information
andreibancioiu authored Oct 29, 2024
2 parents 8a6264b + 6dfeb48 commit ffbb4fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-network-providers",
"version": "2.9.0",
"version": "2.9.1",
"lockfileVersion": 2,
"requires": true,
"author": "MultiversX",
Expand Down
19 changes: 4 additions & 15 deletions src/proxyNetworkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,10 @@ export class ProxyNetworkProvider implements INetworkProvider {
return tokenData;
}

async getTransaction(txHash: string, withProcessStatus?: boolean): Promise<TransactionOnNetwork> {
let processStatusPromise: Promise<TransactionStatus> | undefined;

if (withProcessStatus === true) {
processStatusPromise = this.getTransactionStatus(txHash);
}

let url = this.buildUrlWithQueryParameters(`transaction/${txHash}`, { withResults: "true" });
let response = await this.doGetGeneric(url);

if (processStatusPromise) {
const processStatus = await processStatusPromise;
return TransactionOnNetwork.fromProxyHttpResponse(txHash, response.transaction, processStatus);
}
return TransactionOnNetwork.fromProxyHttpResponse(txHash, response.transaction);
async getTransaction(txHash: string, _?: boolean): Promise<TransactionOnNetwork> {
const url = this.buildUrlWithQueryParameters(`transaction/${txHash}`, { withResults: "true" });
const [data, status] = await Promise.all([this.doGetGeneric(url), this.getTransactionStatus(txHash)]);
return TransactionOnNetwork.fromProxyHttpResponse(txHash, data.transaction, status);
}

async getTransactionStatus(txHash: string): Promise<TransactionStatus> {
Expand Down

0 comments on commit ffbb4fd

Please sign in to comment.