Rename method to query bonds by owners
All checks were successful
Lint & Build / lint_and_build (20.x) (pull_request) Successful in 1m48s
Tests / sdk_tests (pull_request) Successful in 21m48s

This commit is contained in:
Prathamesh Musale 2024-09-06 12:24:46 +05:30
parent 7717b11fb2
commit e88105f67b
4 changed files with 14 additions and 14 deletions

View File

@ -13,7 +13,7 @@ jest.setTimeout(90 * 1000);
const bondTests = () => {
let registry: Registry;
let bond: any;
let bond0: { id: string, owner: string };
const publishNewWatcherVersion = async (bondId: string) => {
let watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
@ -30,11 +30,11 @@ const bondTests = () => {
expect(bondId).toBeDefined();
await registry.createBond({ denom: DENOM, amount: BOND_AMOUNT }, privateKey, fee);
[bond] = await registry.getBondsByIds([bondId]);
[bond0] = await registry.getBondsByIds([bondId]);
});
describe('With bond created', () => {
let bond1: any;
let bond1: { id: string, owner: string };
beforeAll(async () => {
let bondId1 = await registry.getNextBondId(privateKey);
@ -71,14 +71,14 @@ const bondTests = () => {
const { id: bondId2 } = await registry.createBond({ denom: DENOM, amount: BOND_AMOUNT }, otherAccount.getPrivateKey(), fee);
const [owner1Bonds] = await registry.queryBondsByOwner(bond.owner);
const owner1Bond1 = owner1Bonds.bonds.filter((b: any) => b.id === bond.id);
const [owner1Bonds] = await registry.queryBondsByOwners([bond0.owner]);
const owner1Bond1 = owner1Bonds.bonds.filter((b: any) => b.id === bond0.id);
const owner1Bond2 = owner1Bonds.bonds.filter((b: any) => b.id === bond1.id);
expect(owner1Bond1).toBeDefined();
expect(owner1Bond2).toBeDefined();
const [bond2] = await registry.getBondsByIds([bondId2]);
const [owner2Bonds] = await registry.queryBondsByOwner(bond2.owner);
const [owner2Bonds] = await registry.queryBondsByOwners([bond2.owner]);
expect(owner2Bonds.bonds).toHaveLength(1);
const owner2Bond = owner2Bonds.bonds.filter((b: any) => b.id === bondId2);
expect(owner2Bond).toBeDefined();

View File

@ -31,7 +31,7 @@ const configTests = () => {
await registry.createBond({ denom: DENOM, amount: '100000' }, testAccount.getPrivateKey(), testFees);
// Check that bond gets created
const [result] = await registry.queryBondsByOwner([testAccount.address]);
const [result] = await registry.queryBondsByOwners([testAccount.address]);
expect(result.bonds).toHaveLength(1);
});
@ -49,7 +49,7 @@ const configTests = () => {
await registry.createBond({ denom: DENOM, amount: '100000' }, testAccount.getPrivateKey(), testFees);
// Check that bond gets created (gas price ignored)
const [result] = await registry.queryBondsByOwner([testAccount.address]);
const [result] = await registry.queryBondsByOwners([testAccount.address]);
expect(result.bonds).toHaveLength(2);
});
@ -62,7 +62,7 @@ const configTests = () => {
await registry.createBond({ denom: DENOM, amount: '100000' }, testAccount.getPrivateKey());
// Check that bond gets created (gas price ignored)
const [result] = await registry.queryBondsByOwner([testAccount.address]);
const [result] = await registry.queryBondsByOwners([testAccount.address]);
expect(result.bonds).toHaveLength(3);
});
@ -77,7 +77,7 @@ const configTests = () => {
await registry.createBond({ denom: DENOM, amount: '100000' }, testAccount.getPrivateKey(), testFees);
// Check that bond gets created (gas price ignored)
const [result] = await registry.queryBondsByOwner([testAccount.address]);
const [result] = await registry.queryBondsByOwners([testAccount.address]);
expect(result.bonds).toHaveLength(4);
});
@ -95,7 +95,7 @@ const configTests = () => {
}
// Check that bond doesn't get created
const [result] = await registry.queryBondsByOwner([testAccount.address]);
const [result] = await registry.queryBondsByOwners([testAccount.address]);
expect(result.bonds).toHaveLength(4);
});
};

View File

@ -201,8 +201,8 @@ export class Registry {
/**
* Query bonds by owner(s).
*/
async queryBondsByOwner (owners: string[]) {
return this._client.queryBondsByOwner(owners);
async queryBondsByOwners (owners: string[]) {
return this._client.queryBondsByOwners(owners);
}
/**

View File

@ -447,7 +447,7 @@ export class RegistryClient {
/**
* Get bonds by owner(s).
*/
async queryBondsByOwner (ownerAddresses: string[]) {
async queryBondsByOwners (ownerAddresses: string[]) {
const query = `query ($ownerAddresses: [String!]) {
queryBondsByOwner(ownerAddresses: $ownerAddresses) {
owner