Apply gas buffer to kathy messages (#791)

* Apply gas buffer to kathy messages

* Use overrides for gas estimation

* Add comment
pull/794/head
Yorke Rhodes 2 years ago committed by GitHub
parent 9d0318e696
commit 910c6c69c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      typescript/helloworld/src/app/app.ts

@ -24,11 +24,19 @@ export class HelloWorldApp<
const sender = this.getContracts(from).router; const sender = this.getContracts(from).router;
const toDomain = ChainNameToDomainId[to]; const toDomain = ChainNameToDomainId[to];
const chainConnection = this.multiProvider.getChainConnection(from); const chainConnection = this.multiProvider.getChainConnection(from);
const tx = await sender.sendHelloWorld(
// apply gas buffer due to https://github.com/abacus-network/abacus-monorepo/issues/634
const estimated = await sender.estimateGas.sendHelloWorld(
toDomain, toDomain,
message, message,
chainConnection.overrides, chainConnection.overrides,
); );
const gasLimit = estimated.mul(1.1).toNumber();
const tx = await sender.sendHelloWorld(toDomain, message, {
...chainConnection.overrides,
gasLimit,
});
const receipt = await tx.wait(chainConnection.confirmations); const receipt = await tx.wait(chainConnection.confirmations);
if (receiveHandler) { if (receiveHandler) {

Loading…
Cancel
Save