Skip to content

Commit

Permalink
Merge pull request #524 from multiversx/TOOL-305-simplify-network-pro…
Browse files Browse the repository at this point in the history
…viders

Simplify networkProvider, withResults default true
  • Loading branch information
danielailie authored Nov 5, 2024
2 parents ea1b063 + 7e472da commit 439acfd
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/networkProviders/proxyNetworkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,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);
}

async getTransaction(txHash: string, _?: boolean): Promise<TransactionOnNetwork> {
const url = this.buildUrlWithQueryParameters(`transaction/${txHash}`, { withResults: "true" });
const response = await this.doGetGeneric(url);

if (processStatusPromise) {
const processStatus = await processStatusPromise;
return TransactionOnNetwork.fromProxyHttpResponse(txHash, response.transaction, processStatus);
}
return TransactionOnNetwork.fromProxyHttpResponse(txHash, response.transaction);
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 439acfd

Please sign in to comment.