Skip to content

Commit

Permalink
add consts for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
JSHan94 committed Dec 14, 2023
1 parent 7006080 commit b23952c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 40 deletions.
2 changes: 1 addition & 1 deletion bots/src/test/fundAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function startDepositTxBot() {
for (;;) {
const res = await txBot.deposit(
txBot.l1sender,
txBot.l2sender,
txBot.l2receiver,
new Coin('uinit', 1_000_000)
);
console.log(`Deposited height ${res.height} ${res.txhash}`);
Expand Down
6 changes: 3 additions & 3 deletions bots/src/test/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ async function startDepositTxBot() {
for (;;) {
const balance = await getBalanceByDenom(
config.l2lcd,
txBot.l2sender.key.accAddress,
txBot.l2receiver.key.accAddress,
pair.l2_denom
);
const res = await txBot.deposit(
txBot.l1sender,
txBot.l2sender,
txBot.l2receiver,
new Coin('uinit', DEPOSIT_AMOUNT)
);
console.log(
`[DepositBot] Deposited height ${res.height} to ${txBot.l2sender.key.accAddress} ${balance?.amount}`
`[DepositBot] Deposited height ${res.height} to ${txBot.l2receiver.key.accAddress} ${balance?.amount}`
);
await delay(DEPOSIT_INTERVAL_MS);
}
Expand Down
40 changes: 4 additions & 36 deletions bots/src/test/utils/TxBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,16 @@ import {
Wallet,
MsgInitiateTokenDeposit,
Coin,
MsgInitiateTokenWithdrawal,
MnemonicKey
MsgInitiateTokenWithdrawal
} from '@initia/initia.js';
import { makeFinalizeMsg } from './helper';
import { sendTx } from 'lib/tx';
import { getOutputFromExecutor, getWithdrawalTxFromExecutor } from 'lib/query';
import { getConfig } from 'config';

const config = getConfig();
import { L1_SENDER, L2_RECEIVER } from './consts';

export class TxBot {
l1sender = new Wallet(
config.l1lcd,
new MnemonicKey({
mnemonic:
// init1wzenw7r2t2ra39k4l9yqq95pw55ap4sm4vsa9g
''
})
);

l1receiver = new Wallet(
config.l1lcd,
new MnemonicKey({
mnemonic:
// init174knscjg688ddtxj8smyjz073r3w5mmsp3m0m2
''
})
);

l2sender = new Wallet(
config.l2lcd,
new MnemonicKey({
mnemonic: ''
})
);

l2receiver = new Wallet(
config.l2lcd,
new MnemonicKey({
mnemonic: ''
})
);
l1sender = L1_SENDER;
l2receiver = L2_RECEIVER;

constructor(public bridgeId: number) {}

Expand Down
21 changes: 21 additions & 0 deletions bots/src/test/utils/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { MnemonicKey } from '@initia/initia.js';
import { getConfig } from 'config';
import { TxWallet } from 'lib/wallet';

const config = getConfig();

export const { DEPOSITOR_MNEMONIC } = process.env;

export const L1_SENDER = new TxWallet(
config.l1lcd,
new MnemonicKey({
mnemonic: DEPOSITOR_MNEMONIC
})
);

export const L2_RECEIVER = new TxWallet(
config.l2lcd,
new MnemonicKey({
mnemonic: DEPOSITOR_MNEMONIC
})
);

0 comments on commit b23952c

Please sign in to comment.