Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/complete test staging #871

Open
wants to merge 8 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 48 additions & 45 deletions src/services/evm/erc20.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { QueryModuleAccountByNameResponseSDKType } from '@aura-nw/aurajs/types/codegen/cosmos/auth/v1beta1/query';
import {
Action,
Service,
Expand All @@ -6,17 +7,16 @@ import { Knex } from 'knex';
import _ from 'lodash';
import { Context, ServiceBroker } from 'moleculer';
import { PublicClient, getContract } from 'viem';
import { QueryModuleAccountByNameResponseSDKType } from '@aura-nw/aurajs/types/codegen/cosmos/auth/v1beta1/query';
import config from '../../../config.json' assert { type: 'json' };
import BullableService, { QueueHandler } from '../../base/bullable.service';
import { SERVICE as COSMOS_SERVICE, getLcdClient } from '../../common';
import { SERVICE as COSMOS_SERVICE, Config, getLcdClient } from '../../common';
import knex from '../../common/utils/db_connection';
import { getViemClient } from '../../common/utils/etherjs_client';
import {
BlockCheckpoint,
EVMSmartContract,
EvmEvent,
Event,
EvmEvent,
} from '../../models';
import { AccountBalance } from '../../models/account_balance';
import { Erc20Activity } from '../../models/erc20_activity';
Expand All @@ -25,6 +25,7 @@ import { BULL_JOB_NAME, SERVICE as EVM_SERVICE, SERVICE } from './constant';
import { ERC20_EVENT_TOPIC0, Erc20Handler } from './erc20_handler';
import { convertEthAddressToBech32Address } from './utils';

const { NODE_ENV } = Config;
@Service({
name: EVM_SERVICE.V1.Erc20.key,
version: 1,
Expand Down Expand Up @@ -440,48 +441,50 @@ export default class Erc20Service extends BullableService {

public async _start(): Promise<void> {
this.viemClient = getViemClient();
await this.createJob(
BULL_JOB_NAME.HANDLE_ERC20_CONTRACT,
BULL_JOB_NAME.HANDLE_ERC20_CONTRACT,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.erc20.millisecondRepeatJob,
},
}
);
await this.createJob(
BULL_JOB_NAME.HANDLE_ERC20_ACTIVITY,
BULL_JOB_NAME.HANDLE_ERC20_ACTIVITY,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.erc20.millisecondRepeatJob,
},
}
);
await this.createJob(
BULL_JOB_NAME.HANDLE_ERC20_BALANCE,
BULL_JOB_NAME.HANDLE_ERC20_BALANCE,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.erc20.millisecondRepeatJob,
},
}
);
if (NODE_ENV !== 'test') {
await this.createJob(
BULL_JOB_NAME.HANDLE_ERC20_CONTRACT,
BULL_JOB_NAME.HANDLE_ERC20_CONTRACT,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.erc20.millisecondRepeatJob,
},
}
);
await this.createJob(
BULL_JOB_NAME.HANDLE_ERC20_ACTIVITY,
BULL_JOB_NAME.HANDLE_ERC20_ACTIVITY,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.erc20.millisecondRepeatJob,
},
}
);
await this.createJob(
BULL_JOB_NAME.HANDLE_ERC20_BALANCE,
BULL_JOB_NAME.HANDLE_ERC20_BALANCE,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.erc20.millisecondRepeatJob,
},
}
);
}
return super._start();
}
}
33 changes: 18 additions & 15 deletions src/services/evm/handle_tx_evm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ServiceBroker } from 'moleculer';
import { 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';
import { BULL_JOB_NAME as COSMOS_BULL_JOB_NAME, Config } from '../../common';
import knex from '../../common/utils/db_connection';
import { getViemClient } from '../../common/utils/etherjs_client';
import Utils from '../../common/utils/utils';
Expand All @@ -17,6 +17,7 @@ import {
import { BULL_JOB_NAME, MSG_TYPE, SERVICE } from './constant';
import { convertBech32AddressToEthAddress } from './utils';

const { NODE_ENV } = Config;
@Service({
name: SERVICE.V1.HandleTransactionEVM.key,
version: 1,
Expand Down Expand Up @@ -156,20 +157,22 @@ export default class HandleTransactionEVMService extends BullableService {

public async _start(): Promise<void> {
this.viemClient = getViemClient();
this.createJob(
BULL_JOB_NAME.HANDLE_TRANSACTION_EVM,
BULL_JOB_NAME.HANDLE_TRANSACTION_EVM,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.handleTransactionEVM.millisecondCrawl,
},
}
);
if (NODE_ENV !== 'test') {
this.createJob(
BULL_JOB_NAME.HANDLE_TRANSACTION_EVM,
BULL_JOB_NAME.HANDLE_TRANSACTION_EVM,
{},
{
removeOnComplete: true,
removeOnFail: {
count: 3,
},
repeat: {
every: config.handleTransactionEVM.millisecondCrawl,
},
}
);
}
return super._start();
}
}
9 changes: 3 additions & 6 deletions test/unit/services/cw721/cw721.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1812,13 +1812,10 @@ export default class AssetIndexerTest {
@Test('test handleJob')
public async testHandleJob() {
const newTokenId = 'fgksdfjghkjsdfg';
const spy = jest.spyOn(BlockCheckpoint, 'getCheckpoint');
spy.mockResolvedValue([
1,
2,
await BlockCheckpoint.query().insert([
BlockCheckpoint.fromJson({
job_name: 'dfdsfgsg',
height: 100,
job_name: BULL_JOB_NAME.HANDLE_CW721_TRANSACTION,
height: 1,
}),
]);
const msgs = [
Expand Down
192 changes: 0 additions & 192 deletions test/unit/services/erc20/erc20.spec.ts

This file was deleted.

Loading
Loading