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
2 changed files with 8 additions and 11 deletions
Showing only changes of commit 6ed0be38ed - Show all commits

View File

@ -21,7 +21,6 @@ jobs:
with: with:
path: "./laconicd/" path: "./laconicd/"
repository: cerc-io/laconicd repository: cerc-io/laconicd
github-server-url: 'https://git.vdb.to'
fetch-depth: 0 fetch-depth: 0
ref: main ref: main
- name: Environment - name: Environment

View File

@ -53,30 +53,28 @@ const registryTests = () => {
for (let i = 0; i < accounts.length; i++) { for (let i = 0; i < accounts.length; i++) {
await registry.sendCoins({ denom: DENOM, amount: '1000000', destinationAddress: accounts[i].address }, privateKey, fee); await registry.sendCoins({ denom: DENOM, amount: '1000000', destinationAddress: accounts[i].address }, privateKey, fee);
} }
console.log('accounts', accounts);
}); });
test('All txs get included in a single block.', async () => { test('Multiple txs get included in a block.', async () => {
// Send a bond creation tx from each account // Send a bond creation tx from each account
await Promise.all(accounts.map((account) => await Promise.all(accounts.map((account) =>
registry.createBond({ denom: DENOM, amount: '100000' }, account.getPrivateKey(), fee) registry.createBond({ denom: DENOM, amount: '100000' }, account.getPrivateKey(), fee)
)); ));
const laconicClient = await registry.getLaconicClient(accounts[0]); const laconicClient = await registry.getLaconicClient(accounts[0]);
const bondCreationTxs = await Promise.all(accounts.map(async (account) => { const bondCreationTxHeights = await Promise.all(accounts.map(async (account) => {
// Get the bond creation tx for each account // Get the bond creation tx for each account
const [tx] = await laconicClient.searchTx(`message.sender='${account.address}' AND message.action='/cerc.bond.v1.MsgCreateBond'`); const [tx] = await laconicClient.searchTx(`message.sender='${account.address}' AND message.action='/cerc.bond.v1.MsgCreateBond'`);
return tx; return tx.height;
})); }));
bondCreationTxs.forEach((tx, i) => { bondCreationTxHeights.forEach((txHeight, i) => {
console.log('tx', accounts[i].address, tx.height); console.log('tx', accounts[i].address, txHeight);
}); });
// Check that all txs are in the same block // Check that all txs are within two blocks
const expectedBlockHeight = bondCreationTxs[0].height; const expectedBlockHeight = bondCreationTxHeights.sort()[0];
expect(bondCreationTxs.every(tx => tx.height === expectedBlockHeight)).toBe(true); expect(bondCreationTxHeights.every(txHeight => txHeight === expectedBlockHeight || txHeight === expectedBlockHeight + 1)).toBe(true);
}); });
}); });
}; };