Merge a few serial awaits into a Promise.all (#459)

pull/461/head
Trevor Porter 3 years ago committed by GitHub
parent d4c10e2542
commit 931c37920a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      typescript/sdk/src/gas/calculator.ts

@ -135,13 +135,12 @@ export class InterchainGasCalculator<Chain extends ChainName> {
destination: Destination,
destinationHandleGas: BigNumber,
): Promise<BigNumber> {
const destinationGasPrice = await this.suggestedGasPrice(destination);
const checkpointRelayGas = await this.checkpointRelayGas(
origin,
destination,
);
const inboxProcessOverheadGas = await this.inboxProcessOverheadGas();
const [destinationGasPrice, checkpointRelayGas, inboxProcessOverheadGas] =
await Promise.all([
this.suggestedGasPrice(destination),
this.checkpointRelayGas(origin, destination),
this.inboxProcessOverheadGas(),
]);
const totalDestinationGas = checkpointRelayGas
.add(inboxProcessOverheadGas)
.add(destinationHandleGas);

Loading…
Cancel
Save