Skip to content

Commit

Permalink
add try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U committed Mar 1, 2024
1 parent 910c02d commit d3aa7b8
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/crypto-transaction-evm-call/source/handlers/evm-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,19 @@ export class EvmCallTransactionHandler extends Handlers.TransactionHandler {

const sender = await walletRepository.findByPublicKey(transaction.data.senderPublicKey);

const result = await this.evm.transact({
caller: sender.getAddress(),
data: Buffer.from(evmCall.payload, "hex"),
recipient: transaction.data.recipientId,
});
try {
const result = await this.evm.transact({
caller: sender.getAddress(),
data: Buffer.from(evmCall.payload, "hex"),
recipient: transaction.data.recipientId,
});

// TODO: handle result
// - like subtracting gas from sender
// - populating indexes, etc.
this.logger.debug(`executed EVM call (success=${result.success}, gasUsed=${result.gasUsed})`);
// TODO: handle result
// - like subtracting gas from sender
// - populating indexes, etc.
this.logger.debug(`executed EVM call (success=${result.success}, gasUsed=${result.gasUsed})`);
} catch (error) {
this.logger.critical(`invalid EVM call: ${error.stack}`);
}
}
}

0 comments on commit d3aa7b8

Please sign in to comment.