diff --git a/src/index.ts b/src/index.ts index fbe952f..17047ff 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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); } /** diff --git a/src/naming.test.ts b/src/naming.test.ts index 19832e4..58ad295 100644 --- a/src/naming.test.ts +++ b/src/naming.test.ts @@ -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); }); }); }); diff --git a/src/registry-client.ts b/src/registry-client.ts index 4658872..23c7776 100644 --- a/src/registry-client.ts +++ b/src/registry-client.ts @@ -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 + ' }') : ''} } } }`;