Skip to content

Commit

Permalink
fix: update test with new schema evm_tx
Browse files Browse the repository at this point in the history
  • Loading branch information
fibonacci998 committed Sep 10, 2024
1 parent 95c2182 commit e9a06f5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/models/evm_transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ export class EVMTransaction extends BaseModel {
static get jsonSchema() {
return {
type: 'object',
required: ['hash', 'height'],
required: ['height'],
properties: {
hash: { type: 'string' },
height: { type: 'number' },
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/services/evm/crawl_evm_account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class CrawlEvmAccountService extends BullableService {
BULL_JOB_NAME.CRAWL_EVM_TRANSACTION,
BULL_JOB_NAME.EVM_CRAWL_INTERNAL_TX,
],
config.evmCrawlInternalTx.key
config.crawlEvmAccount.key
);
this.logger.info(
`Crawl evm_account from block ${startBlock} to ${endBlock}`
Expand Down
14 changes: 8 additions & 6 deletions test/unit/services/erc721/erc721_handler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BeforeAll, Describe, Test } from '@jest-decorated/core';
import { ServiceBroker } from 'moleculer';
import { bytesToHex, hexToBytes } from 'viem';
import config from '../../../../config.json' assert { type: 'json' };
import knex from '../../../../src/common/utils/db_connection';
import {
Expand Down Expand Up @@ -42,11 +43,12 @@ export default class Erc721HandlerTest {

evmTx = EVMTransaction.fromJson({
id: 11111,
hash: '',
hash: hexToBytes(
'0x3faac2ed3ca031892c04598177f7c36e9fdcdf2fb3b6c4a13c520590facb82ef'
),
height: 111,
tx_msg_id: 222,
tx_id: 223,
contract_address: '',
index: 1,
});

Expand Down Expand Up @@ -100,7 +102,7 @@ export default class Erc721HandlerTest {
address: this.evmSmartContract.address,
evm_tx_id: this.evmTx.id,
tx_id: 1234,
tx_hash: this.evmTx.hash,
tx_hash: bytesToHex(this.evmTx.hash),
tx_index: 1,
}),
EvmEvent.fromJson({
Expand All @@ -119,7 +121,7 @@ export default class Erc721HandlerTest {
address: this.evmSmartContract.address,
evm_tx_id: this.evmTx.id,
tx_id: 1234,
tx_hash: this.evmTx.hash,
tx_hash: bytesToHex(this.evmTx.hash),
tx_index: 1,
}),
EvmEvent.fromJson({
Expand All @@ -138,7 +140,7 @@ export default class Erc721HandlerTest {
address: this.evmSmartContract2.address,
evm_tx_id: this.evmTx.id,
tx_id: 1234,
tx_hash: this.evmTx.hash,
tx_hash: bytesToHex(this.evmTx.hash),
tx_index: 1,
}),
EvmEvent.fromJson({
Expand All @@ -157,7 +159,7 @@ export default class Erc721HandlerTest {
address: this.evmSmartContract.address,
evm_tx_id: this.evmTx.id,
tx_id: 1234,
tx_hash: this.evmTx.hash,
tx_hash: bytesToHex(this.evmTx.hash),
tx_index: 1,
}),
];
Expand Down
6 changes: 4 additions & 2 deletions test/unit/services/evm/erc20_handler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AfterAll, BeforeAll, Describe, Test } from '@jest-decorated/core';
import _ from 'lodash';
import { ServiceBroker } from 'moleculer';
import { decodeAbiParameters, toHex } from 'viem';
import { decodeAbiParameters, hexToBytes, toHex } from 'viem';
import knex from '../../../../src/common/utils/db_connection';
import { getViemClient } from '../../../../src/common/utils/etherjs_client';
import {
Expand Down Expand Up @@ -111,7 +111,9 @@ const erc20Contract = Erc20Contract.fromJson({
});
const evmTransaction = EVMTransaction.fromJson({
id: 2931,
hash: '0xf15467ec2a25eeef95798d93c2fe9ed8e7c891578b8e1bcc3284105849656c9d',
hash: hexToBytes(
'0xf15467ec2a25eeef95798d93c2fe9ed8e7c891578b8e1bcc3284105849656c9d'
),
height: 1,
tx_id: 1612438,
tx_msg_id: 4752908,
Expand Down
6 changes: 4 additions & 2 deletions test/unit/services/evm/erc20_reindex.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AfterAll, BeforeAll, Describe, Test } from '@jest-decorated/core';
import _ from 'lodash';
import { ServiceBroker } from 'moleculer';
import { decodeAbiParameters, toHex } from 'viem';
import { decodeAbiParameters, hexToBytes, toHex } from 'viem';
import knex from '../../../../src/common/utils/db_connection';
import { getViemClient } from '../../../../src/common/utils/etherjs_client';
import {
Expand Down Expand Up @@ -111,7 +111,9 @@ const erc20Contract = Erc20Contract.fromJson({
});
const evmTransaction = EVMTransaction.fromJson({
id: 2931,
hash: '0xf15467ec2a25eeef95798d93c2fe9ed8e7c891578b8e1bcc3284105849656c9d',
hash: hexToBytes(
'0xf15467ec2a25eeef95798d93c2fe9ed8e7c891578b8e1bcc3284105849656c9d'
),
height: 1,
tx_id: 1612438,
tx_msg_id: 4752908,
Expand Down

0 comments on commit e9a06f5

Please sign in to comment.