Update check for list authorities by owner

This commit is contained in:
IshaVenikar 2024-08-02 11:52:49 +05:30
parent a3b78fd363
commit 81dbf57fc2
3 changed files with 7 additions and 12 deletions

View File

@ -392,8 +392,8 @@ export class Registry {
/**
* List authorities by owner.
*/
async getAuthorities (owner?: string) {
return this._client.getAuthorities(owner);
async getAuthorities (owner?: string, auction = false) {
return this._client.getAuthorities(owner, auction);
}
/**

View File

@ -127,13 +127,15 @@ const namingTests = () => {
test('List authorities.', async () => {
const authorities = await registry.getAuthorities();
expect(authorities.length).toBeDefined();
expect(authorities.length).toEqual(4);
});
test('List authorities by owner.', async () => {
const authorities = await registry.getAuthorities(otherAccount1.address);
expect(authorities.length).toEqual(1);
expect(authorities[0].entry.ownerAddress).toBe(otherAccount1.address);
expect(authorities[0].entry.ownerPublicKey).toBe(otherAccount1.encodedPubkey);
});
});
});

View File

@ -273,7 +273,7 @@ export class RegistryClient {
/**
* List authorities by owner.
*/
async getAuthorities (owner?: string) {
async getAuthorities (owner?: string, auction = false) {
const query = `query ($owner: String) {
getAuthorities(owner: $owner) {
name
@ -284,14 +284,7 @@ export class RegistryClient {
status
bondId
expiryTime
auction {
id
status
ownerAddress
createTime
commitsEndTime
revealsEndTime
}
${auction ? ('auction { ' + auctionFields + ' }') : ''}
}
}
}`;