Skip to content

Commit

Permalink
Merge pull request WebOfTrust#199 from psteniusubi/fix-query-anchor
Browse files Browse the repository at this point in the history
Fixes KeyStates.query with seal parameter
  • Loading branch information
pfeairheller authored Jan 23, 2024
2 parents faeebad + 12c53ab commit d640057
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion examples/integration-scripts/singlesig-dip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('singlesig-dip', () => {
result = await client1.identifiers().interact('name1', seal);
let op1 = await result.op();

// refresh keystate to sn=1
let op2 = await client2.keyStates().query(name1_id, '1');

await Promise.all([
Expand Down Expand Up @@ -74,7 +75,8 @@ describe('singlesig-dip', () => {
result = await client1.identifiers().interact('name1', seal);
op1 = await result.op();

op2 = await client2.keyStates().query(name1_id, '2');
// refresh keystate to seal event
op2 = await client2.keyStates().query(name1_id, undefined, seal);

await Promise.all([
(op = await waitOperation(client2, op)),
Expand All @@ -85,5 +87,9 @@ describe('singlesig-dip', () => {
// delegate waits for completion
delegate2 = await client2.identifiers().get('delegate2');
expect(delegate2.prefix).toEqual(op.response.i);

// make sure query with seal is idempotent
op = await client2.keyStates().query(name1_id, undefined, seal);
await waitOperation(client2, op);
});
});
6 changes: 3 additions & 3 deletions src/keri/app/coring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ export class KeyStates {
}

/**
* Query the key state of an identifier for a given sequence number or anchor SAID
* Query the key state of an identifier for a given sequence number or anchor
* @async
* @param {string} pre Identifier prefix
* @param {number} [sn] Optional sequence number
* @param {string} [anchor] Optional anchor SAID
* @param {any} [anchor] Optional anchor
* @returns {Promise<any>} A promise to the long-running operation
*/
async query(pre: string, sn?: string, anchor?: string): Promise<any> {
async query(pre: string, sn?: string, anchor?: any): Promise<any> {
const path = `/queries`;
const data: any = {
pre: pre,
Expand Down

0 comments on commit d640057

Please sign in to comment.