Skip to content

Commit

Permalink
fix: update type contract_address in evm_tx
Browse files Browse the repository at this point in the history
  • Loading branch information
fibonacci998 committed Sep 9, 2024
1 parent 069307b commit 71fe9c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/services/evm/handle_tx_evm.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fromBase64, toHex } from '@cosmjs/encoding';
import { Service } from '@ourparentcenter/moleculer-decorators-extended';
import { ServiceBroker } from 'moleculer';
import { PublicClient } from 'viem';
import { bytesToHex, hexToBytes, PublicClient } from 'viem';
import config from '../../../config.json' assert { type: 'json' };
import BullableService, { QueueHandler } from '../../base/bullable.service';
import { BULL_JOB_NAME as COSMOS_BULL_JOB_NAME } from '../../common';
Expand Down Expand Up @@ -121,11 +121,13 @@ export default class HandleTransactionEVMService extends BullableService {
.filter((evmTx) => !evmTx.to)
.map(async (evmTx) => {
const txReceipt = await this.viemClient.getTransactionReceipt({
hash: evmTx.hash as `0x${string}`,
hash: bytesToHex(evmTx.hash) as `0x${string}`,
});
if (txReceipt && txReceipt.contractAddress) {
// eslint-disable-next-line no-param-reassign
evmTx.contract_address = txReceipt?.contractAddress.toLowerCase();
evmTx.contract_address = Buffer.from(
hexToBytes(txReceipt?.contractAddress)
);
}
})
);
Expand Down

0 comments on commit 71fe9c6

Please sign in to comment.