Add test to send multiple txs
This commit is contained in:
parent
1916386929
commit
e8c6079559
@ -43,6 +43,37 @@ const registryTests = () => {
|
||||
expect(type).toBe(DENOM);
|
||||
expect(quantity).toBe('10000');
|
||||
});
|
||||
|
||||
test('Get transaction info.', async () => {
|
||||
const bondAmount = '100000';
|
||||
|
||||
const accounts = await createAccounts(10);
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const amount = (10 ** (15 - i)).toString();
|
||||
const fromAccount = i === 0 ? privateKey : accounts[i - 1].getPrivateKey();
|
||||
|
||||
await registry.sendCoins({ denom: DENOM, amount, destinationAddress: accounts[i].address }, fromAccount, fee);
|
||||
}
|
||||
const bondPromises = accounts.map((account) =>
|
||||
registry.createBond({ denom: DENOM, amount: bondAmount }, account.getPrivateKey(), fee)
|
||||
);
|
||||
|
||||
await Promise.all(bondPromises);
|
||||
});
|
||||
|
||||
const createAccounts = async (numAccounts: number): Promise<Account[]> => {
|
||||
const accounts: Account[] = [];
|
||||
|
||||
for (let i = 0; i < numAccounts; i++) {
|
||||
const mnemonic = Account.generateMnemonic();
|
||||
const account = await Account.generateFromMnemonic(mnemonic);
|
||||
await account.init();
|
||||
accounts.push(account);
|
||||
}
|
||||
|
||||
return accounts;
|
||||
};
|
||||
};
|
||||
|
||||
describe('Registry', registryTests);
|
||||
|
Loading…
Reference in New Issue
Block a user