Add support for using auto fee calculation #22

Merged
nabarun merged 19 commits from deep-stack/registry-sdk:iv-add-tx-info-test into main 2024-09-06 09:07:58 +00:00
Showing only changes of commit e8c6079559 - Show all commits

View File

@ -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);